mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-12-21 01:22:01 +03:00
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.
This commit is contained in:
@@ -133,16 +133,25 @@ int wsrep::client_state::before_command()
|
||||
}
|
||||
else if (transaction_.state() == wsrep::transaction::s_aborted)
|
||||
{
|
||||
// Transaction was rolled back either just before sending result
|
||||
// to the client, or after client_state become idle.
|
||||
// Clean up the transaction and return error.
|
||||
override_error(wsrep::e_deadlock_error);
|
||||
lock.unlock();
|
||||
(void)transaction_.after_statement();
|
||||
lock.lock();
|
||||
assert(transaction_.active() == false);
|
||||
debug_log_state("before_command: error");
|
||||
return 1;
|
||||
// Transaction was rolled back either just before sending
|
||||
// result to the client, or after client_state become idle.
|
||||
if (transaction_.is_xa())
|
||||
{
|
||||
// Client will rollback explicitly, return error.
|
||||
debug_log_state("before_command: error");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clean up the transaction and return error.
|
||||
override_error(wsrep::e_deadlock_error);
|
||||
lock.unlock();
|
||||
(void)transaction_.after_statement();
|
||||
lock.lock();
|
||||
assert(transaction_.active() == false);
|
||||
debug_log_state("before_command: error");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
debug_log_state("before_command: success");
|
||||
|
||||
Reference in New Issue
Block a user