Skip to content
Snippets Groups Projects
  1. Jul 15, 2024
    • Vladislav Shpilevoy's avatar
      box: make final join vclock update only in box.cc · fe338ed4
      Vladislav Shpilevoy authored
      The goal is to make sure that no files except box.cc can change
      instance_vclock_storage directly. That leads to all sorts of hacks
      which in turn lead to bugs - #9916 is a good example.
      
      Now applier on final join only sends rows into the journal. The
      journal then is handled by box.cc where vclock is properly
      updated.
      
      Part of #10113
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      fe338ed4
    • Vladislav Shpilevoy's avatar
      journal: extract journal_write_row from limbo · 7d10096c
      Vladislav Shpilevoy authored
      The function writes a single xrow into the journal in a blocking
      way. It isn't so simple, so makes sense to keep as a function,
      especially given that it will be used more in the next commit.
      
      Part of #10113
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      7d10096c
    • Vladislav Shpilevoy's avatar
      box: move recovery_journal creation · 2620eb9e
      Vladislav Shpilevoy authored
      Recovery journal uses word "recovery" to say that it works with
      xlogs. For snapshot recovery there is bootstrap_journal. Lets use
      it during local snapshot recovery.
      
      The reasoning is that while right now there is no difference, in
      next commits the recovery_journal will do more.
      
      Part of #10113
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      2620eb9e
    • Vladislav Shpilevoy's avatar
      box: move replicaset.vclock into instance_vclock · f1e8e4e1
      Vladislav Shpilevoy authored
      Storing vclock of the instance in replicaset.vclock wasn't right.
      It wasn't vclock of the whole replicaset. It was local to this
      instance. There is no such thing as "replicaset vclock".
      
      The patch moves it to box.h/cc.
      
      Part of #10113
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      f1e8e4e1
    • Vladislav Shpilevoy's avatar
      applier: treat register txns like regular ones · 51751f87
      Vladislav Shpilevoy authored
      Applier during the registration waiting (for registering a new ID
      or a name) could keep doing the master txns received before the
      registration was started. They could still be inside WAL doing a
      disk write, when the replica sends a register request.
      
      Before this commit, it could cause an assertion failure in debug
      and a double LSN error in release.
      
      The reason was that during the registration waiting the applier
      treated all incoming txns as "final join" txns. I.e. it wasn't
      checking if those txns were already received, but not committed
      yet.
      
      During normal subscribe process the appliers (potentially
      multiple) protect themselves from that by keeping track of the
      vclocks which are already applied and also being applied right now
      (replicaset.applier.vclock).
      
      Such protection ensures that receiving same row from 2 appliers
      wouldn't result into its double write. It also protects from the
      case when a txn was received, goes to WAL, but then the applier
      reconnects, resubscribes, and gets the same txn again - it
      shouldn't be applied.
      
      The patch makes so that the registration waiting after recovery
      works like subscribe. Registration during recovery would mean
      bootstrap via join. And outside of recovery it means the instance
      is already running.
      
      Closes #9916
      
      NO_DOC=bugfix
      51751f87
    • Nikolay Shirokovskiy's avatar
      lua: shutdown tasks worker fiber · 6e403753
      Nikolay Shirokovskiy authored
      As this fiber is made system in the commit bf620650 ("box: finish
      client fibers on shutdown") we don not need the existing protection from
      cancelling. So first remove it. Now make it managed on shutdown.
      
      Note that we may have issues as we finish this fiber too early. The
      tasks scheduled but not executed at this moment will never be executed.
      So the tasks that be scheduled after fiber is finished. Now when we
      don't use worker fiber for swim gc this will not cause leaks. And
      leaking fd on Tarantool shutdown in fio is not a problem.
      
      Closes #9722
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      6e403753
    • Nikolay Shirokovskiy's avatar
      raft: finish worker fiber on Tarantool shutdown · ab386e65
      Nikolay Shirokovskiy authored
      Let's make sure box raft worker fiber is finished on Tarantool shutdown as
      we are going to free fibers stacks. If fiber is not finished it's stack
      may have references to objects on heap. Thus as fiber stack will be freed
      we will have FP memory leaks under ASAN.
      
      Part of #9722
      
      NO_TEST=rely on existing tests
      NO_CHANGELOG=internal
      NO_DOC=internal
      ab386e65
    • Nikolay Shirokovskiy's avatar
      swim: finish worker fiber on Tarantool shutdown · 1f416452
      Nikolay Shirokovskiy authored
      Let's make sure swim worker fiber is finished on Tarantool shutdown as
      we are going to free fibers stacks. If fiber is not finished it's stack
      may have references to objects on heap. Thus as fiber stack will be freed
      we will have FP memory leaks under ASAN.
      
      Let's make swim gc do not yield using asynchronuos deletion. This way we
      will not use worker fiber for swim deletion. We are going to stop this
      worker fiber before all swim object are collected.
      
      Part of #9722
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      1f416452
    • Nikolay Shirokovskiy's avatar
      net.box: finish worker fiber on Tarantool shutdown · 50ce6ebe
      Nikolay Shirokovskiy authored
      Let's make sure net.box system fiber is finished on Tarantool shutdown as
      we are going to free fibers stacks. If fiber is not finished it's stack
      may have references to objects on heap. Thus as fiber stack will be freed
      we will have FP memory leaks under ASAN.
      
      Part of #9722
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      50ce6ebe
    • Nikolay Shirokovskiy's avatar
      core: introduce managed system fibers · 421b9086
      Nikolay Shirokovskiy authored
      Such fibers are cancelled during Tarantool shutdown the same way as
      cancelled client fibers. This is internal API.
      
      Part of #9722
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      421b9086
    • Nikolay Shirokovskiy's avatar
      core: fiber pool shutdown · e513d4ce
      Nikolay Shirokovskiy authored
      Fiber pool shutdown is finishing all idle fibers. Any message processing
      is finished earlier on client fiber shutdown.
      
      We need some changes in shutdown order to make fiber pool shutdown.
      First we need to move stopping of iproto threads from free to shutdown
      step. The issue is we want to destroy "tx" endpoint which requires all
      pipes connected to it to be destroyed first. There are pipes in iproto
      threads that connected to "tx". Currently we destroy pipes in free step
      and at this point as there is no event loop in tx thread
      `cbus_endpoint_destroy` can't receive notifications that pipes are
      destroyed.
      
      Originally we put stopping of iproto threads to the free step because we
      don't have client fibers shutdown. So it was convenient to have working
      `net_pipe` so that client fibers can use iproto API without adding extra
      logic to them. Now I guess it make sense to stop client fibers before
      iproto shutdown. This is the second change in shutdown order.
      
      There is another reason why we have iproto shutdown before client fiber
      shutdown. In the process of iproto shutdown we close connections first
      and then cancel all requests in progress. This way client do not receive
      unexpected `FiberIsCancelled` errors in the process of server shutdown.
      After the patch it not so. Well we may close connections as an extra
      step before client fibers shutdown. But let's leave it this way.  Good
      clients can subscribe to servere shutdown and prepare for it.  Otherwise
      they may receive `FiberIsCancelled` for theier request which looks
      sensible.
      
      It is also makes sense now to move watcher and client fiber shutdown
      to `box_shutdown` as we can both use watcher and create client fibers
      without starting a box.
      
      While at it also drop a note in code why we shutdown watcher before even
      fiber clients shutdown.
      
      Part of #9722
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      e513d4ce
    • Nikolay Shirokovskiy's avatar
      memtx: shutdown memtx gc fiber · f944953e
      Nikolay Shirokovskiy authored
      As we are going to check for memory leaks in ASAN we need to wait while
      memtx gc finishes freeing tuples of dropped primary index or keys of
      dropped functional indexes.
      
      Part of #9722
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      f944953e
    • Nikolay Shirokovskiy's avatar
      errinj: introduce ERROR_INJECT_YIELD_CANCELLABLE() · 72c53d67
      Nikolay Shirokovskiy authored
      It it same as ERROR_INJECT_YIELD() but if fiber is cancelled it will
      execute given code.
      
      Part of #9722
      
      NO_TEST=internal
      NO_CHANGELOG=internal
      NO_DOC=internal
      72c53d67
    • Vladimir Davydov's avatar
      vinyl: use broadcast instead of signal to notify about dump completion · 30547157
      Vladimir Davydov authored
      There may be more than one fiber waiting on `vy_scheduler::dump_cond`:
      
      ```
      box.snapshot
        vinyl_engine_wait_checkpoint
          vy_scheduler_wait_checkpoint
      
      space.create_index
        vinyl_space_build_index
          vy_scheduler_dump
      ```
      
      To avoid hang, we should use `fiber_cond_broadcast`.
      
      Closes #10233
      
      NO_DOC=bug fix
      30547157
    • Lev Kats's avatar
      small: bump new version with UBSan fixes · 3e183044
      Lev Kats authored
      This patch bumped small to the new version that does not trigger
      UBSan with *_entry* macros and should support new oss-fuzz builder.
      
      New commits:
      
      * rlist: make its methods accept const arguments
      * lsregion: introduce lsregion_to_iovec method
      * rlist: make foreach_enrty_* macros not to use UB
      
      Fixes: #10143
      
      NO_DOC=small submodule bump
      NO_TEST=small submodule bump
      NO_CHANGELOG=small submodule bump
      3e183044
    • Lev Kats's avatar
      trivia: use __builtin* for offsetof macro · 27e94824
      Lev Kats authored
      Changed default tarantool `offsetof` macro implementation so it don't
      access members of null pointer in typeof that triggers UBsan.
      
      Needed for #10143
      
      NO_DOC=bugfix
      NO_CHANGELOG=minor
      NO_TEST=tested manually with fuzzer
      27e94824
  2. Jul 09, 2024
  3. Jul 08, 2024
    • Sergey Kaplun's avatar
      luajit: bump new version · bf01fb20
      Sergey Kaplun authored
      * Correct fix for stack check when recording BC_VARG.
      * test: remove inline suppressions of _TARANTOOL
      * FFI: Fix ffi.alignof() for reference types.
      * FFI: Fix sizeof expression in C parser for reference types.
      * FFI: Allow ffi.metatype() for typedefs with attributes.
      * FFI: Fix ffi.metatype() for non-raw types.
      * Maintain chain invariant in DCE.
      * build: introduce option LUAJIT_ENABLE_TABLE_BUMP
      * ci: add tablebump flavor for exotic builds
      * test: allow `jit.parse` to return aborted traces
      * Handle all types of errors during trace stitching.
      * Use generic trace error for OOM during trace stitching.
      * Check for IR_HREF vs. IR_HREFK aliasing in non-nil store check.
      * cmake: set cmake_minimum_required only once
      * cmake: fix warning about minimum required version
      * ci: add a workflow for testing with AVX512 enabled
      * test: introduce a helper read_file
      * OSX/iOS/ARM64: Fix generation of Mach-O object files.
      * OSX/iOS/ARM64: Fix bytecode embedding in Mach-O object file.
      * build: introduce LUAJIT_USE_UBSAN option
      * ci: enable UBSan for sanitizers testing workflow
      * cmake: add the build directory to the .gitignore
      * Prevent sanitizer warning in snap_restoredata().
      * Avoid negation of signed integers in C that may hold INT*_MIN.
      * Show name of NYI bytecode in -jv and -jdump.
      
      Closes #9924
      Closes #8473
      
      NO_DOC=LuaJIT submodule bump
      NO_TEST=LuaJIT submodule bump
      bf01fb20
    • Nikolay Shirokovskiy's avatar
      fiber: phohibit fiber self join · 1e1bf36d
      Nikolay Shirokovskiy authored
      In this case join will just hang. Instead let's raise an error in case
      of Lua API and panic in case of C API.
      
      Closes #10196
      
      NO_DOC=minor
      1e1bf36d
  4. Jul 04, 2024
    • Nikolay Shirokovskiy's avatar
      fiber: fix leak on dead joinable fiber search · 7db4de75
      Nikolay Shirokovskiy authored
      When fiber is accessed from Lua we create a userdata object and keep the
      reference for future accesses. The reference is cleared when fiber is
      stopped. But if fiber is joinable is still can be found with
      `fiber.find`. In this case we create userdata object again.
      Unfortunately as fiber is already stopped we fail to clear the
      reference. The trigger memory that clear the reference is also leaked.
      As well as fiber storage if it is accessed after fiber is stopped.
      
      Let's add `on_destroy` trigger to fiber and clear the references there.
      
      Note that with current set of LSAN suppressions the trigger memory leak
      of the issue is not reported.
      
      Closes #10187
      
      NO_DOC=bugfix
      7db4de75
  5. Jul 03, 2024
    • Alexander Turenko's avatar
      config: expose experimental.config.utils.schema · ef716a3e
      Alexander Turenko authored
      The module is renamed from `internal.config.utils.schema` to
      `experimental.config.utils.schema` without changes.
      
      It is useful for validation of configuration data in roles and
      applications.
      
      Also, it provides a couple of methods that aim to simplify usual tasks
      around processing of hierarchical configuration data. For example,
      
      * get/set a nested value
      * apply defaults from the schema
      * filter data based on annotations from the schema
      * transform a hierarchical data using a function
      * merge two hierarchical values
      * parse environment variable according to its type in the schema
      
      See https://github.com/tarantool/doc/issues/4279 for an in-depth
      description.
      
      Fixes #10117
      
      NO_DOC=https://github.com/tarantool/doc/issues/4279
      ef716a3e
  6. Jun 26, 2024
    • Nikolay Shirokovskiy's avatar
      box: fix memleak on functional index drop · 319357d5
      Nikolay Shirokovskiy authored
      We just don't free functional index keys on functional index drop now.
      Let's approach keys deletion as in the case of primary index drop ie
      let's drop these keys in background.
      
      We should set `use_hint` to `true` in case of MEMTX_TREE_VTAB_DISABLED
      tree index methods because `memtx_tree_disabled_index_vtab` uses
      `memtx_tree_index_destroy<true>`. Otherwise we get read outside of index
      structure for stub functional index on destroy for introduced `is_func`
      field (which is reported by ASAN).
      
      Closes #10163
      
      NO_DOC=bugfix
      319357d5
  7. Jun 25, 2024
  8. Jun 24, 2024
  9. Jun 21, 2024
    • Vladislav Shpilevoy's avatar
      sio: use kern.ipc.somaxconn for listen() on Mac · 7e9a872f
      Vladislav Shpilevoy authored
      listen() on Mac used to take SOMAXCONN as the backlog size. It is
      just 128, which is too small when connections are incoming too
      fast. They get rejected.
      
      Increase of the queue size wasn't possible, because the limit was
      hardcoded. But now sio takes the runtime limit from
      kern.ipc.somaxconn sysctl setting.
      
      One weird thing is that when set too high, it seems to have no
      effect, like if nothing was changed. Specifically, values above
      32767 are not doing anything, even though stay visible in
      kern.ipc.somaxconn.
      
      It seems listen() on Mac internally might be using 'short' or
      int16_t to store the queue size and it gets broken when anything
      above INT16_MAX is used. The code truncates the queue size to this
      value if the given one is too high.
      
      Closes #8130
      
      NO_DOC=bugfix
      NO_TEST=requires root privileges for testing
      7e9a872f
    • Sergey Kaplun's avatar
      ci: avoid sending perf stat to Influx from forks · d2240bf7
      Sergey Kaplun authored
      This patch is the follow-up for the commit
      49946a72 ("ci: send perf statistics to InfluxDB").
      Since secrets are unavailable for fork repositories, the sending step
      fails due to a missed InfluxDB URL and token. This patch allows to run
      this step only for on push events or PRs from the main repository
      itself.
      
      NO_DOC=CI
      NO_CHANGELOG=CI
      NO_TEST=CI
      d2240bf7
  10. Jun 20, 2024
    • Nikolay Shirokovskiy's avatar
      ci: add workflow to check downgrade versions · 6d856347
      Nikolay Shirokovskiy authored
      Tarantool has hardcoded list of versions it can downgrade to. This list
      should consist of all the released versions less than Tarantool version.
      This workflow helps to make sure we update the list before release.
      
      It is run on pushing release tag to the repo, checks the list and fails
      if it misses some released version less than current. In this case we
      are supposed to update downgrade list (with required downgrade code) and
      update the release tag.
      
      Closes #8319
      
      NO_TEST=ci
      NO_CHANGELOG=ci
      NO_DOC=ci
      6d856347
  11. Jun 18, 2024
    • Sergey Kaplun's avatar
      ci: send perf statistics to InfluxDB · 49946a72
      Sergey Kaplun authored
      This patch adds an additional steps in the <perf_micro.yml> workflow to
      aggregate and send aggregated data to InfluxDB via curl.
      
      Also, this patch adds the corresponding environment variables to be used
      during workflow to preserve the original commit hash and branch name.
      
      NO_DOC=CI
      NO_CHANGELOG=CI
      NO_TEST=CI
      49946a72
    • Sergey Kaplun's avatar
      perf: add aggregator helper for bench statistics · 95257919
      Sergey Kaplun authored
      This patch adds a helper script to aggregate the benchmark results from
      JSON files to the format parsable by the InfluxDB line protocol [1].
      
      All JSON files from the <perf/output> directory are benchmark results
      and aggregated into the <perf/output/summary.txt> file that can be
      posted to the InfluxDB. The results are aggregated via the new target
      test-perf-aggregate, which is run only if some JSON files with results
      are missed.
      
      [1]: https://docs.influxdata.com/influxdb/v2/reference/syntax/line-protocol/
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      95257919
    • Sergey Kaplun's avatar
      perf: move compare.lua to the tools directory · 02690a24
      Sergey Kaplun authored
      This file can be used to compare the results of Lua benchmarks. Since it
      has a general purpose, it is moved to the <perf/tools> directory.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      02690a24
    • Sergey Kaplun's avatar
      perf: save perf results for the benchmarks · 2c60a941
      Sergey Kaplun authored
      This patch saves the output of the performance tests in the JSON format
      to be processed later. The corresponding directory is added to the
      <.gitignore>.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      2c60a941
    • Sergey Kaplun's avatar
      perf: provide items_per_second metric in bps_tree · cd2f4838
      Sergey Kaplun authored
      This patch considers the number of iterations as the number of items
      proceeded by the corresponding benchmark, so it may be used for the
      `items_per_second` counter.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      cd2f4838
    • Sergey Kaplun's avatar
      perf: standardize gh-7089-vclock-copy benchmark · ccb7a649
      Sergey Kaplun authored
      The output now contains items per second without the mean time in
      seconds. The number of iterations is reduced to 40 to avoid running the
      test too long. The `wal_mode` option (default is "none") is set via
      command line flags, as far as the number of nodes (default is 10). Also,
      the master nodes are set up via the `popen()` command without using any
      Makefile.
      
      Also, two new options are introduced:
      * The `--output` option allows you to specify the output file.
      * The `--output_format` option means the format for the printed output.
        The default is "console". It prints items proceeded per second to the
        stdout. The "json" format contains all the information about the
        benchmark in a format similar to Google Benchmark's.
      
      Usually, these options should be used together to dump machine-readable
      results for the benchmarks.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      ccb7a649
    • Sergey Kaplun's avatar
      perf: rename subtests in column_scan · 72dd9324
      Sergey Kaplun authored
      This patch renames subtests in column scan to avoid the usage of `,`
      (the separator) in the tag name for the InfluxDB report.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      72dd9324
    • Sergey Kaplun's avatar
      perf: standardize column_scan benchmark · cd54f50a
      Sergey Kaplun authored
      The output now contains items per second instead of time in seconds.
      
      Also, two new options are introduced:
      * The `--output` option allows you to specify the output file.
      * The `--output_format` option means the format for the printed output.
        The default is "console". It prints rows proceeded per second to the
        stdout. The "json" format contains all the information about the
        benchmark in a format similar to Google Benchmark's.
      
      Usually, these options should be used together to dump machine-readable
      results for the benchmarks.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      cd54f50a
    • Sergey Kaplun's avatar
      perf: standardize box_select benchmark · 7c51884d
      Sergey Kaplun authored
      The output now contains items per second instead of time in nanoseconds.
      
      Also, two new options are introduced:
      * The `--output` option allows you to specify the output file.
      * The `--output_format` option means the format for the printed output.
        The default is "console". It just prints the number of iterations
        proceeded per second to the stdout. The "json" format contains all the
        information about the benchmark in a format similar to Google
        Benchmark's.
      
      Usually, these options should be used together to dump machine-readable
      results for the benchmarks.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      7c51884d
Loading