1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-04-19 21:02:17 +03:00

462 Commits

Author SHA1 Message Date
sjaakola
e20e53fb1a Fixes according to review comments 2023-04-13 13:36:29 +03:00
sjaakola
1cf5ca7848 Changed background_rollback to return true/false depending on if
background rollback did happen.
Background rollback should be skipped if the aborting happens due to KILL command issued by user.
Some KILL signals, like KILL CONECTION, wake up the victim too early so that background rollback
could happen in parallel with the victim waking up and continuing execution.
2023-04-13 13:36:29 +03:00
Teemu Ollakka
4951c38357 Github Actions has removed ubuntu-18.04
Replace ubuntu-18.04 virtual environment with ubuntu-20.04.
Compilation tests for GCC < 7 cannot be done anymore
since ubuntu-20.04 environment does not provide such an
old compilers.
2023-04-04 13:53:25 +03:00
Teemu Ollakka
626c0b7b3b Fix -Winconsistent-missing-destructor-override warnings 2023-03-30 13:46:14 +03:00
Teemu Ollakka
66a8fa9b13 Add -Winconsistent-missing-destructor-override if compiler supports 2023-03-30 13:03:43 +03:00
Teemu Ollakka
94ea93a48d Add clang-13 into build matrix 2023-03-29 18:14:43 +03:00
Teemu Ollakka
5185ad3481 Grab lock after starting background rollback
This makes the bf_abort() to return with lock locked.
2023-03-17 16:24:56 +02:00
Teemu Ollakka
69b9d7d464 Allow external locking for BF aborts
Added methods bf_abort() and total_order_bf_abort() which take
wsrep::unique_lock<wsrep::mutex> as argument to allow caller
to grab the mutex before attempting BF abort. The old calls
were kept for backwards compatibility and wrap the new calls
with internal locking.
2023-03-17 14:38:03 +02:00
Daniele Sciascia
32d4275c60 Rollback storage service in case of errors while appending fragment
This is part of fix for MDEV-30838
2023-03-14 14:25:37 +01:00
Teemu Ollakka
7e0ccfc1d4 Updated wsrep-API/v26 for ASAN instrumentation fix 2023-03-02 08:44:56 +02:00
Teemu Ollakka
9a35083730 Eliminated duplicate fragment removal code
Extracted duplicate fragment removal code in after_commit()
and after_rollback() into separate method.
2023-03-02 08:39:37 +02:00
Teemu Ollakka
241898af7e Postpone streaming_context cleanup into after_rollback()
Streaming_context was cleaned up in streaming_rollback(),
which could cause clearing fragment seqno vector while
it was still accessed by the owning thread, causing
undefined behavior. Fixed by postponing streaming_context
cleanup for BF aborted SR transactions to always happen in
after_rollback().
2023-03-02 08:38:19 +02:00
Teemu Ollakka
19eaed587c Fix total order BF abort
Streaming rollback for total order BF abort used regular
BF abort codepath, which was not correct because the streaming
rollback must fully complete before total order operation executes.
Fixed this by adjusting bf_aborted_in_total_order_
before streaming_rollback() gets called.
2023-03-02 08:37:12 +02:00
Teemu Ollakka
7843345a19 Extracted duplicate logic into return_from_donor_state
The condition to skip changing to `s_joined` for all codepaths
which return from donor state. Extracted the logic into separate
method.

Commented start_sst_action in mock_server_service.
2023-02-28 16:20:18 +02:00
Teemu Ollakka
5a943b66a7 Fix assertion unallowed state transition: connected -> joined
When the donor lost its donor state during SST due to cluster
partitioning, the state was erranously changed to `s_joined`
in `start_sst()` and `sst_sent()`, which caused assertion failures
in state checking.

Fixed by changing state to `s_joined` only if donor is still in
`s_donor` state.
2023-02-28 12:13:00 +02:00
Teemu Ollakka
3b3429d8df Work around GCC 12 warning of uninitialized use
Use pointers to pass state objects to service constructors
to work around GCC 12 warning

  error: member ‘wsrep::mock_storage_service::client_state_’
  is used uninitialized
2023-02-27 13:32:55 +02:00
Teemu Ollakka
9e8708af7e Add GCC 12 into GitHup actions build matrix 2023-02-26 10:12:56 +02:00
Teemu Ollakka
53638a8384 Removing assert() calls from public headers
Removed calls to assert() from public headers to have
full control when assertions are enabled in wsrep-lib
code regardless of parent project build configuration.
Moved methods containing assertions and non-trivial
code from headers into compilation units.
2023-02-26 10:12:49 +02:00
Teemu Ollakka
940ba9bd0e Fix escape_json() compilation error due to type limits check
Compilation failed on arm64 with

  error: comparison is always true due to limited range of data type
  [-Werror=type-limits]

for
  if (0x0 <= *c && *c <= 0x1f)

This was because char is unsigned on arm64 and thus always greater
than zero.

Fixed by using std::iscntrl() instead of explicit range check.
This adds also backspace into set of escaped characters.
2023-01-23 11:08:32 +02:00
Teemu Ollakka
275a0af8c5 Return error codes instead of throwing exception
Changed server_state public methods sst_received() and wait_until_state()
to report errors as return value instead of throwing exceptions.
This was done to gradually get rid of public methods which report
errors via exceptions.

This change was part of MDEV-30419.
2023-01-18 13:47:10 +02:00
Teemu Ollakka
de3d7b63ea Add report_event() method into reporter object
Report event will write json formatted event into report
file.

Include Boost headers as system headers to avoid generating
excessive warnings. Enable extra tests for selected compilers
in actions.
2022-12-05 17:05:14 +02:00
Daniele Sciascia
f8ff2cfdd4 Remove unnecessary include directives from the public interface 2022-11-10 10:31:36 +01:00
sjaakola
2db35f8f6c MDEV-29512 deadlock between commit monitor and THD::LOCK_thd_data mutex
Grabbing back the lock later, after set_position has been called.
This is because set_position may have to wait for correct seqno position
and calls sync wait in galera side. Such wait would happen while holding
the lock, which would case hanging like reported in MDEV-29512

PR for MDEV-29512 contains a mtr test for reproducing one such deadlock
scenario.
2022-11-08 17:00:53 +02:00
Daniele Sciascia
b5bddfe4db Fix warnings when -Wextra-semi is enabled
Also, add argument -Wextra-semi if supported by the compiler.
2022-09-20 13:41:07 +03:00
Teemu Ollakka
6caf006214 Minor tweaks to boost library detection
- Change default WITH_BOOST path to reside inside source tree
  to avoid permission problems or accidentally overwriting
  directories outside source tree.
- If system Boost installation is not found, optionally use
  header only unit test framework from location specified by
  WITH_BOOST.
- Fix extra-semi warning in provider_options.hpp.
2022-09-19 15:51:22 +03:00
Teemu Ollakka
453b81c6a7 Provider options module
This commit introduces provider_options module which
acts as a proxy between application and wsrep provider
library.
When initialized, the provider options are read from the
provider through config service api extension. A lookup
table with current values and defaults is constructed.

Parameter names are mapped so that dots in provider parameter
names are transformed to underscores.
2022-09-02 10:29:19 +02:00
Alexey Yurchenko
344544df3e Check for a valid provider instead of connection state in
`server_state::set_encryption_key()`

Refs codership/wsrep-lib#192
2022-08-15 14:48:03 +03:00
Daniele Sciascia
8bfce04189 Fix cleanup for non-prepared XA transactions
Cleanup XA transaction which is marked as prepared in DBMS, but not in
wsrep-lib side. This may happen if the DBMS runs with wsrep disabled.
2022-04-08 14:47:22 +02:00
Otto Kekäläinen
23fb862462 Fix spelling of 'initialize in error message 2022-03-14 08:59:29 +02:00
Daniele Sciascia
63346153ac Fixup error handling on fragment removal
If fragment removal fails when applying rollback fragment, then
rollback the fragment removal context.
2022-01-28 12:23:14 +01:00
Daniele Sciascia
88c3b2609d Revert "Fix fragment removal on rollback"
It turns out that avoiding apply error on fragment removal failure, is
not a safe thing to do. If the DBMS restarts, with a entry in the
streaming log storage, it may be recovered by creating a corresponding
streaming applier.

This reverts commit da5098b622bc6f92c9265bacf4c1168fd69b38b5.
2022-01-26 16:50:52 +01:00
Daniele Sciascia
edd141127c Handle assert server_id_.is_undefined == false
Return an error if server_id_ is undefined before fragment
certification. This may happen if the server disconnects from the
cluster, right before a transactions attempts to replicate a
fragment.
2022-01-25 14:38:28 +01:00
Daniele Sciascia
da5098b622 Fix fragment removal on rollback
Do not cause apply error if fragment removal fails on
rollback. Instead, leave stale entries in storage, and move on.
2022-01-20 16:49:06 +01:00
Alexey Yurchenko
6fd1fdf690 Use dedicated call and progress event for progress reporting in status
reporter interface.

Refs codership/wsrep-lib#174
2021-12-10 20:54:57 +02:00
Alexey Yurchenko
4565f7232f Define event consumption interface for the application side event service
implementation.
Implement event pass-through to the applicaiton.

Refs codership/wsrep-lib#174
2021-12-10 20:54:57 +02:00
Daniele Sciascia
13442a04d8 Assert transaction is active before appending keys and data
Attempt to append keys while transaction is not active results in
creating a transaction handle with id -1 (undefined).
Assert that the transaction is `active()` before appending keys.
Same for appending data.
2021-12-10 18:02:24 +00:00
mkaruza
14b3612a30 Initial allowlist support 2021-12-06 14:23:40 +01:00
Alexey Yurchenko
8f59e7b30b 1. Never transition from s_donor directly to s_synced, always wait
for SYNCED event as expected.
2. Fix transition to `s_joined` only after we have a complete state.
   Complete state is reached in the following 3 cases:
   - SST seqno exceeds connected seqno
   - view seqno equals connected seqno (view processed == view connected)
   - current state is `s_donor`

Refs codership/wsrep-lib#175
2021-11-30 21:49:50 +02:00
Alexey Yurchenko
31a35bf573 Remove obsolete wsrep::server_state::last_committed_gtid() method 2021-11-30 15:05:38 +02:00
Alexey Yurchenko
bef2c93a6d Minor logging cleanups (missing newlines) 2021-11-29 20:12:02 +02:00
Teemu Ollakka
d48122a1fa Introduced macro to silence implicit-fallthrough warning
The fallthrough comment is not enough to silence the warning
with -Wimplicit-fallthrough=5.

This commit also fixes submodule handling in github actions.
2021-11-28 12:20:48 +02:00
Alexey Yurchenko
3f79d4390c Updated wsrep API submodule to the latest version (event service spec) 2021-11-12 11:17:20 +02:00
Teemu Ollakka
e2b3e99c2f Fix workflow/actions submodule handling
Also added new clang and gcc compilers into build matrix.
2021-11-12 10:06:39 +02:00
Teemu Ollakka
7a28f49506 Wait until rollbacker finishes before closing local client 2021-11-01 10:37:33 +02:00
Daniele Sciascia
22921e7082 Cache rollback events that failed to replicate for later retry
This patch introduces a queue to store ids of transactions that failed
to send a rollback fragment in streaming_rollback(). This is to avoid
potentially  missed rollback fragments when a cluster splits and then
later reforms. Rollback fragments would be missing if a node rolled
back a transaction locally (either BFed or voluntary rollback) while
non-primary, and the attempt to send rollback fragment failed in
transaction::streaming_rollback().
Transaction that fail to send rollback fragment can proceed to
rollback locally.  However we must ensure that rollback fragments for
those transactions are eventually delivered by the cluster. This must
be done before a potentially conflicting writeset causes BF-BF
conflicts in the rest of the cluster.
2021-09-30 10:41:57 +02:00
Alexey Yurchenko
efb4aab090 Fixup to previous commit. Since dbsim implies that logger function is
static and global, it cannot use the reporter object, which must be a
non-static member of server class.
2021-09-12 17:22:47 +03:00
Daniele Sciascia
7d6641764b Replay prepared transactions found BFed after prepare
Handle the case were prepare is bf aborted after it has replicated a
fragment, and before the command finishes in
after_command_before_result() and after_command_after_result() hooks.
2021-09-06 15:29:38 +02:00
Alexey Yurchenko
4f1c201c9d Initial implementation of the status interface reporter object. 2021-09-05 15:42:54 +03:00
Daniele Sciascia
0151e98802 Assertion transaction.is_streaming() in wsrep::transaction::adopt()
Assertion is_streaming() fires in transaction::adopt() when a
transaction is BF aborted, while it is in s_executing state, and it
manages to complete rollback and cleanup while the BF aborter is
executing streaming_rollback() with client_state lock is unlocked.
In this case method transaction::adopt() finds a transaction that is
no longer marked as streaming, triggering the assertion.
A condition variable and flag streaming_rollback_in_progress_ now
prevents a client thread to finish rollback, even if the BF aborter
has temporarily unlocked the client_state lock.
2021-09-02 13:22:45 +02:00
Daniele Sciascia
fb86776354 Drop Ubuntu 16.04 environment from github build workflow
Ubuntu 16.04 is EOL and not working anymore on github.
2021-08-23 09:48:42 +02:00