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

476 Commits

Author SHA1 Message Date
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
Daniele Sciascia
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
Teemu Ollakka
209c214fc6 Make git ignore files generated by dgcov 2021-06-14 21:43:56 +03:00
Daniele Sciascia
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
sjaakola
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
sjaakola
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
sjaakola
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
Teemu Ollakka
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
Teemu Ollakka
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
Otto Kekäläinen
a12b814270 Fix various spelling errors
e.g.
- succesfully -> successfully
- preceeding -> preceding
2021-02-04 17:08:08 +02:00
Daniele Sciascia
ebbf947ea6 Signed contributor agreement 2021-02-03 10:04:42 +01:00
mkaruza
435f475f39 Signed contributor agreement 2021-02-03 09:10:57 +01:00
sjaakola
2fdfe0fa50 Signed contributor agreement 2021-02-02 11:41:55 +02:00
Alexey Yurchenko
eeecdaa3e0 Signed CONTRIBUTOR AGREEMENT 2021-02-01 19:34:35 +02:00
Leandro Pacheco
2d7789dcd3 add contributor line 2021-02-01 14:23:19 -03:00
Teemu Ollakka
8d48ab9539 Contributor License Agreement 2021-02-01 19:04:46 +02:00
Teemu Ollakka
a93955ddee Introduce non-locking variant of client_state::cleanup()
The method takes already locked lock object as an argument.
The caller must ensure that the lock object owns the underlying mutex.

Replaced homegrown wsrep::unique_lock with type alias from
std::unique_lock.
2021-01-07 14:38:32 +02:00
Alexey Yurchenko
515ac816f9 Add prefix argument to logger callback.
Refs codership/wsrep-lib#148
2020-12-11 12:24:33 +02:00
Daniele Sciascia
dcf3ce91cd Use --output-on-failure on ctest 2020-11-27 11:29:20 +01:00
Teemu Ollakka
ff94dfd8a7 Handle the possibility of client command that cannot return results
This patch adds the possibility to have client commands that do not
return results from DBMS. While processing such commands we must be
able to preserve errors until the next interaction with client.
Specifically if the transaction is bf aborted while processing such
a non-returning command, then we have to keep the deadlock error until
the client issues a command that may return the error.
To handle such cases, client_state::before_command() now takes
parameter keep_command_error. The DBMS is supposed set
keep_command_error true to instruct wsrep-lib to preserve errors (if
any) until the next command which sets keep_command_error false.

Dealing with a case where current client command does not return result.

Work in progress.

Fix typo and add assertions in keep_command_error()

Make keep_command_error a parameter to before_commit()

Fix comment about keep_command_error

Handle keep_command_error with s_must_abort in wsrep_before_command()

Fix unit test
2020-11-27 11:17:39 +01:00
Teemu Ollakka
85ad715209 Move from Travis CI to GitHub Actions 2020-11-26 01:08:27 +02:00
Daniele Sciascia
41a6e9dad7 Address review comments
Removed unnecessary assertion in transaction::before_commit().
Assert client state and mode in client_state::xa_detach().
2020-10-28 14:37:46 +01:00
Daniele Sciascia
3f449c6318 Remove calls to client_service::will_replay()
Method client_service::will_replay() is now called whenever the
transaction state changes to s_must_replay, in transaction::state().
2020-10-27 09:40:42 +01:00
Daniele Sciascia
a2221567ab Fix memory leaks in transaction_test_xa unit tests
Cleanup the streaming applier created by xa_detach() and
xa_replay().
2020-10-26 14:22:22 +01:00
Daniele Sciascia
6752a4504f Address review comments
* Added unit tests for transaction::xa_detach() and
  transaction::xa_replay()
* Added unit tests for wsrep::xid
* Fixed minor issues pointed out by reviewer
2020-10-26 14:22:22 +01:00
Daniele Sciascia
39e37d3a39 Fix BF abort one phase XA transactions
Assertion is_streaming() would trigger in transaction::before_commit()
if a one phase XA transaction was BF aborted at the right
time (because one phase XA transaction is not streaming yet at commit
time).
2020-10-26 14:22:22 +01:00
Daniele Sciascia
588166e183 Add debug logging to transaction::commit_or_rollback_by_xid 2020-10-26 14:22:22 +01:00
Daniele Sciascia
0172d0fe4f Remove unused debug sync point 2020-10-26 14:22:22 +01:00
Daniele Sciascia
b12bbd059c Support for replaying prepared XA transactions
This patch implments replaying for prepared XA transactions.
Replay may happen in the following cases:

1) The transaction is BF aborted in prepared state and is idle. In
that case, the transaction is handed over to rollbacker for replay.

2) The transaction is BF aborted while executing the
commit (i.e. before or after successful certification). In
which case the transaction replays itself from fragment storage.

3) The transaction is BF aborted while certifying its commit
fragment. This case is handled like replay for streaming transactions,
where the provider is directly involved and re-delivers the last
fragment.
2020-10-26 14:22:22 +01:00
Daniele Sciascia
965642eded Support for detaching prepared XA transactions
Add support for detaching XA transactions. This is useful for handling
the case where the DBMS client has a transaction in prepared state and
disconnects. Before disconnect, the DBMS calls the newly introduced
client_state::xa_detach(), to cleanup the local transaction and
convert it to a high priority transaction. The DBMS may later attempt
to terminate the transaction through client_state::commit_by_xid() or
client_state::rollback_by_xid().

Also in this patch:

- Fix client_state::close() so that it does not rollback transactions
  in prepared state
- Changed class wsrep::xid representation to hold enough information
  so that DBMS can convert to its native representation
- Fix potential infinite loop in
  server_state::find_streaming_applier(wsrep:xid&)
- Append SR keys on prepare fragment and make it pa_unsafe
- Handle one phase commit (simply fall back to two phase)
- Do not rollback prepared streaming clients in
  server_state::close_orphaned_transactions()
2020-10-26 14:20:21 +01:00
Daniele Sciascia
2da6e4894e Unnecessary adopt/start transaction in rollback_fragment()
This patch changes the handling of a rollback fragment so that
the high_priority_service adopts and starts a new transaction only
if fragment removal has to be performed.
When no fragment removal happens, starting a new transaction is
unnecessary: a dummy write set is logged instead and the transaction
is not cleaned up properly in DBMS side.
2020-10-26 10:21:59 +01:00
Teemu Ollakka
7245db4704 Enable -Wsuggest-override if supported by the compiler. 2020-10-22 17:31:21 +03:00
Teemu Ollakka
d1482feb32 Ensure that client_service::will_replay() is called.
Modified tests to verify that client_service::will_replay() is
called whenever it is determined that the transaction must replay.

Added a test to verify behavior when provider::commit_order_enter()
returns BF abort error.

Moved call to client_service::will_replay() into transaction::state()
to ensure that it is always called when shift to s_must_replay
happens.
2020-10-19 06:12:17 +03:00
Teemu Ollakka
ec767cd3f0 Ostream operator for key type for better readability. 2020-10-19 05:31:20 +03:00
Teemu Ollakka
04944b4d10 Unlock before releasing aborted transaction in provider.
Having aborted transaction holding a lock when releasing the
transaction in provider may cause a deadlock if:
- The transaction was BF aborted before it was known that the
  latest fragment was successfully replicated,
- Transaction was going to be released on provider side, but
  it waited for commit order,
- BF thread tried to grab lock for BF aborting, perhaps for
  second time.

As a fix, unlock the lock protecting victim transaction for
the duration of transaction release.
2020-10-13 17:51:51 +03:00
Daniele Sciascia
c68ad83aba Add --wsrep-debug-level options for unit tests 2020-10-05 16:03:33 +02:00
Daniele Sciascia
abc0e629ee Fix instructions on how to get a coverage report 2020-10-05 15:28:22 +02:00