Skip to content
Snippets Groups Projects
  1. Jul 11, 2022
    • Ilya Verbin's avatar
      core: get rid of fiber_set_cancellable in latch.h · 5404abaa
      Ilya Verbin authored
      fiber_wakeup has been adapted to spurious wakeups, so this protection
      is no longer needed.
      
      Part of #7166
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      5404abaa
    • Ilya Verbin's avatar
      core: fix potential misorder of latch waiters · 294e8379
      Ilya Verbin authored
      Currently the latch doesn't guarantee the order in which it is acquired
      by fibers, which requested it. E.g. it is possible to wake up spuriously
      a fiber which is yielding in the latch_lock, it will be removed from
      l->queue by fiber_make_ready, then it will be inserted to l->queue
      again, but for this time, to the head of the list instead of its
      original place in the queue.
      
      Fix this by using latch_waiter structure, which is linked into l->queue.
      
      Part of #7166
      
      @TarantoolBot document
      Title: Update box_latch_lock description
      Since: 2.11
      
      Add "Locks are acquired in the strict order as they were requested." to
      the box_latch_lock description in C API reference - Module latch.
      294e8379
  2. Jul 08, 2022
    • Yaroslav Lobankov's avatar
      build: fix error on FreeBSD 13.1 · 15b823f0
      Yaroslav Lobankov authored
      This patch fixes the following error while tarantool build on
      FreeBSD 13.1:
      
          [100%] Linking CXX executable watcher.test
          ld: error: undefined symbol: set_sigint_cb
          >>> referenced by console.c:261 (lua/console.c:261)
          >>>               console.c.o:(lbox_console_readline) in
                              archive ../../src/box/libbox.a
          >>> referenced by console.c:342 (lua/console.c:342)
          >>>               console.c.o:(lbox_console_readline) in
                              archive ../../src/box/libbox.a
          >>> referenced by console.c:352 (lua/console.c:352)
          >>>               console.c.o:(lbox_console_readline) in
                              archive ../../src/box/libbox.a
          >>> referenced 1 more times
          c++: error: linker command failed with exit code 1
              (use -v to see invocation)
          gmake[2]: *** [test/unit/CMakeFiles/watcher.test.dir/build.make:152:
              test/unit/watcher.test] Error 1
          gmake[1]: *** [CMakeFiles/Makefile2:10528:
              test/unit/CMakeFiles/watcher.test.dir/all] Error 2
          gmake: *** [Makefile:156: all] Error 2
      
      NO_DOC=minor changes
      NO_TEST=minor changes
      NO_CHANGELOG=minor changes
      15b823f0
    • Vladimir Davydov's avatar
      test: fix cleanup in vinyl-luatest/gh_6565_hot_standby_unsupported test · 6213907c
      Vladimir Davydov authored
      The gh_6565 test doesn't stop the hot standby replica it started,
      because the replica should fail to initialize and exit eventually
      anyway. However, if the replica lingers until the next test due to
      https://github.com/tarantool/test-run/issues/345, the next test may
      successfully connect to it, which is likely to lead to a failure,
      because UNIX socket paths used by luatest servers are not randomized.
      
      For example, here gh_6568 test fails after gh_6565, because it uses the
      same alias for the test instance ('replica'):
      
      NO_WRAP
      [008] vinyl-luatest/gh_6565_hot_standby_unsupported_>                 [ pass ]
      [008] vinyl-luatest/gh_6568_replica_initial_join_rem>                 [ fail ]
      [008] Test failed! Output from reject file /tmp/t/rejects/vinyl-luatest/gh_6568_replica_initial_join_removal_of_compacted_run_files.reject:
      [008] TAP version 13
      [008] 1..1
      [008] # Started on Fri Jul  8 15:30:47 2022
      [008] # Starting group: gh-6568-replica-initial-join-removal-of-compacted-run-files
      [008] not ok 1  gh-6568-replica-initial-join-removal-of-compacted-run-files.test_replication_compaction_cleanup
      [008] #   builtin/fio.lua:242: fio.pathjoin(): undefined path part 1
      [008] #   stack traceback:
      [008] #         builtin/fio.lua:242: in function 'pathjoin'
      [008] #         ...ica_initial_join_removal_of_compacted_run_files_test.lua:43: in function 'gh-6568-replica-initial-join-removal-of-compacted-run-files.test_replication_compaction_cleanup'
      [008] #         ...
      [008] #         [C]: in function 'xpcall'
      [008] replica | 2022-07-08 15:30:48.311 [832856] main/103/default.lua F> can't initialize storage: unlink, called on fd 30, aka unix/:(socket), peer of unix/:(socket): Address already in use
      [008] # Ran 1 tests in 0.722 seconds, 0 succeeded, 1 errored
      NO_WRAP
      
      Let's fix this by explicitly killing the hot standby replica. Since it
      could have exited voluntarily, we need to use pcall, because server.stop
      fails if the instance is already dead.
      
      This issue is similar to the one fixed by commit 85040161 ("test:
      stop server started by vinyl-luatest/update_optimize test").
      
      NO_DOC=test
      NO_CHANGELOG=test
      6213907c
    • Nikolay Shirokovskiy's avatar
      http_parser: fix parsing HTTP protocol version · 9ee7e568
      Nikolay Shirokovskiy authored
      Handle status header response like 'HTTP/2 200' with version without
      dot.
      
      Closes #7319
      
      NO_DOC=bugfix
      9ee7e568
    • Nikolay Shirokovskiy's avatar
      http_parser: add const to input data arguments · 9f2b015b
      Nikolay Shirokovskiy authored
      Parser does not change its input data on parsing and it's caller as well.
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      NO_TEST=refactoring
      9f2b015b
    • Nikolay Shirokovskiy's avatar
      box: fix unexpected error on granting privileges to admin · aaf6f8e9
      Nikolay Shirokovskiy authored
      We use LuaJIT 'bit' module for bitwise operations. Due to platform
      interoperability it truncates arguments to 32bit and returns signed
      result. Thus on granting rights using bit.bor to admin user which
      have 0xffffffff rights (from bootstrap snapshot) we get -1 as a result.
      This leads to type check error given in issue later in execution.
      
      Closes #7226
      
      NO_DOC=minor bugfix
      aaf6f8e9
    • Yaroslav Lobankov's avatar
      ci: add missing deps to make targets for OSX · 9c87898e
      Yaroslav Lobankov authored
      This patch fixes the following error on OSX systems:
      
          autoreconf: error: aclocal failed with exit status: 2
          make[3]: *** [build/curl/work/stamp/bundled-libcurl-project-configure]
              Error 2
          make[2]: *** [CMakeFiles/bundled-libcurl-project.dir/all] Error 2
          make[2]: *** Waiting for unfinished jobs....
      
      To resolve this issue we need to install the `autoconf`, `automake`,
      and `libtool` packages before tarantool build.
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      9c87898e
    • Yaroslav Lobankov's avatar
      ci: add missing 'libtool' package dependency · cb29314d
      Yaroslav Lobankov authored
      Installing the `autoconf` and `automake` packages is not enough.
      We need to install the `libtool` package as well to avoid errors
      like this:
      
        configure:7323: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
          If this token and others are legitimate, please use
          m4_pattern_allow.
          See the Autoconf documentation.
        configure:7324: error: possibly undefined macro: AC_PROG_LIBTOOL
        autoreconf: /usr/bin/autoconf failed with exit status: 1
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      cb29314d
    • Yaroslav Lobankov's avatar
      ci: fix deps installation for FreeBSD systems · 7d7b56bb
      Yaroslav Lobankov authored
      The issue was in the `deps_freebsd` target that installed test-run deps
      (py38-yaml, py38-six, py38-gevent) via the `pkg` package manager.
      
      At some moment these packages were upgraded to 39 version on the mirrors
      and became not available for installation anymore.
      
      Now test-run deps are installed via `pip` package installer to avoid
      such issues in the future. Installation via `pip` is more robust because
      we have deps versions pinned in test-run and also we have python version
      pinned to 3.8.
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      7d7b56bb
    • Vladimir Davydov's avatar
      memtx: introduce flag for temporary tuples · 2fec0760
      Vladimir Davydov authored
      Passing format->is_temporary to MemtxAllocator::free_tuple complicates
      the allocator API and the code using it. Let's introduce a per tuple
      flag for such tuples.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      2fec0760
    • Vladimir Davydov's avatar
      memtx: enter delayed free mode once when snapshot starts · 5315bca6
      Vladimir Davydov authored
      Currently, we call memtx_enter_delayed_free_mode() per each index,
      in index::create_snapshot_iterator(), but there's actually no need to
      bump the snapshot_version more than once per snapshot. Let's move it
      to the place where we start checkpoint/join and drop memtx wrappers
      around memtx_allocators functions.
      
      This will simplify reworking the memtx read view API, see #7364.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      5315bca6
    • Vladimir Davydov's avatar
      memtx: move allocator stuff from memtx_engine to MemtxAllocator · c7e3eae9
      Vladimir Davydov authored
      Let's hide all the logic regarding delayed freeing of memtx tuples to
      MemtxAllocator and provide memtx_engine with methods for allocating and
      freeing tuples (not memtx_tuples, just generic tuples). All the tuple
      and snapshot version manipulation stuff is now done entirely in
      MemtxAllocator.
      
      This is a preparation for implementing a general-purpose tuple read view
      API in MemtxAllocator, see #7364.
      
      Note, since memtx_engine now deals with the size of a regular tuple,
      which is 4 bytes less than the size of memtx_tuple, this changes the
      size reported by OOM messages and the meaning of memtx_max_tuple_size,
      which now limits the size of a tuple, not memtx_tuple.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      c7e3eae9
    • Vladimir Davydov's avatar
      memtx: do not use MemtxAllocator name spec when not necessary · 5e50a204
      Vladimir Davydov authored
      It isn't necessary to prefix all static class members with the class
      name specifier in the class methods.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      5e50a204
    • Sergey Bronnikov's avatar
      third_party: update libcurl from 7.83.0 to 7.84.0 · 5226027e
      Sergey Bronnikov authored
      Changelog: https://curl.se/changes.html#7_84_0
      
      New release contains fixes for 4 security problems [1].
      
      Patch adds a new option defined in curl build infrastructure with it's
      default value used in 7.84.0. NOTE: PSL is a Public Suffix List (PSL),
      it is a list of suffixes used for cookies.
      
      1. https://curl.se/docs/releases.html
      
      NO_DOC=libcurl submodule bump
      NO_TEST=libcurl submodule bump
      5226027e
    • Mergen Imeev's avatar
      sql: fix error in ORDER BY ephemeral space format · 64cdb80c
      Mergen Imeev authored
      This patch fixes a bug where the ANY field type was replaced by the
      SCALAR field type in the ephemeral space used in ORDER BY.
      
      Closes #7345
      
      NO_DOC=bugfix
      64cdb80c
    • Mergen Imeev's avatar
      sql: ariphmetic of unsigned values · 3715f632
      Mergen Imeev authored
      After this patch, the result type of arithmetic between two unsigned
      values will be INTEGER.
      
      Closes #7295
      
      NO_DOC=bugfix
      3715f632
  3. Jul 07, 2022
    • Yaroslav Lobankov's avatar
      ci: add autoconf and automake deps to make targets · 3dd483d1
      Yaroslav Lobankov authored
      This patch fixes the following error:
      
          [ 35%] Performing configure step for 'bundled-libcurl-project'
          *** Do not use buildconf. Instead, just use: autoreconf -fi
          ./buildconf: 8: exec: autoreconf: not found
      
      To resolve this issue we need to install the `autoconf` and `automake`
      packages before building.
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      3dd483d1
    • Ilya Verbin's avatar
      coio: do exec after fork in unit/coio.test · 8b5bcd92
      Ilya Verbin authored
      This makes the test more real-life, and allows not to bother in the
      child process with the memory allocated prior to fork.
      
      Closes #7370
      
      NO_DOC=test fix
      NO_CHANGELOG=test fix
      8b5bcd92
    • Ilya Verbin's avatar
      coio: fix memory leak in coio_connect_timeout · 7eb7e1ba
      Ilya Verbin authored
      coio_fill_addrinfo allocates ai_local->ai_addr, which should be freed
      in case of error.
      
      Part of #7370
      
      NO_DOC=bugfix
      NO_TEST=memory leak
      NO_CHANGELOG=minor bug
      7eb7e1ba
    • Igor Munkin's avatar
      test: remove tests from fragile list · c245e201
      Igor Munkin authored
      Since "x64/LJ_GC64: Fix fallback case of asm_fuseloadk64()."
      (42853793ec3e6e36bc0f7dff9d483d64ba0d8d28) is backported into
      tarantool/luajit trunk, box/bitset.test.lua and box/function1.test.lua
      tests are no more fragile.
      
      Follows up tarantool/tarantool-qa#234
      Follows up tarantool/tarantool-qa#235
      
      NO_DOC=test changes
      NO_CHANGELOG=test changes
      NO_TEST=test changes
      c245e201
  4. Jul 06, 2022
    • Yaroslav Lobankov's avatar
      test: fix box-py/args.test.py · 11166382
      Yaroslav Lobankov authored
      This patch fixes `box-py/args.test.py` test and allows it to work
      against tarantool installed from a package.
      
      Closes tarantool/tarantool-qa#246
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      11166382
    • Yaroslav Lobankov's avatar
      test: fix app-tap/tarantoolctl.test.lua · 91143500
      Yaroslav Lobankov authored
      This patch fixes `app-tap/tarantoolctl.test.lua` test and allows it to
      work against tarantool installed from a package.
      
      Part of tarantool/tarantool-qa#246
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      91143500
    • Yaroslav Lobankov's avatar
      test: fix gh-1700-abort-recording-on-fiber-switch.test.lua · d6a6fc23
      Yaroslav Lobankov authored
      This patch fixes `gh-1700-abort-recording-on-fiber-switch.test.lua` test
      and allows it to work against tarantool installed from a package.
      
      Part of tarantool/tarantool-qa#246
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      d6a6fc23
    • Yaroslav Lobankov's avatar
      test: add new `make` test targets · 9adedc1f
      Yaroslav Lobankov authored
      This patch adds the new `make` test targets to run unit and functional
      tests independending on each other. In some cases it can be useful.
      
      New test targets:
      
      * `test-unit` - run unit tests and exit after the first failure
      * `test-unit-force` - run unit tests
      * `test-func` - run functional tests and exit after the first failure
      * `test-func-force` - run functional tests
      
      Note, tests for 'small' lib are considered as unit tests as well.
      
      Part of tarantool/tarantool-qa#246
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      9adedc1f
    • Yaroslav Lobankov's avatar
      ci: install test-run deps via pip instead of apt · a81eacd7
      Yaroslav Lobankov authored
      This patch fixes the following issue:
      
          Installing collected packages: greenlet, gevent
            Attempting uninstall: greenlet
              Found existing installation: greenlet 0.4.15
          ERROR: Cannot uninstall 'greenlet'. It is a distutils installed
              project and thus we cannot accurately determine which files
              belong to it which would lead to only a partial uninstall.
          make: *** [.travis.mk:86: deps_tests] Error 1
          Error: Process completed with exit code 2.
      
      This happens because the `python3-gevent` package is installed via the
      `apt` package manager in some test targets. Let's install test-run deps
      via `pip` everywhere.
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      a81eacd7
    • Nikolay Shirokovskiy's avatar
      test: use default readline configuration for a test · 1cd1a2df
      Nikolay Shirokovskiy authored
      If readline 'show-mode-in-prompt' is on then test fails because it does
      not handle prefix added to prompt in this mode. Let's use default
      (compiled in) readline configuration instead of the one provided by
      user or system config.
      
      NO_DOC=test changes
      NO_CHANGELOG=test changes
      NO_TEST=test changes
      1cd1a2df
    • Georgiy Lebedev's avatar
      memtx: fix story delete statement list · 654cf498
      Georgiy Lebedev authored
      Current implementation of tracking statements that delete a story has a
      flaw, consider the following example:
      
      tx1('box.space.s:replace{0, 0}') -- statement 1
      
      tx2('box.space.s:replace{0, 1}') -- statement 2
      tx2('box.space.s:delete{0}') -- statement 3
      tx2('box.space.s:replace{0, 2}') -- statement 4
      
      When statement 1 is prepared, both statements 2 and 4 will be linked to the
      delete statement list of {0, 0}'s story, though, apparently, statement 4
      does not delete {0, 0}.
      
      Let us notice the following: statement 4 is "pure" in the sense that, in
      the transaction's scope, it is guaranteed not to replace any tuple — we
      can retrieve this information when we check where the insert statement
      violates replacement rules, use it to determine "pure" insert statements,
      and skip them later on when, during preparation of insert statements, we
      handle other insert statements which assume they do not replace anything
      (i.e., have no visible old tuple).
      
      On the contrary, statements 1 and 2 are "dirty": they assume that they
      replaced nothing (i.e., there was no visible tuple in the index) — when one
      of them gets prepared — the other one needs to be either aborted or
      relinked to replace the prepared tuple.
      
      We also need to fix relinking of delete statements from the older story
      (in terms of the history chain) to the new one during preparation of insert
      statements: a statement needs to be relinked iff it comes from a different
      transaction (to be precise, there must, actually, be no more than one
      delete statement from the same transaction).
      
      Additionally, add assertions to verify the invariant that the story's
      add (delete) psn is equal to the psn of the add (delete) statement's
      transaction psn.
      
      Closes #7214
      Closes #7217
      
      NO_DOC=bugfix
      654cf498
  5. Jul 05, 2022
    • Vladimir Davydov's avatar
      test: stop server started by vinyl-luatest/update_optimize test · 85040161
      Vladimir Davydov authored
      Normally, if a server created by a test isn't stopped it should be
      forcefully killed by luatest or test-run. For some reason, it doesn't
      happen sometimes, which may lead to the next test failing to bind,
      because all test servers that belong to the same luatest suite and have
      the same alias share the same socket path (although they use different
      directories). This looks like a test-run or luatest bug.
      
      The vinyl-luatest/update_optimize test doesn't stop the test server
      so because of this test-run/luatest bug, the next vinyl-luatest test
      fails occasionally:
      
      NO_WRAP
      [001] vinyl-luatest/update_optimize_test.lua                          [ pass ]
      [001] vinyl-luatest/gh_6568_replica_initial_join_rem>                 [ fail ]
      [001] Test failed! Output from reject file /tmp/t/rejects/vinyl-luatest/gh_6568_replica_initial_join_removal_of_compacted_run_files.reject:
      [001] TAP version 13
      [001] 1..1
      [001] # Started on Tue Jul  5 13:30:37 2022
      [001] # Starting group: gh-6568-replica-initial-join-removal-of-compacted-run-files
      [001] master | 2022-07-05 13:30:37.530 [189564] main/103/default.lua F> can't initialize storage: unlink, called on fd 25, aka unix/:(socket), peer of unix/:(socket): Address already in use
      [001] ok     1  gh-6568-replica-initial-join-removal-of-compacted-run-files.test_replication_compaction_cleanup
      [001] not ok 1  gh-6568-replica-initial-join-removal-of-compacted-run-files.test_replication_compaction_cleanup
      [001] #   Failure in after_all hook: /home/vlad/.rocks/share/tarantool/luatest/process.lua:100: kill failed: 256
      [001] #   stack traceback:
      [001] #         .../src/tarantool/tarantool/test/luatest_helpers/server.lua:206: in function 'stop'
      [001] #         ...src/tarantool/tarantool/test/luatest_helpers/cluster.lua:44: in function 'drop'
      [001] #         ...ica_initial_join_removal_of_compacted_run_files_test.lua:34: in function <...ica_initial_join_removal_of_compacted_run_files_test.lua:33>
      [001] #         ...
      [001] #         [C]: in function 'xpcall'
      [001] # Ran 1 tests in 1.682 seconds, 0 succeeded, 1 errored
      NO_WRAP
      
      Let's fix this by stopping the test server started by the
      vinyl-luatest/update_optimize test.
      
      NO_DOC=test
      NO_CHANGELOG=test
      85040161
    • Vladimir Davydov's avatar
      test: add improved test for SELECT consistency · 4e9a94a3
      Vladimir Davydov authored
      The idea behind the new test is the same as the one used by
      vinyl/select_consistency.test.lua: create a space with a few
      compound secondary indexes that share the first part, then run
      SELECT requests under heavy write load and check that results
      match. However, in comparison to its predecessor, the new test
      has a few improvements:
      
       1. It generates DML requests in multi-statement transactions.
       2. It checks non-unique indexes.
       3. It checks multikey indexes.
       4. It triggers L0 dumps not by box.snapshot, but by exceeding
          the box.cfg.vinyl_memory limit.
       5. It starts 20 write and 5 read fibers.
       6. It reruns the test after restart to check that recovery works fine.
       7. It checks that there's no phantom statements stored in
          the space indexes after the test.
       8. It runs the test with deferred DELETEs enabled and disabled.
          (see box.cfg.vinyl_defer_deletes).
       9. It is written in luatest.
      
      The test takes about 20 seconds to finish so it's marked as long run.
      
      Closes #4251
      
      NO_DOC=test
      NO_CHANGELOG=test
      4e9a94a3
    • Ilya Verbin's avatar
      box: fix `fselect()` behavior on binary data · 915ccdf1
      Ilya Verbin authored
      Currently it throws an error when encounter binary data, print
      <binary> tag instead.
      
      Closes #7040
      
      NO_DOC=bugfix
      915ccdf1
  6. Jul 04, 2022
    • Boris Stepanenko's avatar
      ci: update luacheck to 0.26.1 · 5557c47a
      Boris Stepanenko authored
      Problem with W214 in src/box/lua/net_box.lua was fixed in previous
      commit. Can bump luacheck version now.
      
      NO_DOC=testing
      NO_TEST=testing
      NO_CHANGELOG=testing
      5557c47a
    • Boris Stepanenko's avatar
      net_box.lua: fix "used variable with unused hint" · 2bd83f52
      Boris Stepanenko authored
      Since 0.26.0 luacheck emits a warning on the `_box` variable.
      From luacheck v.0.26.0 release notes:
      
      "Function arguments that start with a single underscore
      get an "unused hint". Leaving them unused doesn't result
      in a warning. Using them, on the other hand, is a
      new warning (№ 214)."
      
      Renamed `_box` to `__box`, which isn't considered unused.
      
      Closes #7304.
      
      NO_DOC=testing
      NO_TEST=testing
      NO_CHANGELOG=testing
      2bd83f52
    • Vladimir Davydov's avatar
      diag: define error_raise and diag_raise only in C++ code · b1f36d3a
      Vladimir Davydov authored
      We must not throw exceptions from C code.
      
      Currently, there's the only C function that uses diag_raise() - it's
      space_cache_find_xc. We move it under ifdef(__cplusplus).
      
      Follow-up #4735
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      b1f36d3a
    • Vladimir Davydov's avatar
      session: panic if failed to allocate session · b6012792
      Vladimir Davydov authored
      current_session() is called from C code so it must not throw, but it may
      if it fails to allocate a session. Practically, this is hardly possible,
      because we don't limit the runtime arena, which is used for allocation
      of session objects. Still, this looks potentially dangerous.
      
      Gracefully handling an allocation failure in all places where
      current_session() may be called would be complicated. Since it's more of
      a theoretical issue, let's panic on a session allocation error, like we
      do if we fail to allocate other mission critical system objects.
      
      Closes #4735
      
      NO_DOC=code health
      NO_TEST=code health
      NO_CHANGELOG=code health
      b6012792
    • Vladimir Davydov's avatar
      session: rename session_create/destroy to new/delete · eeda37fd
      Vladimir Davydov authored
      The functions allocate and free a session so they should be called
      new/delete, not create/destroy accroding to our naming convention.
      While we are at it, also delete obsoleve comments to these functions:
      they don't invoke session triggers.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      eeda37fd
    • Vladimir Davydov's avatar
      session: convert to C · b713ab71
      Vladimir Davydov authored
      C++ features are not used in this file.
      
      Note, we need to move ifdef(__cplusplus) in user.h to make guest_user
      and admin_user variables accessible from C code.
      
      Also, we need to move initialization of session_vtab_registry to
      session_init(), because most C compilers don't allow to initialize
      a global variable with a value of another global variable.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      b713ab71
    • Serge Petrenko's avatar
      replication: relax split-brain checks after DEMOTE · b5811f15
      Serge Petrenko authored
      Our txn_limbo_is_replica_outdated check works correctly only when there
      is a stream of PROMOTE requests. Only the author of the latest PROMOTE
      is writable and may issue transactions. No matter synchronous or
      asynchronous.
      
      So txn_limbo_is_replica_outdated assumes that everyone but the node with
      the greatest PROMOTE/DEMOTE term is outdated.
      
      This isn't true for DEMOTE requests. There is only one server which
      issues the DEMOTE request, but once it's written, it's fine to accept
      asynchronous transactions from everyone.
      
      Now the check is too strict. Every time there is an asynchronous
      transaction from someone, who isn't the author of the latest PROMOTE or
      DEMOTE, replication is broken with ER_SPLIT_BRAIN.
      
      Let's relax it: when limbo owner is 0, it's fine to accept asynchronous
      transactions from everyone, no matter the term of their latest PROMOTE
      and DEMOTE.
      
      This means that now after a DEMOTE we will miss one case of true
      split-brain: when old leader continues writing data in an obsolete term,
      and the new leader first issues PROMOTE and then DEMOTE.
      
      This is a tradeoff for making async master-master work after DEMOTE.
      
      The completely correct fix would be to write the term the transaction
      was written in with each transaction and replace
      txn_limbo_is_replica_outdated with txn_limbo_is_request_outdated, so
      that we decide whether to filter the request or not judging by the term
      it was applied in, not by the term we seen in some past PROMOTE from the
      node. This fix seems too costy though, given that we only miss one case
      of split-brain at the moment when the user enables master-master
      replication (by writing a DEMOTE). And in master-master there is no such
      thing as a split-brain.
      
      Follow-up #5295
      Closes #7286
      
      NO_DOC=internal chcange
      b5811f15
    • Serge Petrenko's avatar
      replication: guard applier_synchro_filter_tx with limbo latch · 58f0e23d
      Serge Petrenko authored
      Currently there's only one place where applier_synchro_filter_tx
      accesses limbo state under a latch: this place is
      txn_limbo_is_replica_outdated. Soon there will be more accesses to limbo
      parameters and all of them should be guarded as well.
      
      Let's simplify things a bit and guard the whole synchro_filter_tx with
      the limbo latch.
      
      While we are at it remove txn_limbo_is_replica_outdated as not needed
      anymore.
      
      Part-of #7286
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      58f0e23d
    • Serge Petrenko's avatar
      replication: update stale comments regarding synchro filtering · c91afc1b
      Serge Petrenko authored
      Starting with commit deca9749
      ("replication: unify replication filtering with and without elections")
      The filter works always, even when elections are turned off.
      
      Reflect that in the comments for applier_synchro_filter_tx and
      txn_limbo_is_replica_outdated.
      
      Follow-up #6133
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      c91afc1b
Loading