Skip to content
Snippets Groups Projects
  1. Jan 30, 2023
    • Vladislav Shpilevoy's avatar
      xrow: fix bar new field update crash · d4e92809
      Vladislav Shpilevoy authored
      A tuple update with the first operation creating a new field
      somewhere deep in the tuple and the second operation trying to go
      into that new field could crash. This happened because the route
      branching function xrow_update_route_branch() missed this case.
      
      It can be detected when see that the bar path is already fully
      used (the next JSON token is END), and the new operation's path
      is still not END.
      
      Closes #8216
      
      NO_DOC=bugfix
      d4e92809
    • Vladislav Shpilevoy's avatar
      xrow: fix array new field update crash · eb26e732
      Vladislav Shpilevoy authored
      A tuple update with the first operation creating a new field
      inside an array and the second operation trying to go into that
      field could crash. This happened because the branching function
      xrow_update_op_do_field_##op_type() didn't take into account newly
      set scalar fields and an `unreachable()` was hit.
      
      Part of #8216
      
      NO_DOC=bugfix
      NO_CHANGELOG=next commit
      eb26e732
    • Vladislav Shpilevoy's avatar
      xrow: move xrow_update_err helpers higher · 3260b930
      Vladislav Shpilevoy authored
      They are going to be needed above their declaration prior to this
      patch. Also had to add a couple of obvious comments to calm
      checkpatch down.
      
      Needed for #8216
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      3260b930
    • Alexander Turenko's avatar
      lua: use require() to pull built-in modules · d4e23db3
      Alexander Turenko authored
      It is planned to allow to overload a built-in module by an external one.
      The implementation assumes storing of the built-in modules in a table
      that is different from `package.loaded`. It means that accessing a
      module as `package.loaded[<module_name>]` may fail.
      
      However, we still have a guarantee that a registered module is
      accessible using `require()`. Use it for accessing built-in modules from
      our code.
      
      Notes on different modules:
      
      * `console`
      
        Reorder the print/log callbacks to place the print callback first. If
        something is going very wrong (say, someone removes the internal.print
        module), things will be consistent: both callback will not be set.
      
      * `session`
      
        `box` is accessible as `require('box')` and as `_G.box`. Use the
        latter.
      
      src/lua/serializer.c and src/lua/digest.c also access `package.loaded`
      directly. I left them out of scope here, it requires a bit more in-depth
      look.
      
      Part of #7774
      
      NO_DOC=user visible behavior is unchanged, pure refactoring change
      NO_TEST=see NO_DOC
      NO_CHANGELOG=see NO_DOC
      d4e23db3
    • Alexander Turenko's avatar
      lua: don't tweak package.loaded.compat · 9da53ee5
      Alexander Turenko authored
      The module can't be pulled as `require('compat')`, because it is a
      tarantool specific tuning mechanism, not a general compatibility module.
      The API is exposed as `require('tarantool').compat`.
      
      Before this patch the module was loaded as `package.loaded.compat`,
      captured and then removed from `package.loaded`. However, it would be
      easier to follow if we'll just assign an internal name for the module.
      
      The module is renamed to `internal.compat`. The Lua/C part of the module
      is renamed to `internal.compat.lib`.
      
      Part of #7774
      
      NO_DOC=user visible behavior is unchanged, pure refactoring change
      NO_TEST=see NO_DOC
      NO_CHANGELOG=see NO_DOC
      9da53ee5
    • Alexander Turenko's avatar
      lua: don't use public module name as internal one · c432e9e9
      Alexander Turenko authored
      There are modules that are implemented as two parts: a Lua/C module for
      internal use and a public module written on Lua. There is a practice to
      name both parts the same: just capture the internal part within the
      public part and rewrite `package.loaded` then.
      
      This name overlap is confusing at reading the sources and complicates
      debugging. And it conflicts with a built-in module loading logic that
      will be implemented for #7774.
      
      Let's use `foo.lib` for the internal part and `foo` for the public one.
      This approach is already used in some built-in modules.
      
      src/box/lua/upgrade.lua requires src/box/lua/xlog.lua, so changed the
      loading order.
      
      Eliminated extra `internal` field in `uri.lib`, because the whole module
      is internal.
      
      Part of #7774
      
      NO_DOC=user visible behavior is unchanged, pure refactoring change
      NO_TEST=see NO_DOC
      NO_CHANGELOG=see NO_DOC
      c432e9e9
    • Alexander Turenko's avatar
      box/lua: eliminate luaL_register*() usages in box · 21599ec5
      Alexander Turenko authored
      The idea of the refactoring is described in a previous commit.
      
      The change is straightforward:
      
      * Use `luaL_findtable()` to find/create a nested table in `_G`.
      * Use `luaL_setfuncs()` to assign functions to a table.
      * Use `luaT_newmodule()` to register a module for `require()`.
      
      `require('box.internal.<...>')` calls are replaced with
      `box.internal.<...>`, because `box` submodules are not registered as
      modules anymore (IOW, are not placed into `package.loaded`).
      
      However `_G.box == require('box')`, it remains unchanged.
      
      One may wonder why fourth argument of `luaL_findtable()` (size hint for
      the hash part of the table) is always zero in the added calls. It is an
      effect of the following points:
      
      * Those calls are not on hot paths and, moreover, there is no sense to
        use `luaL_findtable()` with a string literal as the second argument on
        a hot path (no sense to parse the string literal in runtime if a
        performance is the goal).
      * Using `lengthof()` macro would add more code to read for a human (the
        argument itself, a line carry to fit 80 symbols, an inclusion of
        trivia/util.h) at no gain.
      * A hardcoded array length is a developer's stress factor: it looks like
        it requires an update at a change of the array. So zero is better.
      
      Part of #7774
      
      NO_DOC=user visible behavior is unchanged, pure refactoring change
      NO_TEST=see NO_DOC
      NO_CHANGELOG=see NO_DOC
      21599ec5
    • Alexander Turenko's avatar
      lua: eliminate luaL_register*() usages · 2d2ff7e0
      Alexander Turenko authored
      See the previous commit regarding the idea behind this refactoring.
      
      The src/box/lua part is updated in a next commit, only `src/lua` is
      updated here. It is split to ease reading.
      
      The patch is mostly straightforward, I'll highlight several interesting
      places.
      
      * `compat`
      
        `_G.internal.compat` was created by `luaL_register()`. Removing of
        this call drops `_G.internal`: it is not created anymore.
      
      * `fiber.channel` and `fiber.cond`
      
        The initialization code add fields into fiber module. So we call
        `require('fiber')` here.
      
        The alternative is to access `package.loaded.fiber` directly, however
        I plan to eliminate such accesses in further patches. (Built-in
        modules registration process will use its own table instead of
        `package.loaded`.)
      
      * `http.client`
      
        Here we also eliminate a direct access to `package.loaded`, which is
        important for implementing #7774.
      
        Dropping of the `package.loaded['http.client']` field in unnecessary,
        because it is anyway replaced by the resulting module table in
        `tarantool_lua_init()`.
      
      * `utf8`
      
        This module is also set to `_G.utf8` for compatibility with Lua 5.3.
        It remains unchanged.
      
      Part of #7774
      
      NO_DOC=user visible behavior is unchanged, pure refactoring change
      NO_TEST=see NO_DOC
      NO_CHANGELOG=see NO_DOC
      2d2ff7e0
    • Alexander Turenko's avatar
      lua: add built-in module registration function · e3cf5a5d
      Alexander Turenko authored
      This commit starts a series, which refactors built-in module
      registration mechanisms. The series aims several goals:
      
      * Offer a standard tarantool specific way to register a built-in module.
        It allows to change the registration process for all built-in modules
        at once.
      * Make the API of such functions simple and clean.
      * Eliminate known problems of the existing approach to register built-in
        modules.
      
      This particular commit offers the new `luaT_newmodule()` function. It
      replaces `luaL_register()` and `luaL_register_module()` to some extent.
      
      Here I also start a practice to use `luaL_setfuncs()` instead of
      `luaL_register(L, NULL, funcs)` for readability purposes. The function
      is part of Lua 5.2 ([documentation][1]), but it is implemented in
      LuaJIT.
      
      Let's look on examples below.
      
      ## How it works now
      
      First of all, consider the [documentation][2] about the
      `luaL_register()` function. Then look on the examples.
      
      ```c
      luaL_register(L, "foo.bar", funcs);
      ```
      
      Creates a table `package.loaded['foo.bar']` and `_G.foo.bar` (if neither
      of them exists), fill it with the functions and pushes it to the stack.
      
      What is not ok:
      
      * Pollutes `_G`.
      * `package.loaded` is written flat, but `_G` is written deeply.
      * No control over (un)intended module rewritting.
      
      It also worth to note that we can't change this function, because it is
      part of the Lua API. So we need another function for our registration
      process in order to implement #7774.
      
      Another usage of the function makes it even more confusing:
      
      ```c
      luaL_register(L, NULL, funcs);
      ```
      
      Does it create a table, fill it with the functions and push it to the
      stack? No.
      
      Unlike other usages, it fills a table on the top of the stack with the
      functions and leaves it on the stack. And it actually has no relation to
      module registration.
      
      There is tarantool specific function `luaL_register_module()`, which
      looks as an attempt to solve some of the problems.
      
      ```c
      luaL_register_module(L, "foo.bar", funcs);
      ```
      
      It doesn't touch `_G` and, surprisingly, changes how a module is written
      to `package.loaded`.
      
      The call creates a table (or finds it) in `package.loaded.foo.bar`,
      fills it with the functions and pushes to the stack. *This* function
      writes `package.loaded` deeply.
      
      It leaves us with `luaL_register()` for assigning `_G.foo.bar` (with
      pollution of `package.loaded`). It leaves us with `luaL_register()` for
      setting functions into a table on the stack (with confusing name in this
      context and confusing contract). And we has no a function to just assign
      `package.loaded[modname]` without the deep tables creation and with
      appropriate checks.
      
      ## How it will work
      
      ```c
      luaT_newmodule(L, "foo.bar", funcs);
      ```
      
      Create a table, set it to `package.loaded['foo.bar']` and push into the
      stack. Assert that the table doesn't exist.
      
      ```c
      luaL_setfuncs(L, funcs, 0);
      ```
      
      Add functions into a table on top of the stack.
      
      ```c
      luaL_findtable(L, LUA_GLOBALSINDEX, "foo.bar", 0);
      luaL_setfuncs(L, funcs, 0);
      ```
      
      Find/create a table `_G.foo.bar` and add functions to it.
      
      Next commits will adopt built-in modules to follow this practice.
      
      [1]: https://www.lua.org/manual/5.2/manual.html#luaL_setfuncs
      [2]: https://www.lua.org/manual/5.1/manual.html#luaL_register
      
      Part of #7774
      
      NO_DOC=user visible behavior is unchanged, pure refactoring change
      NO_TEST=see NO_DOC
      NO_CHANGELOG=see NO_DOC
      e3cf5a5d
    • Yaroslav Lobankov's avatar
      ci: fix alpine workflows for fork pull requests · a7b9ed4f
      Yaroslav Lobankov authored
      Generate a test build key when the ALPINE_BUILD_KEY secret is empty.
      It is needed for fork PRs where secrets are unavailable.
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      a7b9ed4f
    • Georgiy Lebedev's avatar
      applier: fix isolation level of applied transactions · 7c12d490
      Georgiy Lebedev authored
      Since applied transactions are committed asynchronously, they are
      inherently 'read committed', hence their isolation level should be adjusted
      accordingly.
      
      Closes #8121
      
      NO_DOC=bugfix
      7c12d490
    • Ilya Verbin's avatar
      box: dynamically adjust xlog readahead size · 0479cfaf
      Ilya Verbin authored
      XLOG_READ_AHEAD defines the number of bytes added to the `count' argument
      of the `pread' syscall, currently it equals to 16 KB. However xlog and snap
      files are written by 128 KB chunks of data, which turn into ~80 KB chunks
      after compression (in average, depending on the data), so the 16 KB read-
      ahead doesn't make any sense.
      
      According to performance experiments, 8 MB readahead gives the best results
      for large files. However, 8 MB read buffers would increase memory
      consumption of the replication relays, which usually read small portions of
      data and does not need such a big buffers. For this reason, dynamically-
      sized read buffer is implemented by this patch. The minimal readahead is
      now 128 KB, and the maximal is 8 MB. As a result, the recovery time of a
      900 MB snapshot decreased from 25 sec to 13 sec (when reading from HDD).
      Performance of a recovery from SSD is not affected.
      
      Closes #8108
      
      NO_DOC=performance improvement
      NO_TEST=performance improvement
      0479cfaf
    • Andrey Saranchin's avatar
      box: make ffi select work on M1 · 1b4a81fa
      Andrey Saranchin authored
      Recently, ffi select was broken on M1 in commit ec1a71ff
      ("box: introduce pagination to memtx_tree and tuple position methods").
      It turned out that ffi on M1 poorly supports a big quantity of arguments.
      Fortunately, there is a workaround - we can pass only 64-bit integer
      arguments beyond the 8th argument. Let's do it.
      
      Closes #7946
      
      NO_TEST=reflected in existing tests
      NO_CHANGELOG=bugfix for unreleased feature
      NO_DOC=bugfix
      1b4a81fa
  2. Jan 27, 2023
    • Vladimir Davydov's avatar
      changelog: mark vinyl transaction isolation level support as breaking · 7e86a4c3
      Vladimir Davydov authored
      The transaction isolation level used by Tarantool by default is
      'best-effort' so adding support of transaction isolation levels to Vinyl
      effectively switched the isolation level used by Vinyl transactions from
      'read-committed' to 'best-effort', which potentially may cause more
      conflicts. Let's mention it in the changelog and mark this change as
      breaking.
      
      Follow-up commit 588170a7 ("vinyl: implement transaction isolation
      levels")
      Follow-up #5522
      
      NO_DOC=changelog
      NO_TEST=changelog
      7e86a4c3
  3. Jan 26, 2023
    • Oleg Chaplashkin's avatar
      test: fix the use of `before_all/after_all` hooks · ed136255
      Oleg Chaplashkin authored
      Changed the work with hooks in the part of tests.
      
      Legacy approach:
      
      ```
      g.before_all = function() ... end
      g.after_all = function() ... end
      ```
      
      The logic of executing hooks will be expected and
      more controlled if use following approach:
      
      ```
      g.before_all(function() ... end)
      g.after_all(function() ... end)
      ```
      
      Resolve #8066
      
      NO_DOC=test fix
      NO_TEST=test fix
      NO_CHANGELOG=test fix
      ed136255
    • Ilya Verbin's avatar
      Revert "box: forbid DDL operations until box.schema.upgrade" · 7c72fce9
      Ilya Verbin authored
      This reverts commit 38f88795.
      
      That checking is too tight and may break the code, that is successfully
      working on the non-upgraded schema. Let's postpone the fix to 3.0.
      
      Follow-up #7149
      
      NO_DOC=revert of the unreleased bugfix
      7c72fce9
    • Nikolay Shirokovskiy's avatar
      changelog: don't report dropping fiber_gc as breaking change · 64455ddb
      Nikolay Shirokovskiy authored
      The change can only breaks users that were not follow the documented usage
      pattern. The documented pattern is to allocate and then truncate you
      allocations.
      
      Follow-up #5665
      
      NO_DOC=changelog fix
      NO_TEST=changelog fix
      64455ddb
    • Sergey Vorontsov's avatar
      ci: add workflow to build Alpine packages · 9a11ed4a
      Sergey Vorontsov authored
      Add building Alpine 3.16 packages for amd64 and aarch64.
      
      Part of tarantool/tarantool-qa#266
      
      NO_DOC=ci
      NO_TEST=ci
      9a11ed4a
    • Sergey Vorontsov's avatar
      ci: fix building Alpine packages · 407a4d7f
      Sergey Vorontsov authored
      * Update build-time and run-time dependencies.
      
      * Support build with gc64 enabled.
      
      * Disable sysprof due to the following error while building:
      
      NO_WRAP
        ```
        <...>/third_party/luajit/src/lj_sysprof.c:29:10: fatal error: execinfo.h: No such file or directory
          29 | #include <execinfo.h>
             |
        ```
      NO_WRAP
      
      * Update .pack.mk to set package version in the case of a git tag to the
        following format:
      
          2.11.0[_<release type>]
      
        Where `<release type>` is `alpha1`, `beta1`, `rc1`, etc.
        Note, we have an extra logic when the git tag is `x.x.x-entrypoint`.
        Alpine build system doesn't support package name with such kind of
        version and that's why we use `alpha0` instead of `entrypoint`.
        See for details [1].
      
      * Update .pack.mk to set package version in the other cases to the
        following format:
      
          2.11.0_<release type>_p<N>
      
        Where `<release type>` is `alpha1`, `beta1`, `rc1`, etc and `<N>` is
        the patch number after the latest release. Unfortunately, we cannot
        use the similar version pattern that we use for dev DEB/RPM packages
        (`2.11.0_<release type>.<N>.dev`) because Alpine build system doesn't
        support it. Plus, we have the same logic for `entrypoint` here.
        See for details [1].
      
      [1] https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#pkgver
      
      Part of tarantool/tarantool-qa#266
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      407a4d7f
    • Serge Petrenko's avatar
      test: partially disable election_pre_vote test · 3273a51d
      Serge Petrenko authored
      test_promote_no_quorum testcase in election_pre_vote test started flaky
      hanging after commit 5765fdc4 ("raft: fix 'manual' nodes bumping the
      term excessively").
      
      Disable it until the issue (#8217) is resolved.
      
      In-scope-of #8217
      
      NO_DOC=tests
      NO_CHANGELOG=tests
      3273a51d
    • Pavel Semyonov's avatar
      Cleanup released changelogs · 4d95d1e2
      Pavel Semyonov authored
      Remove issues released in 2.10.* from the master's unreleased list.
      This change leaves only issues that form the diff between the latest
      released version 2.10.4 and the upcoming 2.11-RC (which is the correct
      2.11-RC changelog by definition).
      
      NO_CHANGELOG=changelog
      NO_DOC=changelog
      NO_TEST=changelog
      4d95d1e2
    • Sergey Ostanevich's avatar
      test: fix for gh_6036 test to avoid flakiness · 895cb2d2
      Sergey Ostanevich authored
      Promotion of a leader in the test requires previous leader state
      arrived to all replicas. Inconsistency may lead to promotion failure,
      which is correct from the raft point of view, but not expected by the
      test.
      
      Closes #7785
      
      NO_DOC=test
      NO_CHANGELOG=test
      895cb2d2
  4. Jan 25, 2023
    • Alexander Turenko's avatar
      test: verify net.box on a schema of version 2.1.3 · 5206a447
      Alexander Turenko authored
      See #4691 for the problem description. In brief: before the fix net.box
      expected _vcollation presence if tarantool's runtime on the server is
      new enough disregarding a server's schema version. The old schema
      version has no this view, so net.box was unable to connect. After #4691
      net.box tolerates lack of the view.
      
      The fix was pushed without a test (see [1]) and now I want to pay this
      debt.
      
      [1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-April/016207.html
      
      Follows up #4307
      Follows up #4691
      Fixes #5482
      
      NO_DOC=just a new test
      NO_CHANGELOG=see NO_DOC
      5206a447
    • Ilya Verbin's avatar
      fiber: return always-zero cpu_misses entry to fiber.top() · a52f491d
      Ilya Verbin authored
      It was removed in the commit 390311bb ("fiber: get rid of cpu_misses
      in fiber.top()"). Return it back in order to avoid potential breaking
      changes.
      
      Follow-up #5869
      
      NO_DOC=tarantool/doc#2989
      a52f491d
    • Ilya Verbin's avatar
      changelog: don't mark additional module name in the log as breaking · 077f1f33
      Ilya Verbin authored
      Remove the "breaking change" mark, as it's highly unlikely that it will
      break any log parser.
      
      Follow-up #3211
      
      NO_DOC=changelog
      NO_TEST=changelog
      077f1f33
    • Ilya Verbin's avatar
      changelog: don't mark fiber_set_cancellable deprecation as breaking · f0c69f22
      Ilya Verbin authored
      Remove the "breaking change" mark, as it's highly unlikely that it will
      break anything.
      
      Follow-up #7166
      
      NO_DOC=tarantool/doc#3132
      NO_TEST=changelog
      f0c69f22
    • Nikolay Shirokovskiy's avatar
      box: handle SIGBUS in flightrec · a72d602b
      Nikolay Shirokovskiy authored
      Flight recorder uses mmapped file for performance reasons. Unfortunately
      if for some reason mapping is not possible we got SIGBUS on accessing
      mmapped memory.
      
      We already handle this issue on flight recorder start in [1]. But if we
      got SIGBUS in the meanwhile we currently got a crash. Let's just panic.
      
      [1] https://github.com/tarantool/tarantool-ee/commit/e68b84768f3ae76aa9f03d36dd6f0587b884e1bb
      
      CE Part of https://github.com/tarantool/tarantool-ee/issues/198
      
      NO_DOC=stub for EE part
      NO_CHANGELOG=stub for EE part
      NO_TEST=tested in EE part
      a72d602b
    • Nikolay Shirokovskiy's avatar
      crash: factor out part not belonging to core · b75d1872
      Nikolay Shirokovskiy authored
      Currently crash has code to report crashes to feedback URL. It does
      not belong to core. Also it brings dependencies from box to core with
      INSTANCE_UUID and REPLICASET_UUID variables. So let's move this part
      back to box.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      b75d1872
    • Nikolay Shirokovskiy's avatar
      crash: drop unused nanosecond precision · c457275a
      Nikolay Shirokovskiy authored
      Currently we keep nanoseconds but do not use them and as a result we have
      unneeded scaling. Let's use second precision which is on par with our
      need.
      
      Also drop ns_to_localtime. It can be written much shorter and it feels like
      we don't need distinct function here. Like when we formatting time in
      say.c.
      
      NO_TEST=refactoring
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      c457275a
    • Mikhail Elhimov's avatar
      gdb: add rlist pretty-printer and 'tt-list' command · 83226198
      Mikhail Elhimov authored
      1. Add pretty-printer for 'rlist' type
      Script holds table of possible rlists in tarantool. It recognizes
      automatically actual type of entries and either expression refers to a
      single items or to entire list. Then either single entry is displayed
      (along with its index in the list) or the entire list (entry-by-entry).
      
      2. Add command 'tt-list' that use the mentioned pretty-printer and
         provide additional functionality, namely:
      - walking over the list (both directions)
      - filter entries with predicate
      - allow to explicitly specify list head and actual entry type if
        automatic recognition doesn't work
      See 'help tt-list' for details.
      
      Close #7731
      
      NO_DOC=gdb extension
      NO_CHANGELOG=gdb extension
      NO_TEST=gdb extension
      83226198
    • Serge Petrenko's avatar
      applier: name ballot_watcher fiber properly · de84f430
      Serge Petrenko authored
      Currently all ballot_watcher fibers for different appliers have
      identical names: "applier_ballot_watcher". It's hard to distinguish
      them in logs and to know which ballot_watcher belongs to which applier,
      and that complicates debugging quite a bit.
      
      Let's fix this and name the fibers properly. With master's uri at the
      end.
      
      NO_DOC=no behaviour changed
      NO_CHANGELOG=no behaviour changed
      NO_TEST=doesn't need one
      de84f430
    • Serge Petrenko's avatar
      applier: refactor applier_fiber_new · 15ae96a7
      Serge Petrenko authored
      Add is_joinable parameter to applier_fiber_new. For now all usages of
      the function pass true, but the next commit will create a non-joinable
      applier fiber.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      15ae96a7
    • Mergen Imeev's avatar
      sql: drop unused modules · 2f640bda
      Mergen Imeev authored
      Some of the SQL modules have not been used for a long time. This patch
      drops these modules.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      2f640bda
  5. Jan 24, 2023
    • Serge Petrenko's avatar
      raft: fix 'manual' nodes bumping the term excessively · 5765fdc4
      Serge Petrenko authored
      A node configured in 'manual' mode and promoted by `box.ctl.promote()`
      stays in is_candidate state for the whole term, even though it is not
      is_cfg_candidate.
      
      If such a node is the first one to notice leader death or to hit the
      election timeout, it bumps the term excessively, then immediately
      becomes a mere follower, because its is_candidate is reset with
      is_cfg_candidate.
      
      This extra term bump (one term after the node was actually promoted) is
      unnecessary and might lead to strange errors:
      
      tarantool> box.ctl.promote()
      ---
      - error: 'The term is outdated: old - 3, new - 4'
      ...
      
      Fix this by checking if a node is configured as a candidate before
      trying to start new elections.
      
      Closes #8168
      
      NO_DOC=bugfix
      5765fdc4
    • Serge Petrenko's avatar
      raft: fix an assertion failure in raft_stop_candidate · df6cf5ec
      Serge Petrenko authored
      
      There is a false assertion in raft_stop_candidate(): it assumes that the
      node must always have a running timer whenever it sees the leader.
      This is not true when the node is busy writing the new term on disk.
      
      Cover the mentioned case in the assertion.
      
      Closes #8169
      
      NO_DOC=bugfix
      
      Co-authored-by: default avatarSergey Ostanevich <sergos@tarantool.org>
      df6cf5ec
    • Sergey Bronnikov's avatar
      perf/cmake: add a function for generating perf test targets · ca58d6c9
      Sergey Bronnikov authored
      Commit 2be74a65 ("test/cmake: add a function for generating unit
      test targets") added a function for generating unit test targets in
      CMake. This function makes code simpler and less error-prone.
      
      Proposed patch adds a similar function for generating performance test
      targets in CMake.
      
      NO_CHANGELOG=build infrastructure updated
      NO_DOC=build infrastructure updated
      NO_TEST=build infrastructure updated
      ca58d6c9
    • Sergey Bronnikov's avatar
      test/fuzz: add a function for generating fuzz test targets · d9643bfd
      Sergey Bronnikov authored
      Commit 2be74a65 ("test/cmake: add a function for generating unit
      test targets") added a function for generating unit test targets in
      CMake. This function makes code simpler and less error-prone.
      
      Proposed patch adds a similar function for generating fuzzing test
      targets in CMake.
      
      NO_CHANGELOG=build infrastructure updated
      NO_DOC=build infrastructure updated
      NO_TEST=build infrastructure updated
      d9643bfd
    • Sergey Bronnikov's avatar
      test/cmake: fix building a list of unit tests · 119b0a4a
      Sergey Bronnikov authored
      Commit 2be74a65 ("test/cmake: add a function for generating unit
      test targets") added a function for generating unit test targets in
      CMake. However, due to a wrong scope UNIT_TEST_TARGETS remains empty
      after generating unit tests. Patch fixes that.
      
      NO_CHANGELOG=build infrastructure
      NO_DOC=build infrastructure
      NO_TEST=build infrastructure
      119b0a4a
    • Vladimir Davydov's avatar
      box: move flightrec configuration out of CE repository · e02bc87f
      Vladimir Davydov authored
      We define flight_recorder_cfg struct, box_get_flightrec_cfg function,
      and box.internal.cfg_configure_flightrec Lua function in the CE
      repository although they are actually needed only in the EE repository.
      Let's drop them all from the CE repository and instead define stub
      functions box_check_flightrec and box_set_flightrec that would
      check/apply box.cfg flight recorder parameters.
      
      While we are at it, add missing comments to flightrec function stubs.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      e02bc87f
    • Yaroslav Lobankov's avatar
      ci: use new approach for returning step output · 627f6a26
      Yaroslav Lobankov authored
      The approach
      
        - name: Set output
          run: echo "::set-output name={name}::{value}"
      
      is deprecated [1].
      
      Switching to the new approach:
      
        - name: Set output
          run: echo "{name}={value}" >> $GITHUB_OUTPUT
      
      [1] https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      627f6a26
Loading