Skip to content
Snippets Groups Projects
  1. Jul 15, 2024
    • 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
    • Sergey Kaplun's avatar
      perf: standardize uri_escape_unescape benchmark · 0b1ecf66
      Sergey Kaplun authored
      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 amount 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
      0b1ecf66
    • Sergey Kaplun's avatar
      perf: clarify comments in the uri_escape_unescape · b337ff1e
      Sergey Kaplun authored
      This patch rewrites comments regarding JIT compiler options to avoid
      confusion.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      b337ff1e
    • Sergey Kaplun's avatar
      perf: standardize 1mops_write benchmark · a29becf4
      Sergey Kaplun authored
      The (not commented) output now contains average items per second instead
      of peak speed.
      
      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 inserts per second value 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.
      
      The test can still be run standalone to be usable alongside Tarantool's
      repository.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      a29becf4
    • Sergey Kaplun's avatar
      perf: introduce benchmark.lua helper module · 3110ef9a
      Sergey Kaplun authored
      This module helps to aggregate various subbenchmark runs and dump them
      either to stdout or to the specified file. Also, it allows you to output
      results in the JSON format.
      
      Usually, these options should be used together to dump machine-readable
      results for the benchmarks.
      
      Also, set the `LUA_PATH` environment variable for the Lua benchmarks to
      make the introduced module requirable.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      3110ef9a
    • Sergey Kaplun's avatar
      gitignore: add perf/lua/Makefile · 435906db
      Sergey Kaplun authored
      This is a follow-up for the commit
      49d9a874 ("perf: add targets for running
      Lua performance tests"), where the corresponding perf test target is
      introduced.
      
      NO_DOC=perf test
      NO_CHANGELOG=perf test
      NO_TEST=perf test
      435906db
    • Alexander Turenko's avatar
      config: use vshard-ee if available · 29519c71
      Alexander Turenko authored
      The new closed-source `vshard-ee` module was recently introduced. It is
      based on the open-source `vshard` module and, as far as I know, provides
      the same API.
      
      Let's configure `vshard-ee` in the same way as `vshard` if sharding is
      enabled in tarantool's configuration.
      
      Prefer `vshard-ee` if both are available.
      
      Fixes https://github.com/tarantool/tarantool-ee/issues/815
      
      @TarantoolBot document
      Title: config: vshard-ee is now supported
      
      The declarative configuration supports `vshard-ee` in addition to
      `vshard` since Tarantool 3.1.1 and 3.2+.
      
      `vshard` is mentioned in the documentation at least [here][1]. All such
      places should be updated to mention both `vshard-ee` and `vshard`.
      
      [1]: https://www.tarantool.io/en/doc/latest/reference/configuration/configuration_reference/#sharding
      29519c71
    • Alexander Turenko's avatar
      loaders: add require_first function (internal) · 3abd4f96
      Alexander Turenko authored
      Usage example:
      
      ```lua
      local loaders = require('internal.loaders')
      local vshard = loaders.require_first('vshard-ee', 'vshard')
      ```
      
      The function is for internal use.
      
      It would be nice to have something of this kind in the public API, but
      I'm not going to solve it within this patch.
      
      Needed for https://github.com/tarantool/tarantool-ee/issues/815
      
      NO_DOC=no public API changes
      NO_CHANGELOG=see NO_DOC
      3abd4f96
  12. Jun 17, 2024
    • DerekBum's avatar
      box: feature `tuple:format` to get a format of a tuple · 6d5f1db5
      DerekBum authored
      This patch adds `tuple:format()` method to get a format
      of a tuple.
      
      Closes #10005
      
      @TarantoolBot document
      Title: New `format` method for `box.tuple`
      Product: Tarantool
      Since: 3.2
      
      The `tuple:format` method returns a format of a tuple.
      6d5f1db5
    • Sergey Bronnikov's avatar
      test/fuzz: speedup string serialization · 3d97334f
      Sergey Bronnikov authored
      - clamp before cleaning string because cleaning is not cheap
        (O(n), where max n is equal to kMaxStrLength)
      - call cleaning for identifiers only, there is no sense to
        cleaning string literals
      - replace symbols disallowed by Lua grammar in indentifier's
        names with '_'
      
      The patch saves 16 sec on 145k samples (401 sec before the patch
      and 385 sec after the patch). It is actually not so much, but it
      is about 2.5 min per hour.
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      3d97334f
  13. Jun 14, 2024
  14. Jun 13, 2024
    • Nikolay Shirokovskiy's avatar
      ci: add a workflow to check for entrypoint tags · c06d0d14
      Nikolay Shirokovskiy authored
      Check check-entrypoint.sh comment for explanation of what entrypoint tag
      is. The workflow fails if current branch does not have a most recent
      entrypoint tag that it should have.
      
      Part of #8319
      
      NO_TEST=ci
      NO_CHANGELOG=ci
      NO_DOC=ci
      c06d0d14
    • Vladimir Davydov's avatar
      vinyl: fix gc vs vylog race leading to duplicate record · 9d3859b2
      Vladimir Davydov authored
      Vinyl run files aren't always deleted immediately after compaction,
      because we need to keep run files corresponding to checkpoints for
      backups. Such run files are deleted by the garbage collection procedure,
      which performs the following steps:
      
       1. Loads information about all run files from the last vylog file.
       2. For each loaded run record that is marked as dropped:
          a. Tries to remove the run files.
          b. On success, writes a "forget" record for the dropped run,
             which will make vylog purge the run record on the next
             vylog rotation (checkpoint).
      
      (see `vinyl_engine_collect_garbage()`)
      
      The garbage collection procedure writes the "forget" records
      asynchronously using `vy_log_tx_try_commit()`, see `vy_gc_run()`.
      This procedure can be successfully executed during vylog rotation,
      because it doesn't take the vylog latch. It simply appends records
      to a memory buffer which is flushed either on the next synchronous
      vylog write or vylog recovery.
      
      The problem is that the garbage collection isn't necessarily loads
      the latest vylog file because the vylog file may be rotated between
      it calls `vy_log_signature()` and `vy_recovery_new()`. This may
      result in a "forget" record written twice to the same vylog file
      for the same run file, as follows:
      
        1. GC loads last vylog N
        2. GC starts removing dropped run files.
        3. CHECKPOINT starts vylog rotation.
        4. CHECKPOINT loads vylog N.
        5. GC writes a "forget" record for run A to the buffer.
        6. GC is completed.
        7. GC is restarted.
        8. GC finds that the last vylog is N and blocks on the vylog latch
           trying to load it.
        9. CHECKPOINT saves vylog M (M > N).
       10. GC loads vylog N. This triggers flushing the forget record for
           run A to vylog M (not to vylog N), because vylog M is the last
           vylog at this point of time.
       11. GC starts removing dropped run files.
       12. GC writes a "forget" record for run A to the buffer again,
           because in vylog N it's still marked as dropped and not forgotten.
           (The previous "forget" record was written to vylog M).
       13. Now we have two "forget" records for run A in vylog M.
      
      Such duplicate run records aren't tolerated by the vylog recovery
      procedure, resulting in a permanent error on the next checkpoint:
      
      ```
      ER_INVALID_VYLOG_FILE: Invalid VYLOG file: Run XXXX forgotten but not registered
      ```
      
      To fix this issue, we move `vy_log_signature()` under the vylog latch
      to `vy_recovery_new()`. This makes sure that GC will see vylog records
      that it's written during the previous execution.
      
      Catching this race in a function test would require a bunch of ugly
      error injections so let's assume that it'll be tested by fuzzing.
      
      Closes #10128
      
      NO_DOC=bug fix
      NO_TEST=tested manually with fuzzer
      9d3859b2
    • Vladimir Davydov's avatar
      tuple: don't use offset_slot_cache in vinyl threads · 19d1f1cc
      Vladimir Davydov authored
      `key_part::offset_slot_cache` and `key_part::format_epoch` are used for
      speeding up tuple field lookup in `tuple_field_raw_by_part()`. These
      structure members are accessed and updated without any locks, assuming
      this code is executed exclusively in the tx thread. However, this isn't
      necessarily true because we also perform tuple field lookups in vinyl
      read threads. Apparently, this can result in unexpected races and bugs,
      for example:
      
      ```
        #1  0x590be9f7eb6d in crash_collect+256
        #2  0x590be9f7f5a9 in crash_signal_cb+100
        #3  0x72b111642520 in __sigaction+80
        #4  0x590bea385e3c in load_u32+35
        #5  0x590bea231eba in field_map_get_offset+46
        #6  0x590bea23242a in tuple_field_raw_by_path+417
        #7  0x590bea23282b in tuple_field_raw_by_part+203
        #8  0x590bea23288c in tuple_field_by_part+91
        #9  0x590bea24cd2d in unsigned long tuple_hint<(field_type)5, false, false>(tuple*, key_def*)+103
        #10 0x590be9d4fba3 in tuple_hint+40
        #11 0x590be9d50acf in vy_stmt_hint+178
        #12 0x590be9d53531 in vy_page_stmt+168
        #13 0x590be9d535ea in vy_page_find_key+142
        #14 0x590be9d545e6 in vy_page_read_cb+210
        #15 0x590be9f94ef0 in cbus_call_perform+44
        #16 0x590be9f94eae in cmsg_deliver+52
        #17 0x590be9f9583e in cbus_process+100
        #18 0x590be9f958a5 in cbus_loop+28
        #19 0x590be9d512da in vy_run_reader_f+381
        #20 0x590be9cb4147 in fiber_cxx_invoke(int (*)(__va_list_tag*), __va_list_tag*)+34
        #21 0x590be9f8b697 in fiber_loop+219
        #22 0x590bea374bb6 in coro_init+120
      ```
      
      Fix this by skipping this optimization for threads other than tx.
      
      No test is added because reproducing this race is tricky. Ideally, bugs
      like this one should be caught by fuzzing tests or thread sanitizers.
      
      Closes #10123
      
      NO_DOC=bug fix
      NO_TEST=tested manually with fuzzer
      19d1f1cc
Loading