Set policy_max version to 4.0 to avoid error
Compatibility with CMake < 3.5 has been removed from CMake.
Add github workflow to check CMake compatibility for commonly used
versions and the newest ones.
An id is considered an alphanumeric string if it contains a
non-empty sequence of alphanumeric characters followed by
one or more null characters.
Fixed unit tests accordingly.
- Add a set_provider_factory() method to server_state to allow
injecting provider factory which will be called when the
provider is loaded.
Other related changes:
- Implement to_string() helper method for id class.
- Fix id ostream operator human readable id printing.
- Pass victim client_service as an argument to provider::bf_abort()
to allow passing victim context to custom provider.
- Implement prev() helper method for seqno class.
- Make server_state recover_streaming_appliers_if_not_recovered()
public. In some recovery scenarios the method must be called outside
of server_state internal code paths.
- Add storage_service requires_globals() method. The storage service
implementation may override this to return false if changing to
storage service context does not require store/reset globals.
- Change view final() to also require that the view status is not
primary for the view to be final. Also change the method name to
is_final() to avoid confusion with C++ final identifier.
- Fixes to server state handling in disconnecting and disconnected
states.
- Keep TOI meta data over whole TOI critical section.
Co-authored-by: Denis Protivensky <denis.protivensky@galeracluster.com>
Client state methods before_prepare() and before_commit() accept
a callback which is called by the provider after it can guarantee
sequential consistency. This allows application threads which wish to
maintain sequential consistency to enter before_prepare() and
before_commit() calls concurrently without waiting the prior call
to finish.
Handle the case where client_service::remove_fragments() fails,
for reasons other than bf abort. In this case, we want to make
sure that the transaction state is moved to s_must_abort, so
that we satisfy the sanity check at the end of before_prepare():
```
assert(state() == s_preparing ||
(is_xa() && state() == s_replaying) ||
(ret && (state() == s_must_abort ||
state() == s_must_replay ||
state() == s_cert_failed ||
state() == s_aborted)));
```
The gcc-11 disappeared from ubuntu-2004. Change gcc-11 os to ubuntu
22.04 where it is available.
Add gcc-13 and gcc-14 which are now available on ubuntu-2404.
In `transaction::abort_or_interrupt()` handle the case were a statement
is interrupted while transaction is in prepared state. In which case,
the transaction must remain in prepared state, until it is
committed (or rolled back).
Also in this patch: remove check for reduntant `s_must_abort` state.
MySQL defines a macro log_msg in one of its headers, which
causes log_msg to be replaced with different symbol in
some compilation units.
Fix by renaming the struct to log_msg_t to avoid the conflict.
The thread local ti_thread object was not initialized for main thread,
which caused ASAN to complain about wild pointer.
Fixed by assigning a thread local ti_thread object for main
thread too.
Avoid streaming context cleanup in after_rollback() hook, if
transaction is going to replay. Otherwise, streaming client is not
stopped and is left in streaming client map, potentially causing
"Failed to insert streaming client" warning if the transaction
goes for retry.
Remove bf abort handling `client_state::after_statement()`, since the
same logic already appears later in `transaction::after_statement()`.
Also, introduce `transaction::after_statement()` overload which takes
a lock.
In case if SR transaction gets BF aborted before it is
certified, the replay will happen but if the replay fails
due to certification conflict, the transaction is not terminated
in provider replay and will keep its streaming status.
Removed the wrong assertion about streaming status from
transaction::cleanup().
Allocate separate client state in mock_client_service::replay()
for replaying step.
Added two new test cases for streaming replication replay after
BF abort.
* Move resetting is_bf_immutable_ into trasaction::cleanup()
to ensure that it is reset to false regardless how the
transaction terminates.
* Removed redundant lock()/unlock() methods from
mock_client_state.
The transaction state is set to s_ordered_commit in
ordered_commit(). However, this is too late for making the
transaction immune for BF aborts after commit order has
been established, which happens in before_commit().
Moving the state change into before_commit() would be the
right thing to do, but that would require too many fixes
to existing applications which are using the lib.
In order to make the transaction immune for BF abort
after it has been ordered to commit, introduce additional
boolean flag which is set to true at the end of before_commit()
and is taken into account in bf_abort().
Make is_rollbacker_active() public so that the BF thread can
check if the rollbacker was started or not.
Also don't unlock the lock for launching the background
rollbacker to avoid race conditions in accessing the
victim state.
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.
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.
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().
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.
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.
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.
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
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.
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.