Skip to content
Snippets Groups Projects
  1. Jul 13, 2023
    • Maksim Kaitmazian's avatar
      feat: implement md5 authentication · c6f8a85c
      Maksim Kaitmazian authored
      It prevents password sniffing and avoids storing passwords on the
      server in plain text but provides no protection if an attacker
      manages to steal the password hash from the server.
      
      Usage example:
      ```lua
      -- Enable the md5 authentication method for all new users.
      box.cfg({auth_type = 'md5'})
      
      -- Reset existing user passwords to use the md5 authentication method.
      box.schema.user.passwd('alice', 'topsecret')
      
      -- Authenticate using the md5 authentication method via net.box.
      conn = require('net.box').connect(uri, {
          user = 'alice',
          password = 'topsecret',
          -- Specifying the authentication method isn't strictly necessary:
          -- by default the client will use the method set in the remote
      	-- server config (box.cfg.auth_type)
          auth_type = 'md5',
      })
      ```
      
      part of picodata/picodata/sbroad!377
      
      @TarantoolBot document
      Title: md5 authentication method
      
      See the commit message.
      c6f8a85c
    • Maksim Kaitmazian's avatar
      feat: add user name argument to `auth_method` api · 459f7ec5
      Maksim Kaitmazian authored
      User name is usually used as a salt for user password in order to
      avoid password repeating.
      For instance, postgres md5 authentication stores passwords as
      md5("password", "user"), so that the same passwords are represented by
      different hashes.
      
      part of picodata/picodata/sbroad!377
      
      @TarantoolBot document
      Title: Document updated `box.schema.user.password` declaration.
      
      Since auth methods can use user name for hashing, user name is
      added to argument list of `box.schema.user.password`.
      
      NO_TEST=there are no methods that use user name
      459f7ec5
    • godzie44's avatar
      fix: use-after-free in `cbus_endpoint_delete` · 554a3dae
      godzie44 authored
      Calling a `TRASH` macro after calling the `free`
      function dereferences the pointer to the already
      freed memory.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      NO_TEST=picodata internal patch
      554a3dae
  2. Jun 23, 2023
    • Gleb Kashkin's avatar
      console: fix :endswith() err in tntctl connection · ef7eee49
      Gleb Kashkin authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      There used to be a rare error when failed to connect via tarantoolctl to
      listening cartridge console. It was caused by unclear
      console.local_print() contract. Starting from gh-7031 fix, the function
      assumed string-only arguments, while in some cases cdata error was
      passed.
      
      Now console.local_print() prints all non-string arguments as is, without
      modifying potential local_eos.
      
      Closes #8374
      
      NO_DOC=bugfix
      NO_TEST=very hard to test
    • Denis Smirnov's avatar
      feat: expose tuple hash calculation method · c36f674a
      Denis Smirnov authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      Picodata supports cluster-wide SQL and needs some predictable
      method to calculate tuple hashes for the bucket ids. Method
      should be available for Lua, C and Rust users. It was decided
      to expose a murmur3 hash calculation method of the key_def module.
      
      NO_DOC=picodata internal patch
      NO_CHANGELOG=picodata internal patch
      c36f674a
    • godzie44's avatar
      cbus: introduce lcpipe - light cpipe · 5377a748
      godzie44 authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      Introduced a new type of cbus pipe - lcpipe. The current pipe in the
      cbus - cpipe, has a number of limitations, first of all - the cpipe
      cannot be used from the 3rd party threads, cpipe only works as a channel
      between two cords. That why lcpipe is needed. Its main responsibility -
      create channel between any thread and tarantool cord.
      
      Internally lcpipe is a cpipe, but:
      - on flush triggers removed, cause triggers use thread-local mem-pool,
      this is not possible on a third party thread
      - producer event loop removed, cause there is no libev event loop in
      third party thread
      
      Also, lcpipe interface is exported to the outside world.
      
      NO_DOC=core feature
      5377a748
    • Дмитрий Кольцов's avatar
      build(CMakeLists.txt): disable feedback daemon by default · d91783b6
      Дмитрий Кольцов authored
      NO_DOC=disable feedback
      NO_TEST=disable feedback
      d91783b6
    • Vladimir Davydov's avatar
      vinyl: don't make dir when index is created · 74775f4c
      Vladimir Davydov authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      The index directory is created on demand since commit c00ba8e7
      ("xlog: make log directory if needed") and removed when it becomes
      empty. There's no need to create it when an index is created anymore.
      
      Follow-up #8441
      
      NO_DOC=bugfix
      74775f4c
    • Denis Smirnov's avatar
      vinyl: remove root directory if there are no more runs · b3b69c62
      Denis Smirnov authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      When vinyl space is dropped, its files are left on the file system
      until GC removes them. At the moment GC removes only run files,
      but not the root directory. These empty directories are never
      removed and occupy 4KB on ext-family file systems each. In a case
      of many dropped vinyl spaces it can become a serious disk space
      and inode leak. Current commit makes gc always remove root directory
      if there are no runs in it.
      
      Closes #8441
      
      NO_DOC=bugfix
      b3b69c62
    • Дмитрий Кольцов's avatar
      fix(schema version): fix some types that were not updated to 64 bit · 587118de
      Дмитрий Кольцов authored
      NO_DOC=core feature
      NO_TEST=no Lua API
      NO_CHANGELOG=bugfix
      587118de
    • Дмитрий Кольцов's avatar
      feat(json): add option to encode decimals as string · 370fbae1
      Дмитрий Кольцов authored
      Due to inconsistency of Tarantool type casting while using strict
      data types as "double" or "unsigned" it is needed
      to use "number" data type in a whole bunch of cases.
      However "number" may contain "decimal" that will be serialized into
      string by JSON builtin module.
      
      This commit adds "encode_decimal_as_number" parameter to json.cfg{}.
      That forces to encode `decimal` as JSON number to force type
      consistency in JSON output.
      Use with catious - most of JSON parsers assume that number is restricted
      to float64.
      
      NO_DOC=we do not host doc
      370fbae1
    • Denis Smirnov's avatar
      sql: recompile expired prepared statements · 6295a3a0
      Denis Smirnov authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      Actually there is no reason to throw an error and make a user
      manually recreate prepared statement when it expires. A much more
      user friendly way is to recreate it under hood when statement's
      schema version differs from the box one.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      6295a3a0
    • Denis Smirnov's avatar
      fix: default result parameter type · e98afa48
      Denis Smirnov authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      Problem description.
      
      When we prepare a statement with parameters in the result columns
      (for example box.prepare('select ?')) Tarantool has no information
      about the type of the output column and set it to default boolean.
      Then, on the execution phase, the type would be recalculated during
      the parameter binding.
      
      Tarantool expects that there is no way for parameter to appear in the
      result tuple other than exactly be mentioned in the final projection.
      But it is incorrect - we can easily propagate parameter from the inner
      part of the join. For example
      
      box.prepare([[select COLUMN_1 from t1 join (values (?)) as t2 on true]])
      
      In this case column COLUMN_1 in the final projection is not a
      parameter, but a "reference" to it and its type depends on the
      parameter from the inner part of the join. But as Tarantool
      recalculates only binded parameters in the result projection,
      it doesn't change the default boolean metadata type of the COLUMN_1
      and the query fails on comparison with the actual type of the tuple.
      
      Solution.
      As we don't want to patch Vdbe to make COLUMN_1 refer inner parameter,
      it was decided to make a simple workaround: change the default
      column type from BOOLEAN to ANY for parameters. It fixes the
      comparison with the actual tuple type (we do not fail), but in some
      cases get ANY column in the results where we would like to have
      explicitly defined type. Also NULL parameters would also have ANY
      type, though Tarantool prefers to have BOOLEAN in this case.
      
      Closes https://github.com/tarantool/tarantool/issues/7283
      
      NO_DOC=bug fix
      e98afa48
    • godzie44's avatar
      sql: add sql_execute_prepared_ext function, same as sql_execute_prepared but... · 3155b329
      godzie44 authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      sql: add sql_execute_prepared_ext function, same as sql_execute_prepared but without `region` parameter
      closes #2
      
      NO_DOC=minor
      NO_TEST=minor
      3155b329
    • godzie44's avatar
      compatibility with tarantool-module: · 633c443b
      godzie44 authored and Дмитрий Кольцов's avatar Дмитрий Кольцов committed
      - add box_tuple_data_offset function (return offset of the messagePack encoded data from the beginning of the tuple)
      - add more export functions
      
      closes #1
      
      NO_DOC=build
      NO_TEST=build
      633c443b
  3. Mar 07, 2023
  4. Mar 06, 2023
    • Oleg Jukovec's avatar
      httpc: check region_join result · 7a86f262
      Oleg Jukovec authored
      This patch addresses coverity complain 1535241.
      
      Follow-up #8047
      
      NO_TEST=nit
      NO_CHANGELOG=nit
      NO_DOC=nit
      
      (cherry picked from commit 089cbfa9)
      Unverified
      7a86f262
    • Vladimir Davydov's avatar
      box: check iterator position against search criteria · 54c50e53
      Vladimir Davydov authored
      If the 'after' key is less than the search key in case of ge/gt or
      greater than the search key in case of le/lt, the iterator either
      crashes (vinyl) or returns invalid result (memtx). This happens because
      the engine implementation doesn't expect an invalid 'after' key.
      Let's fix this by raising an error at the top level in case the 'after'
      key doesn't meet the search criteria.
      
      Closes #8403
      Closes #8404
      
      NO_DOC=bug fix
      NO_CHANGELOG=unreleased
      
      (cherry picked from commit c561202d)
      54c50e53
    • Vladimir Davydov's avatar
      box: raise ER_ITERATOR_POSITION on any kind of invalid position · 000e5e8f
      Vladimir Davydov authored
      Currently, if the position isn't compatible with the index, we raise
      an error like "Invalid key part count ...". From this error it's
      difficult to figure out whether it's for the given iterator position of
      for the search key. Let's always raise ER_ITERATOR_POSITION in this
      case. Later on we'll use stacked diag to add extra error info.
      
      Needed for #8403
      Needed for #8404
      
      NO_DOC=bug fix
      NO_CHANGELOG=unreleased
      
      (cherry picked from commit 81d43c17)
      000e5e8f
    • Vladimir Davydov's avatar
      key_def: make key_compare take keys without header · 0cff8847
      Vladimir Davydov authored
      We need to compare a tuple position with a search key in select() and
      pairs() to make sure the tuple position meets the search criteria. The
      problem is that we strip the MessagePack header from the position while
      key_compare() takes keys with headers. Let's make key_compare take keys
      without headers like the rest of comparator functions. Since in Vinyl we
      often need to compare keys with headers, we also add vy_key_compare()
      helper function.
      
      Needed for #8403
      Needed for #8404
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      
      (cherry picked from commit 41b8a012)
      0cff8847
    • Igor Munkin's avatar
      lua: disable JIT engine on macOS by default · 44af252c
      Igor Munkin authored
      To improve customer experience it was decided to disable JIT engine on
      Tarantool startup for macOS builds. Either way, JIT will be aboard as a
      result of the changes and more adventurous users will be able to enable
      it via <jit.on> in their code.
      
      Furthermore, for convenient maintenance of JIT default behaviour CMake
      configuration option "LUAJIT_JIT_STATUS" is introduced.
      
      Closes #8252
      
      NO_DOC=no behaviour changes
      
      (cherry picked from commit ae0db476)
      44af252c
  5. Mar 03, 2023
  6. Mar 02, 2023
    • Georgiy Lebedev's avatar
      box: refactor `check_select_safety` and add it to `box.internal` · a23f4022
      Georgiy Lebedev authored
      Refactor logging of dangerous `select` call out of `check_select_safety`
      and add it to `box.internal` so that it can be reused for read views.
      
      Change all occurrences of 'dangerous' to 'long' to be consistent with the
      log message.
      
      Needed for tarantool/tarantool-ee#211
      
      NO_CHANGELOG=<refactoring>
      NO_DOC=<refactoring>
      NO_TEST=<refactoring>
      
      (cherry picked from commit 4221a983)
      a23f4022
    • Ilya Verbin's avatar
      main: fix wrong log level printed at first box.cfg{} · 861d6ae7
      Ilya Verbin authored
      The `log_level' configuration parameter can be set as a number or a string.
      When it is a string, cfg_geti() returns 0. Use log_default->level instead,
      which is initialized earlier during box_init_say().
      
      Closes #8287
      
      NO_DOC=bugfix
      NO_CHANGELOG=minor bug
      
      (cherry picked from commit 41ead021)
      861d6ae7
    • Mergen Imeev's avatar
      sql: fix assertion in case FK or CK declared first · 3a10085b
      Mergen Imeev authored
      This patch fixes an assertion or segmentation error if a FOREIGN KEY or
      CHECK constraint is declared before the first column.
      
      Closes #8392
      
      NO_DOC=bugfix of the bug added in the current release
      NO_CHANGELOG=bugfix of the bug added in the current release
      3a10085b
    • Serge Petrenko's avatar
      replication: add remote peer connection timeout · 03d3362d
      Serge Petrenko authored
      We use coio_connect() to connect the replica to a remote peer. It
      implies no timeout, and does a non-blocking connect() to the peer and
      then waits for the socket to become writable indefinitely.
      
      When the remote peer changes its IP address, connect() might try
      connecting to the old address for as long as ~ 2 minutes (given the
      default tcp_syn_retries value of 6).
      
      This blocks replica from trying to reconnect to the updated address and
      is pretty inconvenient.
      
      Let's use coio_connect_timeout() instead and use
      replication_disconnect_timeout() as a timeout, like everywhere else in
      master-replica communication.
      
      Closes #7294
      
      NO_DOC=bugfix
      
      (cherry picked from commit 0486a489)
      03d3362d
  7. Mar 01, 2023
    • Georgiy Lebedev's avatar
      memtx: fix force recovery handling · 3d71f7df
      Georgiy Lebedev authored
      Force recovery needs to follow the following logic: any unsuccessful system
      space request must make recovery fail (including failure to decode an xrow,
      when we are not sure we have finished processing system space request). If
      the request is a non-insert one (e.g., raft or synchro) or addresses a user
      space, it means we have finished processing system space requests, and from
      this moment force recovery can be enabled — change the behaviour
      accordingly.
      
      We assume the request order in the snapshot is the following:
      1. system space requests;
      2. user space requests;
      3. non-insert requests (e.g., raft or synchro).
      
      Refactor the force recovery logic: add a enumeration to track snapshot
      recovery state and add a new diagnostic for the case when the snapshot
      contains has no system spaces.
      
      Closes #7974
      
      NO_DOC=bugfix
      
      (cherry picked from commit b1095c1c)
      3d71f7df
    • Georgiy Lebedev's avatar
      box: add `space_id_is_system` helper · a4a80d00
      Georgiy Lebedev authored
      In some cases we don't have the whole space struct, but we want to
      determine whether the provided space identifier corresponds to a system
      space — add a `space_id_is_system` helper and refactor `space_is_system` to
      reuse it.
      
      Needed for #7974
      
      NO_CHANGELOG=refactoring
      NO_DOC=refactoring
      NO_TEST=refactoring
      
      (cherry picked from commit 928e5733)
      a4a80d00
    • Sergey Bronnikov's avatar
      httpc: add a decoders to a http response · cf396115
      Sergey Bronnikov authored
      Patch fixes a bug when body in response couldn't be decoded:
      
      NO_WRAP
      ```
      tarantool> httpc = require('http.client').new()
      tarantool> response = httpc:get('https://jsonplaceholder.typicode.com/todos/1'
      
      )
      tarantool> response:decode()
      
      ---
      - error: 'builtin/http.client.lua:301: attempt to index field ''decoders'' (a nil
          value)'
      ...
      ```
      NO_WRAP
      
      Now response object contains table with decoders defined by user in his
      http client instance. We hide this table on response serialization by
      adding underscore because decoders there is not a part of API.
      
      Reported-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      
      Fixes #8363
      
      NO_DOC=bugfix
      
      (cherry picked from commit 83168b25)
      Unverified
      cf396115
  8. Feb 27, 2023
  9. Feb 22, 2023
  10. Feb 20, 2023
    • Vladimir Davydov's avatar
      lua/fiber: add compat option for default slice · 6fa6e212
      Vladimir Davydov authored
      The new compat option 'fiber_slice_default' is added to control
      the default value of the max fiber slice. The old default is no limit
      (both warning and error slice equals TIMEOUT_INFINITY). The new default
      is {warn = 0.5, err = 1.0}.
      
      Follow-up #6085
      
      NO_DOC=tarantool/doc#3057
      NO_CHANGELOG=unreleased
      6fa6e212
    • Vladimir Davydov's avatar
      lua/fiber: add max slice to fiber info · 448c3a05
      Vladimir Davydov authored
      This commit adds the new field 'max_slice' to fiber.info() that reports
      the max slice applied to the given fiber. The value is a table with two
      fields: 'err' for error slice and 'warn' for warning slice. Values
      greater than or equal to TIMEOUT_INFINITY aren't reported.
      
      Follow-up #6085
      
      NO_DOC=tarantool/doc#3057
      NO_CHANGELOG=unreleased
      448c3a05
    • Vladimir Davydov's avatar
      lua/fiber: improve error message raised on invalid slice · 3ad578d4
      Vladimir Davydov authored
      Error messages raised when an invalid slice is specified are confusing:
      
        tarantool> fiber = require('fiber')
        ---
        ...
      
        tarantool> fiber.set_max_slice('foo')
        ---
        - error: slice must be a table or a number
        ...
      
        tarantool> fiber.set_max_slice({})
        ---
        - error: 'bad argument #3 to ''?'' (number expected, got nil)'
        ...
      
      Let's change the error message to "slice must be a number or a table
      {warn = <number>, err = <number>}".
      
      Follow-up #6085
      
      NO_DOC=undocumented
      NO_CHANGELOG=unreleased
      3ad578d4
    • Vladimir Davydov's avatar
      Move tarantool-gdb.py to tools · f01e68b0
      Vladimir Davydov authored
      It doesn't belong to Tarantool sources. The tools directory looks like
      the right place for it.
      
      NO_DOC=code cleanup
      NO_TEST=code cleanup
      NO_CHANGELOG=code cleanup
      f01e68b0
    • Mergen Imeev's avatar
      box: support downgrading of tuple constraints · 436b1b17
      Mergen Imeev authored
      This patch allows to downgrade tuple foreign keys to SQL foreign keys
      and some tuple check constraints to SQL check constraints. The only
      tuple check constraints that can be downgraded are those using functions
      with the SQL_EXPR language.
      
      Closes #7718
      
      NO_DOC=already introduced
      NO_CHANGELOG=already introduced
      436b1b17
    • Timur Safin's avatar
      debugger: use option -d for debugger activation · a984fc0d
      Timur Safin authored
      Added `-d` option for activation of debugger shell:
      - it calls debugger shell in `luadebug.lua` instead of
        a standard interactive shell from `console.lua`;
      - that option complements original way for starting a
        debugging shell via `require 'luadebug'()`, but is a
        little bit easier.
      
      NB! At the moment when we enter debugging mode instead of
      a standard Tarantool console, we change banner to:
      ```
      Tarantool debugger 2.11.0-entrypoint-852-g9e6ed28ae
      type 'help' for interactive help
      ```
      
      Part of #7456
      
      @TarantoolBot document
      Title: Command-line option `-d` for console debugger.
      
      Please see third_party/lua/README-luadebug.md for a full description
      of different ways to activate debugging shell.
      a984fc0d
    • Nikolay Shirokovskiy's avatar
      upgrade: add "2.10.5" to box.schema.downgrade_versions(). · 6fcce8e8
      Nikolay Shirokovskiy authored
      2.10.5 version is going to be released at the same time as 2.11.0 thus
      let's add it to the box.schema.downgrade_versions().
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      NO_TEST=internal
      6fcce8e8
    • Ilya Verbin's avatar
      log: allow "tarantool" as module name in box.cfg{log_modules = ...} · facd04c2
      Ilya Verbin authored
      Currently it's possible to set the log level for a particular Lua module,
      or to change the default log level, however there is no way to change it
      only for Tarantool system messages. This patch introduces a fake module
      name "tarantool" for this purpose.
      
      Closes #8320
      
      NO_CHANGELOG=Unreleased feature
      NO_DOC=Will update tarantool/doc#3264
      facd04c2
    • Oleg Jukovec's avatar
      httpc: introduce stream input/output interface · 417c6cb7
      Oleg Jukovec authored
      Add a streaming data input/output object for http.client. The
      input/output object can be created using the same methods and the
      same options as a normal request, but with a new option
      {chunked = true}.
      
      Closes #7845
      
      @TarantoolBot document
      Title: Stream input/output interface for http.client
      
      An uncompleted io object has only headers and cookies fields. A
      completed io object has the same fields as a normal request, but
      without the `body` field.
      
      The io object interface looks like the socket object interface
      and should have the same description:
      
      ```
      io_object:read(chunk[, timeout])
      io_object:read(delimiter[, timeout])
      io_object:read({chunk = chunk, delimiter = delimiter}[, timeout])
      io_object:write(data[, timeout])
      ```
      
      The difference is in the method `finish`. Unlike socket:close()
      it has an optional parameter `timeout`:
      
      ```
      io_object:finish([timeout])
      ```
      
      Be careful, the call may yield a fiber. The idea is to wait
      until a HTTP connection is finished by the server-side or
      force finish the connection from client-time after a timeout
      value.
      
      The default timeout value is 10 seconds for all methods.
      
      Usage example:
      
      ```lua
      local io = httpc:post(url, nil, {chunked = true})
      
      local write_chan = fiber.channel()
      fiber.new(function()
          fiber.name("write to " .. url)
          while true do
              local data = write_chan:get()
              if data == nil then
                  break
              end
              io:write(data, 1)
          end
      end)
      
      local recvdata
      while recvdata = io:read('\r\n', 1) do
          local decoded = json.decode(recvdata)
          if condition(decoded) then
              write_chan:put(data)
          end
          if condition(decoded) then
              io:finish(1)
          end
      end
      write_chan:close()
      ```
      
      See also:
      * https://www.tarantool.io/en/doc/latest/reference/reference_lua/socket/#lua-function.socket_object.read
      * https://github.com/tarantool/tarantool/issues/7845#issuecomment-1298538412
      * https://github.com/tarantool/tarantool/issues/7845#issuecomment-1298821779
      417c6cb7
Loading