1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-20 01:03:16 +03:00
Commit Graph

498 Commits

Author SHA1 Message Date
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
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
9e8708af7e Add GCC 12 into GitHup actions build matrix 2023-02-26 10:12:56 +02:00
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
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
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
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
f8ff2cfdd4 Remove unnecessary include directives from the public interface 2022-11-10 10:31:36 +01:00
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
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
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
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
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
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
23fb862462 Fix spelling of 'initialize in error message 2022-03-14 08:59:29 +02:00
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
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 da5098b622.
2022-01-26 16:50:52 +01:00
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
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
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
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
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
14b3612a30 Initial allowlist support 2021-12-06 14:23:40 +01:00
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
31a35bf573 Remove obsolete wsrep::server_state::last_committed_gtid() method 2021-11-30 15:05:38 +02:00
bef2c93a6d Minor logging cleanups (missing newlines) 2021-11-29 20:12:02 +02:00
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
3f79d4390c Updated wsrep API submodule to the latest version (event service spec) 2021-11-12 11:17:20 +02:00
e2b3e99c2f Fix workflow/actions submodule handling
Also added new clang and gcc compilers into build matrix.
2021-11-12 10:06:39 +02:00
7a28f49506 Wait until rollbacker finishes before closing local client 2021-11-01 10:37:33 +02:00
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
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
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
4f1c201c9d Initial implementation of the status interface reporter object. 2021-09-05 15:42:54 +03:00
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
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
c45b1eff94 Remove method transaction::clear_fragments()
Remove the method as it does nothing, except for calling
`streaming_context_.clear()`. This led to a situation where we have
two ways to do the same thing, and it is annoying, if one wants to search
for all places where streaming_context is cleaned up.
2021-07-06 11:23:38 +02:00
209c214fc6 Make git ignore files generated by dgcov 2021-06-14 21:43:56 +03:00
0304aa85c7 Fix pa_unsafe flag in transaction::commit_or_rollback_by_xid()
Remove `flags` local variable and use flags_ member in
transaction::commit_or_rollback_by_xid(). This avoids a case where the
pa_unsafe flag was not passed to provider.
2021-06-09 17:40:43 +02:00
85b8150321 fix for: allowing application to set transaction as PA unsafe
The new feature which allows application to set transaction as PA unsafe
caused problems for streaming replication use cases. In apply_write_set(),
it is assumed that write set flags must be 0 for existing streaming
replication transaction. However, if SR transaction modifies non PK table,
the replicated fragment may have pa_unsafe flag.
Fixed by changing the condition detecting SR transactions to accept pa_unsafe
flag. This avoids the apply_write_set() execution from falling down to assert(0)
in the "condition tree"
2021-05-21 09:15:45 +03:00
8884de3503 allowing application to set transaction as PA unsafe
Resetting pa_unsafe flag after fragment certification. If the flag is not reset,
it would remain in effect until the end of the transaction. However, the PA safety
should be inspected only during fragment applying time.
2021-05-19 12:40:22 +03:00
608ee82b26 allowing application to set transaction as PA unsafe
* Removed transaction::p_unsafe_ member
* Changed transaction::pa_unsafe(bool) to modify flags member directly
* Modified transaction.cpp to use transaction.pa_unsafe(bool) rather than
  directly changing transaction's flag
* added method mark_transaction_pa_unsafe() for client_state,
  application will use this
2021-05-14 14:56:02 +03:00
f271ad0c6e Reset client_state toi_mode to m_undefined after RSU
Client state end_rsu() didn't reset toi_mode to m_undefined,
which caused an assertion when NBO was started after RSU.

As a fix, reset toi_mode to m_undefined in end_rsu() after
changing mode.
2021-04-08 17:08:04 +03:00
9318a50d18 Wsrep TLS service
This commit defines a TLS service interface. If the implementation is
provided by the application when the provider is loaded, appropriate
hooks are probed from the provider and the provider side hooks are
initialized after the provider is loaded.

A sample implementation to demostrate the use of TLS interface
is provided in dbsim/db_tls.cpp.

Also contains a change to thread service interface: The
thread exit virtual method was changed to function pointer
to allow thread exit path which does not involve C++.
2021-02-24 11:14:21 +02:00
a12b814270 Fix various spelling errors
e.g.
- succesfully -> successfully
- preceeding -> preceding
2021-02-04 17:08:08 +02:00
ebbf947ea6 Signed contributor agreement 2021-02-03 10:04:42 +01:00
435f475f39 Signed contributor agreement 2021-02-03 09:10:57 +01:00
2fdfe0fa50 Signed contributor agreement 2021-02-02 11:41:55 +02:00
eeecdaa3e0 Signed CONTRIBUTOR AGREEMENT 2021-02-01 19:34:35 +02:00
2d7789dcd3 add contributor line 2021-02-01 14:23:19 -03:00