Skip to content
Snippets Groups Projects
  1. Jun 30, 2022
    • Vladimir Davydov's avatar
      vinyl: disable deferred deletes if there are upserts on disk · a85629a6
      Vladimir Davydov authored
      Normally, there shouldn't be any upserts on disk if the space has
      secondary indexes, because we can't generate an upsert without a lookup
      in the primary index hence we convert upserts to replace+delete in this
      case. The deferred delete optimization only makes sense if the space has
      secondary indexes. So we ignore upserts while generating deferred
      deletes, see vy_write_iterator_deferred_delete.
      
      There's an exception to this rule: a secondary index could be created
      after some upserts were used on the space. In this case, because of the
      deferred delete optimization, we may never generate deletes for some
      tuples for the secondary index, as demonstrated in #3638.
      
      We could fix this issue by properly handle upserts in the write iterator
      while generating deferred delete, but this wouldn't be easy, because in
      case of a minor compaction there may be no replace/insert to apply the
      upsert to so we'd have to keep intermediate upserts even if there is a
      newer delete statement. Since this situation is rare (happens only once
      in a space life time), it doesn't look like we should complicate the
      write iterator to fix it.
      
      Another way to fix it is to force major compaction of the primary index
      after a secondary index is created. This looks doable, but it could slow
      down creation of secondary indexes. Let's instead simply disable the
      deferred delete optimization if the primary index has upsert statements.
      This way the optimization will be enabled sooner or later, when the
      primary index major compaction occurs. After all, it's just an
      optimization and it can be disabled for other reasons (e.g. if the space
      has on_replace triggers).
      
      Closes #3638
      
      NO_DOC=bug fix
      a85629a6
    • Ilya Verbin's avatar
      small: bump new version · 662b92aa
      Ilya Verbin authored
      * doc: add allocators hierarchy diagram
      * build: fix CMake warning
      * small: fix compilation on macOS 12
      
      NO_DOC=small submodule bump
      NO_TEST=small submodule bump
      NO_CHANGELOG=small submodule bump
      662b92aa
    • Ilya Verbin's avatar
      bitset: fix compilation on macOS 12 · a6b76abd
      Ilya Verbin authored
      Asserts are disabled in the Release build, that leads to:
      
      $ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-Werror
      $ make
      
      [ 43%] Building C object src/lib/bitset/CMakeFiles/bitset.dir/bitset.c.o
      src/lib/bitset/bitset.c:169:9: error: variable 'cardinality_check' set but not used [-Werror,-Wunused-but-set-variable]
              size_t cardinality_check = 0;
                     ^
      
      NO_DOC=build fix
      NO_TEST=build fix
      NO_CHANGELOG=build fix
      a6b76abd
  2. Jun 29, 2022
    • Nikolay Shirokovskiy's avatar
      third_party: update nghttp2 from 1.46.0 to 1.47.0 · d06b5f8a
      Nikolay Shirokovskiy authored
      This will fix compilation on recent Archlinux. The issue is this distro
      installs libbpf in base configuration and nghttp2 1.46.0 tries to
      compile eBPF code if this library is present and failed if compiler is
      gcc.
      
      Closes #7292
      
      NO_DOC=nghttp2 submodule bump
      NO_TEST=nghttp2 submodule bump
      d06b5f8a
    • Ilya Verbin's avatar
      fiber: do not disable fiber.top() on ARM · a99ccce5
      Ilya Verbin authored
      Now fiber.top() does not use x86-specific instructions, so it can be
      enabled for ARM.
      
      Closes #4573
      
      NO_TEST=<Tested in test/app/fiber.test.lua>
      NO_DOC=<x86 or ARM are not mentioned in the fiber.top doc>
      a99ccce5
    • Ilya Verbin's avatar
      fiber: get rid of cpu_misses in fiber.top() · 390311bb
      Ilya Verbin authored
      It doesn't make sense after switching from RDTSCP to
      clock_gettime(CLOCK_MONOTONIC).
      
      Part of #5869
      
      @TarantoolBot document
      Title: fiber: get rid of cpu_misses in fiber.top()
      Since: 2.11
      
      Remove any mentions of `cpu_misses` in `fiber.top()` description.
      390311bb
    • Ilya Verbin's avatar
      fiber: use clock_monotonic64 instead of __rdtscp · 2fb7ffc5
      Ilya Verbin authored
      clock_gettime(CLOCK_MONOTONIC) is implemented via the RDTSCP instruction
      on x86 an has the following advantages over the raw instruction:
      
      * It checks for RDTSCP availability in CPUID.
        If RDTSCP is not supported, it switches to RDTSC.
      * Linux guarantee that clock is monotonic, hence, the CPU miss
        detection is not needed.
      * It works on ARM.
      
      As for disadvantage, this function is about 2x slower compared to a
      single RDTSCP instruction. Performance degradation measured by the
      fiber switch benchmark [1] is about 3-7% for num_fibers == 10-1000.
      
      Closes #5869
      
      [1] https://github.com/tarantool/tarantool/issues/2694#issuecomment-546381304
      
      NO_DOC=bugfix
      NO_TEST=<Tested in test/app/fiber.test.lua>
      2fb7ffc5
    • Ilya Verbin's avatar
      fiber: use clock_thread64 instead of clock_gettime · 208b76f3
      Ilya Verbin authored
      Use this wrapper to simplify the code.
      
      Part of #5869
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      208b76f3
    • Ilya Verbin's avatar
      clock: check for clock_gettime return value · fd3eb7e9
      Ilya Verbin authored
      clock_gettime() returns 0 for success, or -1 for failure.
      Add missed checks for the return value.
      
      Part of #5869
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      fd3eb7e9
    • Vladislav Shpilevoy's avatar
      main: free port, random, and memory · 04e59ab1
      Vladislav Shpilevoy authored
      These 3 modules are low hanging fruits which right now can be
      freed at return from main() without any effort.
      
      There are still a lot of other modules whose freeing is not that
      easy. A few hard to untangle knots, and there are more:
      
      - Session, credentials, iproto, and fibers are tied together via
        the latter. Each fiber potentially has a session, its current
        credentials object. Each iproto connection has a session and a
        file descriptor which is stored in the session too.
      
        The possible solution would be to walk all the fibers and
        destroy them before proceeding to destroy everything else.
      
      - Tuples depend on memtx, and Lua depends on tuples. Because there
        are tuples allocated on memtx->arena. Hence destruction of memtx
        and its arena makes the tuples still stored in Lua invalid.
      
        It seems Lua should be destroyed first, not last. It would free
        all the refs which might be kept at objects in C in the other
        modules.
      
      - IProto connections leak when iproto is destroyed. They are not
        freed and their descriptors are not closed properly. That
        requires additional preparatory work to destroy them correctly
        on iproto module deconstruction.
      
      Given amount of work, it should be done as a big separate ticket.
      
      Follow up #7259
      
      NO_CHANGELOG=Not a visible change
      NO_DOC=Not a visible change
      NO_TEST=Not a visible change
      04e59ab1
    • Vladislav Shpilevoy's avatar
      main: destroy main fiber and whole cord on return · ec37c573
      Vladislav Shpilevoy authored
      main() used to skip most of modules destruction in
      tarantool_free(). That got ASAN complaining on clang-13 about a
      leak of a fiber on_stop trigger which was allocated in Lua.
      
      The patch makes fiber_free() called for the main cord. It destroys
      and frees all the fibers together with their on_stop triggers.
      
      Closes #7259
      
      NO_CHANGELOG=Not a visible change
      NO_DOC=Not a visible change
      NO_TEST=Not a visible change
      ec37c573
  3. Jun 28, 2022
    • Nikita Pettik's avatar
      tuple: refactor flags · 9da70207
      Nikita Pettik authored
      Before this patch struct tuple had two boolean bit fields: is_dirty and
      has_uploaded_refs. It is worth mentioning that sizeof(boolean) is
      implementation depended. However, in code it is assumed to be 1 byte
      (there's static assertion restricting the whole struct tuple size by 10
      bytes). So strictly speaking it may lead to the compilation error on
      some non-conventional system. Secondly, bit fields anyway consume at
      least one size of type (i.e. there's no space benefits in using two
      uint8_t bit fields - they anyway occupy 1 byte in total). There are
      several known pitfalls concerning bit fields:
       - Bit field's memory layout is implementation dependent;
       - sizeof() can't be applied to such members;
       - Complier may raise unexpected side effects
         (https://lwn.net/Articles/478657/).
      
      Finally, in our code base as a rule we use explicit masks:
      txn flags, vy stmt flags, sql flags, fiber flags.
      
      So, let's replace bit fields in struct tuple with single member called
      `flags` and several enum values corresponding to masks (to be more
      precise - bit positions in tuple flags).
      
      NO_DOC=<Refactoring>
      NO_CHANGELOG=<Refactoring>
      NO_TEST=<Refactoring>
      9da70207
  4. Jun 27, 2022
    • Timur Safin's avatar
      datetime: fix set with hour=nil · ba140128
      Timur Safin authored
      We did not retain correctly `hour` attribute if modified
      via `:set` method attributes `min`, `sec` or `nsec`.
      
      ```
      tarantool> a = dt.parse '2022-05-05T00:00:00'
      
      tarantool> a:set{min = 0, sec = 0, nsec = 0}
      --
      - 2022-05-05T12:00:00Z
      ...
      ```
      
      Closes #7298
      
      NO_DOC=bugfix
      ba140128
  5. Jun 24, 2022
    • Vladimir Davydov's avatar
      vinyl: rotate active memory index in vy_squash_process if necessary · e797a748
      Vladimir Davydov authored
      If vy_point_lookup called by vy_sauash_process yields (doing disk read),
      a dump may be triggered bumping the L0 generation counter, in which case
      we would insert a statement to a sealed vy_mem, as explained in #5080.
      Let's check the generation counter and rotate the active vy_mem if
      necessary after vy_point_lookup to avoid that.
      
      Closes #5080
      
      NO_DOC=bug fix
      NO_TEST=complicated, need stress/perf test to catch bugs like this
      e797a748
    • Vladimir Davydov's avatar
      vinyl: add vy_lsm_rotate_mem_if_required helper · 415d8b25
      Vladimir Davydov authored
      We often call vy_lsm_rotate_mem_if_required if its generation or schema
      version is older than the current one. Let's add a helper function for
      that.
      
      Needed for #5080
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      415d8b25
    • Vladimir Davydov's avatar
      vinyl: drop UPSERT squashing optimization when there is no disk data · afce0913
      Vladimir Davydov authored
      The optimization is mostly useless, because it only works if there's no
      data on disk. As explained in #5080, it contains a potential bug: if L0
      dump is triggered between 'prepare' and 'commit', it will insert a
      statement to a sealed vy_mem. Let's drop it.
      
      Part of #5080
      
      NO_DOC=bug fix
      NO_CHANGELOG=later
      afce0913
    • Nikita Pettik's avatar
      Fix gh_6634 test case · 47ad3bc9
      Nikita Pettik authored
      gh_6634_different_log_on_tuple_new_and_free_test.lua verifies that
      proper debug message gets into logs for tuple_new() and tuple_delete():
      occasionally tuple_delete() printed wrong tuple address. However, still
      there are two debug logs: one in tuple_delete() and another one in
      memtx_tuple_delete(). So to avoid any possible confusions let's fix
      regular expression to find proper log so that now it definitely finds
      memtx_tuple_delete().
      
      NO_CHANGELOG=<Test fix>
      NO_DOC=<Test fix>
      47ad3bc9
    • Vladimir Davydov's avatar
      net.box: explicitly forbid synchronous requests in triggers · 0d944f90
      Vladimir Davydov authored
      Net.box triggers (on_connect, on_schema_reload) are executed
      by the net.box connection worker fiber so a request issued by
      a trigger callback can't be processed until the trigger returns
      execution to the net.box fiber. Currently, an attempt to issue
      a synchronous request from a net.box trigger leads to a silent
      hang of the connection, which is confusing. Let's instead raise
      an error until #7291 is implemented.
      
      We need to add the check to three places in the code:
       1. luaT_netbox_wait_result for future:wait_result()
       2. luaT_netbox_iterator_next for future:pairs()
       3. conn._request for all synchronous requests.
          (We can't add the check to luaT_netbox_transport_perform_request,
          because conn._request may also call conn.wait_state, which would
          hang if called from on_connect or on_schema_reload trigger.)
      
      We also add an assertion to netbox_request_wait to ensure that we
      never wait for a request completion in the net.box worker fiber.
      
      Closes #5358
      
      @TarantoolBot document
      Title: Synchronous requests are not allowed in net.box triggers
      
      An attempt to issue a synchronous request (e.g. `call`) from
      a net.box trigger (`on_connect`, `on_schema_reload`) now raises
      an error: "Synchronous requests are not allowed in net.box trigger"
      (Before https://github.com/tarantool/tarantool/issues/5358 was
      fixed, it silently hung.)
      
      Invoking an asynchronous request (see `is_async` option) is allowed,
      but the request will not be processed until the trigger returns and
      an attempt to wait for the request completion with `future:pairs()`
      or `future:wait_result()` will raise the same error.
      0d944f90
    • Ilya Verbin's avatar
      raft: get rid of fiber_set_cancellable in box/raft.c · e20e41df
      Ilya Verbin authored
      `wal_write` has been adapted to spurious wakeups, so this protection is
      no longer needed (see 4bf52367).
      
      Part of #7166
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      e20e41df
    • Ilya Verbin's avatar
      txn_limbo: get rid of fiber_set_cancellable in box/txn_limbo.c · e71d5950
      Ilya Verbin authored
      Currently it's possible to wakeup a fiber, which is waiting on
      `limbo->wait_cond`, using Tarantool C API, so the protection
      by `fiber_set_cancellable` doesn't make much sense. This patch
      removes it. Spurious wakeups are already handled correctly.
      
      Part of #7166
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      e71d5950
    • Ilya Verbin's avatar
      core: fix comment in fiber_make_ready · db928477
      Ilya Verbin authored
      Part of #7166
      
      NO_DOC=fix comment
      NO_TEST=fix comment
      NO_CHANGELOG=fix comment
      db928477
  6. Jun 23, 2022
    • Georgiy Lebedev's avatar
      core: return procedure name cache to speed up frame resolving · 39c91ead
      Georgiy Lebedev authored
      Procedure name cache was removed during refactoring in 8ce76364 based
      off the interpretation that libunwind caches procedure names internally —
      turned out it only caches unwinding info, which causes a severe performance
      downgrade (#7207): return it to speed up frame resolving.
      
      Closes #7207
      
      NO_DOC=performance improvement
      NO_TEST=performance improvement
      39c91ead
    • Georgiy Lebedev's avatar
      build: pass necessary compiler flags to libunwind project submodule · bd026399
      Georgiy Lebedev authored
      For the sake of maximizing backtrace collection performance, build
      the libunwind project submodule with "-O2" compiler flag.
      
      Also, build it with the "-g" compiler flag just in case to simplify
      debugging.
      
      Last but not least, pass the same archive-maintaining program used by the
      main CMake project to the libunwind project submodule to make the build
      homogeneous.
      
      Needed for #7207
      
      NO_CHANGELOG=build
      NO_DOC=build
      NO_TEST=build
      bd026399
    • Vladimir Davydov's avatar
      box: fix exclude_null for json and multikey indexes · 30cb5d6e
      Vladimir Davydov authored
      exclude_null is a special index option, which makes the index ignore
      tuples that contain null in any of the indexed fields. Currently, it
      doesn't work for json and multikey indexes, because:
       1. index_filter_tuple ignores json path.
       2. index_filter_tuple ignores multikey index.
      
      Issue no. 1 is easy to fix - we just need to use tuple_field_by_part
      instead of tuple_field when checking if a key field is null.
      
      Issue no. 2 is more complicated, because when we call index_filter_tuple
      we don't know the multikey index. We address this issue by pushing the
      index_filter_tuple call down to engine-specific index implementation.
      
      For Vinyl, we make vy_stmt_foreach_entry, which iterates over multikey
      tuple entries, skip entries that contain nulls.
      
      For memtx, we move the check to index-specific index_replace function
      implementation.  Fortunately, only tree indexes support nullable fields
      so we just need to update the memtx tree implementation.
      
      Ideally, we should handle multikey indexes in memtx at the top level,
      because the implementation should essentially be the same for all kinds
      of indexes, but this refactoring is complicated and will be done later.
      For now, just fix the bug.
      
      Closes #5861
      
      NO_DOC=bug fix
      30cb5d6e
    • Vladimir Davydov's avatar
      test: make all engine/null test cases multi-engine · 7e605b13
      Vladimir Davydov authored
      For some reason, some test cases create memtx spaces irrespective of
      the value of the engine parameter.
      
      NO_DOC=test
      NO_CHANGELOG=test
      7e605b13
  7. Jun 22, 2022
  8. Jun 21, 2022
    • Igor Munkin's avatar
      ci: add workflow for LuaJIT integration tests · 7f595759
      Igor Munkin authored
      
      This patch introduces reusable workflow used by integration testing
      machinery run within tarantool/luajit repository.
      
      For the first attempt GitHub action has been used, but its fetch (or
      more precisely unpack) phase fails due to test/test-run.py symlink into
      test-run submodule (the action being used doesn't fetch it while packing
      tarantool repository). As the alternative for removing this symlink, it
      was decided to use reusable workflows despite its known limitations
      (e.g. inability to use the testing matrix) until the issue with symlink
      is resolved in any possible way.
      
      As an alternate way, a common action to be used in all submodules for
      integration testing can be added to tarantool/actions repository.
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      
      Reviewed-by: default avatarYaroslav Lobankov <y.lobankov@tarantool.org>
      Reviewed-by: default avatarSergey Bronnikov <sergeyb@tarantool.org>
      Signed-off-by: default avatarIgor Munkin <imun@tarantool.org>
      7f595759
    • Vladimir Davydov's avatar
      vinyl: fix !vy_tx_is_in_read_view assertion failure in vy_tx_prepare · 2971f691
      Vladimir Davydov authored
      Commit 4d52199e ("box: fix transaction "read-view" and "conflicted"
      states") updated vy_tx_send_to_read_view so that now it aborts all RW
      transactions right away instead of sending them to read view and
      aborting them on commit. It also updated vy_tx_begin_statement to fail
      if a transaction sent to a read view tries to do DML. With all that,
      we assume that there cannot possibly be an RW transaction sent to read
      view so we have an assertion checking that in vy_tx_commit.
      
      However, this assertion may fail, because a DML statement may yield
      on disk read before it writes anything to the write set. If this is
      the first statement in a transaction, the transaction is technically
      read-only and we will send it to read-view instead of aborting it.
      Once it completes the disk read, it will apply the statement and hence
      become read-write, breaking our assumption in vy_tx_commit.
      
      Fix this by aborting RW transactions sent to read-view in vy_tx_set.
      
      Follow-up #7240
      
      NO_DOC=bug fix
      NO_CHANGELOG=unreleased
      2971f691
  9. Jun 20, 2022
Loading