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

442 Commits

Author SHA1 Message Date
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
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
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
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
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
588166e183 Add debug logging to transaction::commit_or_rollback_by_xid 2020-10-26 14:22:22 +01:00
0172d0fe4f Remove unused debug sync point 2020-10-26 14:22:22 +01:00
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
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
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
7245db4704 Enable -Wsuggest-override if supported by the compiler. 2020-10-22 17:31:21 +03:00
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
ec767cd3f0 Ostream operator for key type for better readability. 2020-10-19 05:31:20 +03:00
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
c68ad83aba Add --wsrep-debug-level options for unit tests 2020-10-05 16:03:33 +02:00
abc0e629ee Fix instructions on how to get a coverage report 2020-10-05 15:28:22 +02:00
eac56f19e0 Remove dead code 2020-10-05 15:10:48 +02:00
1205fdbc84 Extend asan coverage to include all GCC compilers except 4.4 and 4.7. 2020-10-02 15:58:32 +03:00
3f1c3dc22d Make coverage work with out-of-source builds 2020-09-28 18:44:37 +02:00
96cd92164e Added gcc 10 build into travis configuration, fixed compilation errors. 2020-09-03 15:22:28 +03:00
ae4e58ba03 Check existence if dl library.
All platforms do not have dl library, but dlopen() and friends
are included in libc.

Check existence of dl lib and store into WSREP_LIB_LIBDL if found.
2020-07-31 11:13:15 +03:00
3e5a28df32 codership/wsrep-lib#135 Fix wrong assertion in before_command().
An assertion

  `server_state_.rollback_mode() == wsrep::server_state::rm_async`

fired in `client_state::before_command()` if a BF abort happened
between calls to wait_rollback_complete_and_acquire_ownership()
and before_command().

This commit adds a test to reproduce the assertion and verify
the correct behavior, as well as removes the incorrect assertion
to fix the issue.
2020-07-24 10:46:48 +03:00
8ba574f7bf Make sure that NDEBUG is defined in release builds. 2020-07-23 10:12:30 +03:00
daae4a9c35 Some methods in wsrep-lib still hide/ignore return codes from provider
which complicates diagnostics and debugging.

Don't ignore provider return codes and more verbose error logging for
sst_sent(), sst_received(), set_encryption_key() methods

Refs codership/wsrep-lib#127
2020-07-14 12:50:04 +03:00
593f737605 Configurable data payload size for dbsim. 2020-07-02 17:39:21 +03:00
94f5696010 Provide logger callback for wsrep_load 2020-04-17 17:24:23 +02:00
d0255569b0 Variable desynced_on_pause getter 2020-04-03 10:10:29 +02:00
0cec027030 Refs codership/wsrep-lib#124 32-bit compilation fix 2020-03-20 13:52:50 +00:00
dcdd7435bd Added sync-wait option to dbsim. 2020-01-15 11:49:24 +02:00
a17b65a25f Set server position after local certification failure
After a local certification failure, commit order is released without
the setting the current position in DBMS. Which results in diverging
positions between provider and DBMS, if clean shutdown happens right
after local certification failure.
This patch add method set_position() to server_service class. So that
wsrep-lib can instruct DBMS to set the current position after local
certification failure releases commit order.
2020-01-07 11:20:21 +01:00
76f7249b8d Incorrect assertion and state handling in after_replay().
If the transaction fails during replay because of certification
failure, the provider will return control to applier without
terminating the transaction and transaction remains in
s_replaying.

Fixed transaction::after_statement() to handle the state changes
correctly if certification failure is returned from replay.
Replaying was extracted to separate private method from
after_statement(). Removed transaction::after_replay() as it
seems now unnecessary and it bypassed state change sanity checks.

Allowed replaying -> committed transaction transition to handle
the situation where DBMS allocates a new context and client_state
to do the replay.
2019-12-28 12:28:38 +02:00
90157ed1b0 Allow concurrent server_state disconnect operations.
Shutting down the provider may cause replication/appling failures, which
may further result to disconnect calls from failing operations.
Allow concurrent disconnect requests to deal with such a situations.
2019-12-08 13:42:11 +02:00
29e061116a Fixed transaction_xa_applying unit test.
Adjusted transaction_xa_applying unit test to change in
applying_client_fixture. The fixture does not start transaction
and the transaction needs to be started in test explicitly.
2019-12-08 12:52:36 +02:00
57523eea75 enter_toi polling fix 2019-12-08 12:52:36 +02:00
8e37727a27 Removed extra line. 2019-12-08 12:52:36 +02:00
7d8583983f Fixes to review comments
- Increased loop sleep in poll_enter_toi()
- Fixed typos in comments
- Got rid of unnecessary ostringstreams
2019-12-08 12:52:36 +02:00
3fd20c4e4d Fixed compilation for gcc 4.4 2019-12-08 12:52:36 +02:00
043ff7a7e9 remove has_error arg from begin_nbo_phase_two 2019-12-08 12:52:36 +02:00
b64fbe8fbc fix compilation of unit tests 2019-12-08 12:52:36 +02:00
3389b7ad3c better error handling for NBO failures
when losing error voting:
- if NBO has failed locally (DBMS side), don't override original DBMS
  error so it gets reported to the client
- otherwise, report "query interrupted" instead of "error during commit"
2019-12-08 12:52:36 +02:00
b63e753aec removed unnecessary leave_toi and related TODO 2019-12-08 12:52:36 +02:00
f27f549479 poll_enter_toi timeout handlign 2019-12-08 12:52:36 +02:00
64fda07e91 Fixed NBO unit tests. 2019-12-08 12:52:36 +02:00
e0f9550967 handle certification error explicitly when entering TOI 2019-12-08 12:52:36 +02:00
922ce579c7 Clear NBO meta on failure, reset current error status after command. 2019-12-08 12:52:36 +02:00
086c466637 - Added wait-until parameter for begin_nbo_phase_two().
- Retry enter_toi() in poll_enter_toi() also for error_connection_failed
  which means that the connectivity to the cluster has been lost,
  a.k.a non-prim.
2019-12-08 12:52:36 +02:00
750052b640 Fixed timeout condition in poll_enter_toi() 2019-12-08 12:52:36 +02:00
3a1b194741 Pass certification keys also for NBO end.
Certification keys are needed for NBO end to resolve dependencies
for the write sets which follow NBO end. Without keys the following
write sets do not detect dependency to NBO event and may start applying
too early.
2019-12-08 12:52:36 +02:00
58cea10577 Release TOI critical section in poll_enter_toi() in case of error. 2019-12-08 12:52:36 +02:00
4ff55088b1 Fix NBO error handling
- Set both current error and current error status if provider enter_toi()
  or leave_toi() fails.
- Leave NBO mode if TOI cannot be entered in begin_nbo_phase_two().
2019-12-08 12:52:36 +02:00