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

29 Commits

Author SHA1 Message Date
Daniele Sciascia
096b5c5c7a Remove tracking of log_position
This patch removes log_position from streaming_context. The
log_position was meant for keeping track of the database specific
position corresponding to the changes that have been already
replicated by a streaming transaction. In reality, things may be more
complex in the DBMS side and a size_t may be unsufficient to keep
track of the progress of a streaming transaction. For example, in
MariaDB, it may be necessary to keep track of positions in both
transaction and statement caches. Suggesting that the responsibility
of tracking these position(s) should be delegated to client_service.
The log_position was also used to do sanity checks in
streaming_step(). Those sanity checks are preserved by simply keeping
track of the number of bytes that were certified by the streaming
transaction.
2023-11-10 10:00:26 +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
725f148ddb Remove query() method from wsrep::client_service interface 2019-10-16 10:16:39 +02:00
Daniele Sciascia
5d18ce3e75 Minimize client_service interface for XA
Remove methods `is_xa()`, `is_xa_prepare()`, and `xid()` from
client_service interface. Instead, transactions are explicitly
assigned their xid, through at start of XA.
2019-10-16 10:16:39 +02:00
Daniele Sciascia
052247144f Support recovery of XA transactions
* Add method `restore_prepared_transaction` to `client_state` class
  which restores a transaction state from storage given its xid.
* Add method `commit_or_rollback_by_xid` to terminate prepared XA
  transactions by xid.
* Make sure that transactions in prepared state are not rolled back
  when their master fails/partitions away.
2019-10-16 10:16:39 +02:00
Daniele Sciascia
68adbe35f6 Fixup unused parameter position in prepare_fragment_for_replication() 2019-10-16 10:15:55 +02:00
Daniele Sciascia
b614822f08 Fixup to previous commit
Fix client_service in test mock and dbsim to update signature of
method prepare_fragment_for_replication().
2019-10-16 10:15:55 +02:00
Leandro Pacheco
3389074e24 comments and style fixes 2019-10-16 10:15:55 +02:00
Leandro Pacheco
36346beab4 Fixes for XA transactions with streaming enabled
Changes mostly related to handling of XA PREPARE fragments
2019-10-16 10:15:55 +02:00
Daniele Sciascia
54b0eeee45 Add is_query() and is_xa() to dbsim/test client service implementations 2019-10-16 10:15:55 +02:00
Teemu Ollakka
49deb7da98 Refactored checks for transaction state before certification
Moved the check for transaction state before certification step
into separate method abort_or_interrupted() which will check the state
and adjust state and client_state error status accordingly.

Moved the check for abort_or_interrupted() to happen before
the state is changed to certifying and write set data is appended.
This makes the check atomic and reduces the probability of race
conditions. After this check we rely on provider side transaction
state management and error reporting until the certification step
is over.

Change to public API: Pass client_state mutex wrappend in unique_lock
object to client_service::interrupted() call. This way the DBMS side
has a control to the lock object in case it needs to unlock it
temporarily. The underlying mutex will always be locked when the lock
object is passed via interrupted() call.

Other: Allow server_state change from donor to connected. This may
happen if the joiner crashes during SST and the provider reports
it before the DBMS side SST mechanism detects the error.
2019-02-19 22:26:45 +02:00
Teemu Ollakka
ae734a33f8 Fixed compilation errors picked up by travis clang builds 2019-01-19 18:08:49 +02:00
Teemu Ollakka
55f6c63328 codership/wsrep-lib#52 Removed client_service do_2pc() 2019-01-16 19:33:32 +02:00
Teemu Ollakka
c0c977f9ab Added GPLv2 licence and copyright headers. 2018-10-15 15:14:22 +03:00
Teemu Ollakka
b02200b1ef Fixes to streaming rollback
* Check fragment removal error code in prepare phase. It is possible
  that the transaction gets BF aborted during fragment removal.
* Mark fragment certified in certify_fragment() even if the provider
  returns cert failed error. With current wsrep-API error codes
  it may not be possible to distinquish certification failure
  and BF abort during fragment replication. This may also be a
  provider bug. As a result rollback fragment may sometimes be
  replicated when it would not be necessary.
2018-07-17 14:34:24 +03:00
Teemu Ollakka
2ac13100f7 Refactored storage service out of client service interface. 2018-07-07 18:06:37 +03:00
Teemu Ollakka
af18a10a49 Removed is_autocommi() from client_service interface as it is not
quite useful as there might not be enough information for it
after the statement has been processed. Better to handle retrying
on DBMS side. Also removed after_statement_result enumeration and
return plain int from after_statement().
2018-07-06 19:48:48 +03:00
Teemu Ollakka
e876418ed3 * Renamed client service rollback() to bf_rollback() to better
describe its purpose.
* Raise deadlock error for BF aborted transaction in after_statement()
  call if the error is not set yet.
2018-07-06 15:42:03 +03:00
Teemu Ollakka
635eaf4c29 Refactored high priority service out of client service. 2018-07-02 18:22:24 +03:00
Teemu Ollakka
4e152ee79d * Added applier side TOI commit order enter and leave
* Added cleanup_transaction() method to client_service in order to
  provide a way to make DBMS side cleanup when transaction
  is cleaned up
2018-06-25 14:09:19 +03:00
Teemu Ollakka
cad9176474 TOI replicating and applying codepaths 2018-06-25 09:28:51 +03:00
Teemu Ollakka
779f84e5df Made client_service, transaction independent of provider.
Provider may not be loaded when client_service and
transaction are constructed.
2018-06-19 14:54:58 +03:00
Teemu Ollakka
ef5751943d Refactored most of the server_state interface into server_service
abstract interface.
2018-06-18 16:52:41 +03:00
Teemu Ollakka
03043d3f25 Removing client_state dependency from client_service. 2018-06-18 10:21:02 +03:00
Teemu Ollakka
790c2bec4e Renamed transcation_context to transaction 2018-06-17 10:04:00 +03:00
Teemu Ollakka
dd28b173ab Renamed client_context to client_state. 2018-06-17 10:00:13 +03:00
Teemu Ollakka
6dcac8ce4d Finished dbsim integration with refactored client API. 2018-06-16 10:25:14 +03:00
Teemu Ollakka
b3f60b7be1 Refactoring continued. 2018-06-15 15:13:22 +03:00
Teemu Ollakka
4fbf1d0cf8 Refactoring dbms simulator. Intermediate commit. 2018-06-15 12:58:36 +03:00