Skip to content
Snippets Groups Projects
  1. Apr 21, 2023
    • Vladimir Davydov's avatar
      box: apply dynamic cfg even if option value is unchanged · 9b2b3e58
      Vladimir Davydov authored
      If a configuration option value passed to `box.cfg` is the same as the
      old one, the option handler isn't called. However, sometimes we might
      need to do some extra work in the handler in this case. For example,
      even if listen/replication URI is the same, we still need to recreate
      the derived IO stream context, because a URI parameter may contain a
      path to a file (for example, an SSL certificate), which could change.
      
      So we remove the corresponding check from load_cfg.lua and instead move
      it to option handlers. Most of the existing dynamic option handlers
      already do nothing if the old and the new values are the same. There are
      only three exceptions:
      
       1. box.cfg.memtx_memory. The problem is that the value is rounded up
          to a multiple of the quota unit size by the handler so even if we
          pass exactly the same value, it may mistakenly assume that the new
          value is less and fail. To avoid that, we make the handler round up
          the new value before checking it.
      
       2. box.cfg.replication. Even though commit 5994892c ("replication:
          fix replica disconnect upon reconfiguration") made the handler avoid
          disconnect, it still tries to connect to the new URIs and sync,
          which may pose a problem to our users. For example, resetting
          box.cfg.replication to the same value on the leader after right
          after a new cluster bootstrap (before granting access to replicas)
          would lead to a replication sync, which would obviously fail on
          timeout. To avoid that, we make the handler compare the new and old
          URIs internally and do nothing if they are the same.
      
       3. box.cfg.listen. Handled similarly to box.cfg.replication: to avoid
          futile rebinding of IPROTO ports, we store the last configured
          listen URIs in a C variable and do nothing on box.cfg if the
          configuration is the same.
      
      Needed for tarantool/tarantool-ee#432
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      9b2b3e58
    • Vladimir Davydov's avatar
      iproto: refactor evio service configuration · 2644add4
      Vladimir Davydov authored
       - Call listen() once per socket in the TX thread instead of doing it in
         each IPROTO thread because calling listen() more than once has no
         effect.
       - Merge evio_service_bind and evio_service_listen into one method
         named evio_service_start to match evio_service_stop.
       - Rename IPROTO_CFG_LISTEN message to IPROTO_CFG_START to match
         IPROTO_CFG_STOP and drop the binary argument because it always
         attaches to tx_binary.
       - Drop the dead evio_service_is_active check from IPROTO_CFG_START
         because the service must be inactive at this point and we have an
         assertion for that in evio_service_attach.
       - Move ERRINJ_IPROTO_CFG_LISTEN error injection to iproto_listen and
         drop the error code of iproto_send_start_msg because it should never
         fail by design.
      
      Needed for tarantool/tarantool-ee#432
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      2644add4
    • Vladimir Davydov's avatar
      box: make box_check_uri_set return parsed uri set · 0561fd52
      Vladimir Davydov authored
      To handle the case when box.cfg.replication isn't changed (required for
      SSL certificate update), we need the uri set in box_set_replication.
      We could obtain it with cfg_get_uri_set, but calling this function right
      after box_check_replication, which already creates the uri set looks
      ugly. Let's make box_check_uri_set, box_check_replication, and
      box_check_listen return the uri_set, like box_check_uri does.
      
      While we are at it, fix a memory leak in box_check_config, where we
      forgot to destroy the uri returned by box_check_bootstrap_leader.
      The leak is insignificant and may only happen once so this doesn't
      deserve to be mentioned in the changelog.
      
      Needed for tarantool/tarantool-ee#432
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      0561fd52
    • Vladimir Davydov's avatar
      replication: pass uris instead of appliers to replicaset_connect · 0f12367f
      Vladimir Davydov authored
      Historically, we create appliers in box.cc and then pass them to
      replicaset_connect. Now, that we have struct uri_set, it's better
      to pass URIs instead of appliers and let replicaset_connect create
      appliers. It looks better because replicaset_connect may actually
      delete some of the passed appliers on success, which makes the
      function protocol difficult for understanding. Another reason to
      pass URIs instead of appliers is that we need to store the configured
      URIs in replication.cc so that we can detect the case when box.cfg
      doesn't change box.cfg.replication (required for SSL certificate
      update).
      
      While we are at it,
       - Make replica_set_applier and replica_clear_applier static.
       - Mark the URI argument of applier_new as const and copy it instead
         of moving. This isn't a hot path and with copying it's easier to
         make assumptions about object lifetime.
       - Remove the error label from replicaset_connect. Use a guard instead.
      
      Needed for tarantool/tarantool-ee#432
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      0f12367f
    • Vladimir Davydov's avatar
      box: fix memory leak on replication configuration failure · b56a7ead
      Vladimir Davydov authored
      Appliers array and count are captured by value before initialization.
      As a results, appliers won't be freed if replication configuration
      fails.
      
      NO_DOC=bug fix
      NO_CHANGELOG=minor
      NO_TEST=should be checked by ASAN, see #7326
      b56a7ead
    • Vladimir Davydov's avatar
      applier: do not create iostream context for ballot watcher · 276ba093
      Vladimir Davydov authored
      There's absolutely no reason to create a new iostream context for a
      ballot watcher, because it'll be exactly the same as the one used by
      the applier because it's created from the same URI.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      276ba093
    • Vladimir Davydov's avatar
      uri: introduce uri_is_equal, uri_set_is_uqual, uri_set_copy · 81aa9458
      Vladimir Davydov authored
      Needed for tarantool/tarantool-ee#432
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      81aa9458
  2. Apr 20, 2023
    • Oleg Chaplashkin's avatar
      test: bump test-run to new version · c5f5ee0d
      Oleg Chaplashkin authored
      Bump test-run to new version with the following improvements:
      
      - Bump luatest to 0.5.7-38-ge6a2093 [1]
      
      [1] tarantool/test-run@affa13f
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      c5f5ee0d
    • Mergen Imeev's avatar
      sql: fix possible use-after-free in select.c · 1ffd2ce0
      Mergen Imeev authored
      This patch fixes a possible 'use-after-free' of field pOrderBy in
      generateWithRecursiveQuery().
      
      Closes tarantool/security#120
      
      NO_DOC=bugfix
      1ffd2ce0
    • Mergen Imeev's avatar
      sql: fix memory leaks · cd173ce5
      Mergen Imeev authored
      This patch fixes SQL memory leaks found by static analyzers and SQL
      fuzzer.
      
      Part of tarantool/security#120
      
      NO_DOC=fix for memleak
      NO_TEST=fix for memleak
      NO_CHANGELOG=fix for memleak
      cd173ce5
    • Mergen Imeev's avatar
      sql: return if argument is NULL in sql_xfree() · 1f816681
      Mergen Imeev authored
      The sql_xfree() function can take NULL as an argument, and this is not
      an error because db->lookaside.pStart > NULL. However, this causes
      warnings from static analyzers. Let's add an explicit check to avoid
      these warnings.
      
      Part of tarantool/security#120
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      1f816681
    • Mergen Imeev's avatar
      sql: remove unnecessary checks · 50036331
      Mergen Imeev authored
      This patch removes some unnecessary checks that should have been removed
      in the 'sql: refactor memory allocation system' patch.
      
      Also, this patch removes the unnecessary check that the return value of
      space_by_id() is NULL in sql_check_create(). Return values is not NULL
      because sql_check_create() can be called in two cases:
      1) space was just created, and space_id is its ID;
      1) space_id was obtained directly from the space that existed at the
      time the VDBE was created.
      
      Part of tarantool/security#120
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      50036331
    • Mergen Imeev's avatar
      sql: remove dead code · da8b1f9a
      Mergen Imeev authored
      This patch removes some dead code in SQL. This is done to silence static
      analyzers. In addition, this patch removes the mmapSizeActual field from
      the struct unixFile, since this field is identical to the mmapSize field
      in the same structure.
      
      Part of tarantool/security#120
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      da8b1f9a
  3. Apr 18, 2023
    • Ilya Verbin's avatar
      box: populate index_object.parts with key_def module methods · 55295f5f
      Ilya Verbin authored
      This patch adds 4 methods of the key_def module instance to the
      `index_object.parts`, see the docbot request for details. The rest
      methods (new() and totable()) are not applicable here, because the
      instance is already created and pushed to the stack as a table.
      
      Closes #7356
      
      @TarantoolBot document
      Title: `index_object.parts` methods
      Product: Tarantool
      Since: 3.0
      Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_index/parts/
      
      `index_object.parts` has the following methods: `extract_key()`,
      `compare()`, `compare_with_key()`, `merge()`.
      For their description and usage examples, refer to
      [Module key_def](https://www.tarantool.io/en/doc/latest/reference/reference_lua/key_def/#lua-object.key_def.key_def_object).
      
      ---
      
      Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/key_def/
      
      `index_object.parts` can be used like a key_def module instance for calling
      the corresponding methods. Example:
      
      ```lua
      box.schema.space.create('T')
      i = box.space.T:create_index('I', {parts={3, 'string', 1, 'unsigned'}})
      box.space.T:insert{1, 99.5, 'X', nil, 99.5}
      i.parts:extract_key(box.space.T:get({'X', 1}))
      ```
      
      The code above is equivalent to:
      
      ```lua
      key_def = require('key_def')
      box.schema.space.create('T')
      i = box.space.T:create_index('I', {parts={3, 'string', 1, 'unsigned'}})
      box.space.T:insert{1, 99.5, 'X', nil, 99.5}
      k = key_def.new(i.parts)
      k:extract_key(box.space.T:get({'X', 1}))
      ```
      55295f5f
    • Mikhail Elhimov's avatar
      gdb: nice list walking · 2e1fea40
      Mikhail Elhimov authored
      Introduced command 'tt-list-walk'
      
      Changes in 'tt-list' options:
      - dropped options -pre/post (previously used to implement walking
        functionality; no longer needed)
      - option -filter was renamed to -predicate (so it can be specified with
        just -p while previously at least -fil need to be used to avoid
        ambiguity with -fields option)
      
      Closes #8524
      
      NO_DOC=gdb extension
      NO_TEST=gdb extension
      NO_CHANGELOG=gdb extension
      2e1fea40
  4. Apr 17, 2023
    • Ilya Verbin's avatar
      cmake: always define TARGET_OS_* to 0 or 1 · 19b53ac3
      Ilya Verbin authored
      There is a system include file TargetConditionals.h on macOS, which
      defines TARGET_OS_LINUX (and others) to 0 or 1. On the other side,
      TARGET_OS_LINUX is also defined by trivia/config.h.cmake, but there it
      has another possible values: undefined or 1. This inconsistency causes
      issues like #8445, when TARGET_OS_LINUX is defined (to 0) in one file
      and undefined in another. Let's always define it to 0 or 1.
      
      Closes #8445
      
      NO_DOC=bugfix
      19b53ac3
    • Vladimir Davydov's avatar
      lua: add malloc info · d34a0cbc
      Vladimir Davydov authored
      This commit adds two new Lua functions:
       - `box.malloc.info()` is a public function that returns the total
         memory usage of internal data structures allocated with `malloc()`.
         This information is extracted from the `malloc_info()` output.
         See the doc bot request for details.
       - `box.malloc.internal.info()` is an internal function that returns
         a parsed XML document returned by `malloc_info()` as is. It isn't
         documented. We may need it to get the detailed information about
         the system memory allocator.
      
      Both functions are useful only on Linux and only if ASAN is disabled
      because otherwise `malloc_info()` is unavailable. On other platforms
      `box.malloc.info()` reports zero memory usage while `internal.info()`
      returns an empty table.
      
      Closes #7311
      
      @TarantoolBot document
      Title: Document `box.malloc.info()`
      
      `box.malloc.info()` is a function that returns a table with two fields:
      
      ```
      tarantool> box.malloc.info()
      ---
      - size: 2498560
        used: 1835726
      ...
      ```
      
      The `used` value is the total amount of memory in bytes allocated by
      Tarantool for internal data structures with [`malloc()`][1].
      
      The `size` value is the total amount of memory in bytes allocated from
      the system by the `malloc()` allocator. It may not be less than `used`.
      
      The function may be used before `box.cfg()` is called.
      
      Currently, the function is available only on Linux. On other systems it
      reports zero memory usage (`{size = 0, used = 0}`).
      
      [1]: https://man7.org/linux/man-pages/man3/malloc.3.html
      d34a0cbc
    • Vladimir Davydov's avatar
      lua: add internal xml parser · 5f596b25
      Vladimir Davydov authored
      We need an XML parser to parse the string returned by malloc_info.
      This commit implements a simple parser in Lua C that transforms
      an XML string into a Lua table. The parser is available both from
      C (luaT_xml_decode) and Lua (internal.xml.decode).
      
      Needed for #7311
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      5f596b25
    • Mergen Imeev's avatar
      sql: limit memory allocation in REPLACE() · be3034ab
      Mergen Imeev authored
      This patch limits the amount of allocated memory in the built-in
      REPLACE() function.
      
      Follow-up tarantool/security#119
      
      NO_DOC=bugfix
      NO_CHANGELOG=already exists
      be3034ab
  5. Apr 14, 2023
    • Andrey Saranchin's avatar
      tuple_extract: correctly extract key from tuples without trailing nils · 199e20b9
      Andrey Saranchin authored
      Function tuple_extract_key_raw for nullable partially sequential key_def
      can extract wrong key from tuples without trailing nils. Fortunately,
      it does not affect tarantool - tuple_extract_key_raw is used only with
      cmp_def, which ends with non-nullable primary key definition, hence
      contains no trailing nils.
      
      Closes #8504
      
      NO_CHANGELOG=no visible changes
      NO_DOC=no visible changes
      199e20b9
    • Gleb Kashkin's avatar
      fio: fix default mode for files created by open() · 3d6025dc
      Gleb Kashkin authored
      For an unknown reason default fio.open() mode used to be set as
      0777 & umask that basically equals 18, meaning no read/write/execute
      rights for anyone.
      
      Now the default is 0666 before umask, meaning read and write access.
      
      Closes #7981
      
      NO_DOC=bugfix
      3d6025dc
  6. Apr 13, 2023
  7. Apr 12, 2023
    • Mergen Imeev's avatar
      sql: introduce SHOW CREATE TABLE statement · 5ab5ce2a
      Mergen Imeev authored
      This patch introduces the SHOW CREATE TABLE statement. This statement
      can be used to obtain a description of a space in the form of a
      corresponding CREATE TABLE and CREATE INDEX statements.
      
      Closes #8098
      
      @TarantoolBot document
      Title: SHOW CREATE TABLE statement
      
      Statement can be used to obtain a description of a space in the form of
      a corresponding `CREATE TABLE` and `CREATE INDEX` statements. Result
      will be in form of set of statements and set of found errors. If errors
      were not detected, set of the statements should be enough to completely
      serialize space definition.
      
      There is two types of `SHOW CREATE TABLE` statement:
      1) Get a description of a single space:
      ```
      SHOW CREATE TABLE table_name;
      ```
      
      This statement can be used to obtain a description of a space in the
      form of the corresponding `CREATE TABLE` and `CREATE INDEX` statements.
      The result will be in the form of a set of statements and a set of found
      errors. If no errors are found, the set of statements should be
      sufficient to fully serialize the space definition. Otherwise, it will
      certainly not be a complete space definition, and a `CREATE TABLE`
      statement is generally not guaranteed to be syntactically correct.
      
      2) Get descriptions of all available non-system spaces:
      ```
      SHOW CREATE TABLE;
      ```
      
      This statement returns descriptions for each available non-system space
      in the form described above.
      5ab5ce2a
    • Mergen Imeev's avatar
      trivia: add string conversion to upper case · 0700f514
      Mergen Imeev authored
      In some cases we need to convert a string to upper case (e.g., when
      normalizing a lower-case field name for SQL): add helper functions
      that do this in-place or by creating a copy of the original string.
      
      Needed for #8098
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      0700f514
    • Yaroslav Lobankov's avatar
      ci: reduce testing for macOS 12 · 2f1ae906
      Yaroslav Lobankov authored
      We have the limited hardware resources with macOS 12, and full testing
      is time-consuming. So let's check only the release build on the x86_64
      platform.
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      2f1ae906
    • Yaroslav Lobankov's avatar
      test: update tests according to luatest changes · 0e7e76e6
      Yaroslav Lobankov authored
      All tests were updated according to tarantool/luatest@930b63b. So this
      should resolve the problem with Unix socket collisions that we tried to
      fix, for example, in tarantool/tarantool@7ac2685.
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      0e7e76e6
    • Yaroslav Lobankov's avatar
      test: bump test-run to version w/ updated luatest · e6677b2c
      Yaroslav Lobankov authored
      Bump test-run to new version with the following improvements:
      
      - Properly ignore Unix sockets on artifact saving [1]
      - Bump luatest to 0.5.7-34-g930b63b [2]
      
      [1] tarantool/test-run@3afaccc
      [2] tarantool/test-run@02c4828
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      e6677b2c
    • Yaroslav Lobankov's avatar
      Revert "test: dirty fix for some flaky replication-luatest tests" · e0c451c9
      Yaroslav Lobankov authored
      This reverts commit 7ac2685b.
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      e0c451c9
    • Pavel Semyonov's avatar
      doc: proofread 3.0 changelogs · 210600d1
      Pavel Semyonov authored
      NO_CHANGELOG=changelog
      NO_DOC=changelog
      NO_TEST=changelog
      210600d1
  8. Apr 11, 2023
    • Timur Safin's avatar
      debugger: refactor debugging scenarios · 7314a1bd
      Timur Safin authored
      Refactor the way how we run various debugger scenarios, getting rid
      of external static file, and producing debuggee scripts on the fly.
      The idea is to have everything in the single source: both source
      script to be used for debugging, and corresponding debugger commands.
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      7314a1bd
    • Timur Safin's avatar
      debugger: introduce logging facility · 7a813f43
      Timur Safin authored
      It's frequently needed to see interaction of a luatest script
      and its chield launched via popen.
      Now we display extra debugging information received from
      children pipes directly to the parent screen. It's hidden
      by default by luatest (if everything goes well), but could
      be displayed with `luatest -c` option.
      
      ```
      luatest -c -v app-luatest/console_debugger_session_test.lua
      ```
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      7a813f43
  9. Apr 10, 2023
    • Georgy Moiseev's avatar
      test: disable override checks · 22d7636b
      Georgy Moiseev authored
      NO_DOC=Test update
      NO_CHANGELOG=Test update
      22d7636b
    • Georgy Moiseev's avatar
      lua: bump checks module · a8bc6312
      Georgy Moiseev authored
      Rework "running tests with built-in package" assert since now checks is
      a callable table package with subpackages instead of a single function.
      
      NO_DOC=No tagged version since checks initial embedding
      NO_CHANGELOG=No tagged version since checks initial embedding
      a8bc6312
    • Mergen Imeev's avatar
      sql: fix integer overflow in built-in functions · 60a187d7
      Mergen Imeev authored
      This patch replaces the type for some int and uint32_t values with
      size_t to avoid problems with integer overflow.
      
      Closes tarantool/security#119
      
      NO_DOC=bugfix
      60a187d7
  10. Apr 07, 2023
    • Yaroslav Lobankov's avatar
      test: skip unstable tests of linearizable_test.lua · 442ee729
      Yaroslav Lobankov authored
      Skip unstable tests of `replication-luatest/linearizable_test.lua` due
      to tarantool-qa#277.
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      442ee729
    • Yaroslav Lobankov's avatar
      test: dirty fix for some flaky replication-luatest tests · 7ac2685b
      Yaroslav Lobankov authored
      The fixed tests often failed with
      
        fail | 2023-03-01 15:54:30.550 [3724975] main/103/server_instance.lua
        F> can't initialize storage: unlink, called on fd 63,
        aka unix/:(socket), peer of unix/:(socket): Address already in use
      
      We fixed a similar issue in commit 3d3e9dea ("test: fix flaky
      box-luatest/gh_7917_log_row_on_recovery_error_test") by using unique
      instance names. Let's do the same here.
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      7ac2685b
    • Oleg Chaplashkin's avatar
      test: replace clean() method with drop() of server · efa60df0
      Oleg Chaplashkin authored
      Server API from the luatest has been changed: `server:clean()` method
      has been removed. Use `server:drop()` instead.
      
      Follows up tarantool/luatest#296
      
      NO_DOC=test fix
      NO_TEST=test fix
      NO_CHANGELOG=test fix
      efa60df0
Loading