mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-08-08 02:02:57 +03:00
Support detach on transaction prepare
Split method `transaction::xa_detach()` in `before_xa_detach()` and `after_xa_detach()`. This allows to handle bf abort or replay while transaction is detaching and to distinguish if a transaction is bf aborted before or after the DBMS has detached a transaction from its storage engine.
This commit is contained in:
@@ -519,17 +519,31 @@ namespace wsrep
|
||||
* transaction disconnects, and the transaction must not rollback.
|
||||
* After this call, a different client may later attempt to terminate
|
||||
* the transaction by calling method commit_by_xid() or rollback_by_xid().
|
||||
*
|
||||
* @return Zero on success, non-zero if the transaction was BF aborted
|
||||
*/
|
||||
int before_xa_detach();
|
||||
|
||||
/**
|
||||
* This method should be called to conclude the XA detach operation,
|
||||
* after the DBMS has detached the transaction.
|
||||
*
|
||||
* @return Zero on success, non-zero if transaction was BF aborted
|
||||
*/
|
||||
int after_xa_detach();
|
||||
|
||||
/**
|
||||
* @deprecated Use before_xa_detach() and after_xa_detach()
|
||||
*/
|
||||
void xa_detach();
|
||||
|
||||
/**
|
||||
* Replay a XA transaction
|
||||
*
|
||||
* Replay a XA transaction that is in s_idle state.
|
||||
* Replay a local XA transaction in s_idle state,
|
||||
* or detached.
|
||||
* This may happen if the transaction is BF aborted
|
||||
* between prepare and commit.
|
||||
* Since the victim is idle, this method can be called
|
||||
* by the BF aborter or the backround rollbacker.
|
||||
*/
|
||||
void xa_replay();
|
||||
|
||||
|
@@ -63,6 +63,11 @@ namespace wsrep
|
||||
*/
|
||||
virtual const wsrep::transaction& transaction() const = 0;
|
||||
|
||||
/**
|
||||
* Return the associated client_state object
|
||||
*/
|
||||
virtual wsrep::client_state& client_state() const = 0;
|
||||
|
||||
/**
|
||||
* Adopt a transaction.
|
||||
*/
|
||||
|
@@ -126,6 +126,11 @@ namespace wsrep
|
||||
return !xid_.is_null();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the transaction has completed the prepare step.
|
||||
*/
|
||||
bool is_prepared_xa() const;
|
||||
|
||||
void assign_xid(const wsrep::xid& xid);
|
||||
|
||||
const wsrep::xid& xid() const
|
||||
@@ -137,7 +142,9 @@ namespace wsrep
|
||||
|
||||
int commit_or_rollback_by_xid(const wsrep::xid& xid, bool commit);
|
||||
|
||||
void xa_detach();
|
||||
int before_xa_detach(wsrep::unique_lock<mutex>&);
|
||||
|
||||
int after_xa_detach(wsrep::unique_lock<mutex>&);
|
||||
|
||||
int xa_replay(wsrep::unique_lock<wsrep::mutex>&);
|
||||
|
||||
@@ -213,6 +220,11 @@ namespace wsrep
|
||||
return bf_aborted_in_total_order_;
|
||||
}
|
||||
|
||||
wsrep::seqno bf_seqno() const
|
||||
{
|
||||
return bf_seqno_;
|
||||
}
|
||||
|
||||
int flags() const
|
||||
{
|
||||
return flags_;
|
||||
@@ -270,6 +282,7 @@ namespace wsrep
|
||||
enum wsrep::provider::status bf_abort_provider_status_;
|
||||
int bf_abort_client_state_;
|
||||
bool bf_aborted_in_total_order_;
|
||||
wsrep::seqno bf_seqno_;
|
||||
wsrep::ws_handle ws_handle_;
|
||||
wsrep::ws_meta ws_meta_;
|
||||
int flags_;
|
||||
|
Reference in New Issue
Block a user