mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-24 10:42:31 +03:00
Allow external locking for BF aborts
Added methods bf_abort() and total_order_bf_abort() which take wsrep::unique_lock<wsrep::mutex> as argument to allow caller to grab the mutex before attempting BF abort. The old calls were kept for backwards compatibility and wrap the new calls with internal locking.
This commit is contained in:
@ -540,6 +540,13 @@ namespace wsrep
|
||||
* Brute force abort a transaction. This method should be
|
||||
* called by a transaction which needs to BF abort a conflicting
|
||||
* locally processing transaction.
|
||||
*
|
||||
* @param lock Lock to protect client state.
|
||||
* @param bf_seqno Seqno of the BF aborter.
|
||||
*/
|
||||
int bf_abort(wsrep::unique_lock<wsrep::mutex>& lock, wsrep::seqno bf_seqno);
|
||||
/**
|
||||
* Wrapper to bf_abort() call, grabs lock internally.
|
||||
*/
|
||||
int bf_abort(wsrep::seqno bf_seqno);
|
||||
|
||||
@ -548,6 +555,11 @@ namespace wsrep
|
||||
* should be called by the TOI operation which needs to
|
||||
* BF abort a transaction.
|
||||
*/
|
||||
int total_order_bf_abort(wsrep::unique_lock<wsrep::mutex>& lock, wsrep::seqno bf_seqno);
|
||||
|
||||
/**
|
||||
* Wrapper to total_order_bf_abort(), grabs lock internally.
|
||||
*/
|
||||
int total_order_bf_abort(wsrep::seqno bf_seqno);
|
||||
|
||||
/**
|
||||
|
@ -530,18 +530,32 @@ void wsrep::client_state::xa_replay()
|
||||
// BF //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int wsrep::client_state::bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
|
||||
wsrep::seqno bf_seqno)
|
||||
{
|
||||
assert(lock.owns_lock());
|
||||
assert(mode_ == m_local || transaction_.is_streaming());
|
||||
return transaction_.bf_abort(lock, bf_seqno);
|
||||
|
||||
}
|
||||
|
||||
int wsrep::client_state::bf_abort(wsrep::seqno bf_seqno)
|
||||
{
|
||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||
return bf_abort(lock, bf_seqno);
|
||||
}
|
||||
|
||||
int wsrep::client_state::total_order_bf_abort(wsrep::unique_lock<wsrep::mutex>& lock, wsrep::seqno bf_seqno)
|
||||
{
|
||||
assert(lock.owns_lock());
|
||||
assert(mode_ == m_local || transaction_.is_streaming());
|
||||
return transaction_.bf_abort(lock, bf_seqno);
|
||||
return transaction_.total_order_bf_abort(lock, bf_seqno);
|
||||
}
|
||||
|
||||
int wsrep::client_state::total_order_bf_abort(wsrep::seqno bf_seqno)
|
||||
{
|
||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||
assert(mode_ == m_local || transaction_.is_streaming());
|
||||
return transaction_.total_order_bf_abort(lock, bf_seqno);
|
||||
return total_order_bf_abort(lock, bf_seqno);
|
||||
}
|
||||
|
||||
void wsrep::client_state::adopt_transaction(
|
||||
|
Reference in New Issue
Block a user