mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Total order BF abort client_state method to differentiate BF
aborts caused by conflicts between transactions and conflicts between TOI operations and transactions.
This commit is contained in:
@ -418,13 +418,28 @@ namespace wsrep
|
|||||||
//
|
//
|
||||||
// BF aborting
|
// BF aborting
|
||||||
//
|
//
|
||||||
|
/**
|
||||||
|
* Brute force abort a transaction. This method should be
|
||||||
|
* called by a transaction which needs to BF abort a conflicting
|
||||||
|
* locally processing transaction.
|
||||||
|
*/
|
||||||
int bf_abort(wsrep::seqno bf_seqno)
|
int bf_abort(wsrep::seqno bf_seqno)
|
||||||
{
|
{
|
||||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||||
assert(mode_ == m_local || transaction_.is_streaming());
|
assert(mode_ == m_local || transaction_.is_streaming());
|
||||||
return transaction_.bf_abort(lock, bf_seqno);
|
return transaction_.bf_abort(lock, bf_seqno);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Brute force abort a transaction in total order. This method
|
||||||
|
* should be called by the TOI operation which needs to
|
||||||
|
* BF abort a transaction.
|
||||||
|
*/
|
||||||
|
int 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);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Adopt a streaming transaction state. This is must be
|
* Adopt a streaming transaction state. This is must be
|
||||||
* called from high_priority_service::adopt_transaction()
|
* called from high_priority_service::adopt_transaction()
|
||||||
|
@ -126,11 +126,18 @@ namespace wsrep
|
|||||||
|
|
||||||
bool bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
|
bool bf_abort(wsrep::unique_lock<wsrep::mutex>& lock,
|
||||||
wsrep::seqno bf_seqno);
|
wsrep::seqno bf_seqno);
|
||||||
|
bool total_order_bf_abort(wsrep::unique_lock<wsrep::mutex>&,
|
||||||
|
wsrep::seqno bf_seqno);
|
||||||
bool bf_aborted() const
|
bool bf_aborted() const
|
||||||
{
|
{
|
||||||
return (bf_abort_client_state_ != 0);
|
return (bf_abort_client_state_ != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bf_aborted_in_total_order() const
|
||||||
|
{
|
||||||
|
return bf_aborted_in_total_order_;
|
||||||
|
}
|
||||||
|
|
||||||
int flags() const
|
int flags() const
|
||||||
{
|
{
|
||||||
return flags_;
|
return flags_;
|
||||||
@ -169,6 +176,7 @@ namespace wsrep
|
|||||||
enum state bf_abort_state_;
|
enum state bf_abort_state_;
|
||||||
enum wsrep::provider::status bf_abort_provider_status_;
|
enum wsrep::provider::status bf_abort_provider_status_;
|
||||||
int bf_abort_client_state_;
|
int bf_abort_client_state_;
|
||||||
|
bool bf_aborted_in_total_order_;
|
||||||
wsrep::ws_handle ws_handle_;
|
wsrep::ws_handle ws_handle_;
|
||||||
wsrep::ws_meta ws_meta_;
|
wsrep::ws_meta ws_meta_;
|
||||||
int flags_;
|
int flags_;
|
||||||
|
@ -93,6 +93,7 @@ wsrep::transaction::transaction(
|
|||||||
, bf_abort_state_(s_executing)
|
, bf_abort_state_(s_executing)
|
||||||
, bf_abort_provider_status_()
|
, bf_abort_provider_status_()
|
||||||
, bf_abort_client_state_()
|
, bf_abort_client_state_()
|
||||||
|
, bf_aborted_in_total_order_()
|
||||||
, ws_handle_()
|
, ws_handle_()
|
||||||
, ws_meta_()
|
, ws_meta_()
|
||||||
, flags_()
|
, flags_()
|
||||||
@ -521,7 +522,7 @@ int wsrep::transaction::before_rollback()
|
|||||||
// fall through
|
// fall through
|
||||||
case s_executing:
|
case s_executing:
|
||||||
// Voluntary rollback
|
// Voluntary rollback
|
||||||
if (is_streaming())
|
if (is_streaming() && bf_aborted_in_total_order_ == false)
|
||||||
{
|
{
|
||||||
streaming_rollback();
|
streaming_rollback();
|
||||||
}
|
}
|
||||||
@ -534,7 +535,7 @@ int wsrep::transaction::before_rollback()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_streaming())
|
if (is_streaming() && bf_aborted_in_total_order_ == false)
|
||||||
{
|
{
|
||||||
streaming_rollback();
|
streaming_rollback();
|
||||||
}
|
}
|
||||||
@ -542,16 +543,16 @@ int wsrep::transaction::before_rollback()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case s_cert_failed:
|
case s_cert_failed:
|
||||||
if (is_streaming())
|
if (is_streaming() && bf_aborted_in_total_order_ == false)
|
||||||
{
|
{
|
||||||
streaming_rollback();
|
streaming_rollback();
|
||||||
}
|
}
|
||||||
state(lock, s_aborting);
|
state(lock, s_aborting);
|
||||||
break;
|
break;
|
||||||
case s_aborting:
|
case s_aborting:
|
||||||
if (is_streaming())
|
if (is_streaming() && bf_aborted_in_total_order_ == false)
|
||||||
{
|
{
|
||||||
provider().rollback(id_);
|
streaming_rollback();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case s_must_replay:
|
case s_must_replay:
|
||||||
@ -840,6 +841,18 @@ bool wsrep::transaction::bf_abort(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wsrep::transaction::total_order_bf_abort(
|
||||||
|
wsrep::unique_lock<wsrep::mutex>& lock WSREP_UNUSED,
|
||||||
|
wsrep::seqno bf_seqno)
|
||||||
|
{
|
||||||
|
bool ret(bf_abort(lock, bf_seqno));
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
bf_aborted_in_total_order_ = true;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Private //
|
// Private //
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1278,6 +1291,7 @@ void wsrep::transaction::cleanup()
|
|||||||
bf_abort_state_ = s_executing;
|
bf_abort_state_ = s_executing;
|
||||||
bf_abort_provider_status_ = wsrep::provider::success;
|
bf_abort_provider_status_ = wsrep::provider::success;
|
||||||
bf_abort_client_state_ = 0;
|
bf_abort_client_state_ = 0;
|
||||||
|
bf_aborted_in_total_order_ = false;
|
||||||
ws_meta_ = wsrep::ws_meta();
|
ws_meta_ = wsrep::ws_meta();
|
||||||
flags_ = 0;
|
flags_ = 0;
|
||||||
certified_ = false;
|
certified_ = false;
|
||||||
|
Reference in New Issue
Block a user