mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
SR Rollback handling fixes
* Handle BF rollback also in after_statement() call. * Added missing after_apply() call when handling rollback fragment. * Fixed state changes when rollback is starated during preparing state.
This commit is contained in:
@ -192,15 +192,22 @@ int wsrep::client_state::before_statement()
|
|||||||
|
|
||||||
int wsrep::client_state::after_statement()
|
int wsrep::client_state::after_statement()
|
||||||
{
|
{
|
||||||
// wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||||
debug_log_state("after_statement: enter");
|
debug_log_state("after_statement: enter");
|
||||||
assert(state() == s_exec);
|
assert(state() == s_exec);
|
||||||
assert(mode() == m_local);
|
assert(mode() == m_local);
|
||||||
#if 0
|
|
||||||
/**
|
if (transaction_.active() &&
|
||||||
* @todo Check for replay state, do rollback if requested.
|
transaction_.state() == wsrep::transaction::s_must_abort)
|
||||||
*/
|
{
|
||||||
#endif // 0
|
lock.unlock();
|
||||||
|
client_service_.bf_rollback();
|
||||||
|
lock.lock();
|
||||||
|
assert(transaction_.state() == wsrep::transaction::s_aborted);
|
||||||
|
override_error(wsrep::e_deadlock_error);
|
||||||
|
}
|
||||||
|
lock.unlock();
|
||||||
|
|
||||||
(void)transaction_.after_statement();
|
(void)transaction_.after_statement();
|
||||||
if (current_error() == wsrep::e_deadlock_error)
|
if (current_error() == wsrep::e_deadlock_error)
|
||||||
{
|
{
|
||||||
@ -368,8 +375,10 @@ int wsrep::client_state::end_rsu()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// TOI //
|
// Misc //
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int wsrep::client_state::sync_wait(int timeout)
|
int wsrep::client_state::sync_wait(int timeout)
|
||||||
|
@ -98,6 +98,7 @@ namespace
|
|||||||
|
|
||||||
high_priority_service.remove_fragments(ws_meta);
|
high_priority_service.remove_fragments(ws_meta);
|
||||||
high_priority_service.commit(ws_handle, ws_meta);
|
high_priority_service.commit(ws_handle, ws_meta);
|
||||||
|
high_priority_service.after_apply();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,6 +506,7 @@ int wsrep::transaction::before_rollback()
|
|||||||
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
|
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
|
||||||
debug_log_state("before_rollback_enter");
|
debug_log_state("before_rollback_enter");
|
||||||
assert(state() == s_executing ||
|
assert(state() == s_executing ||
|
||||||
|
state() == s_preparing ||
|
||||||
state() == s_must_abort ||
|
state() == s_must_abort ||
|
||||||
// Background rollbacker or rollback initiated from SE
|
// Background rollbacker or rollback initiated from SE
|
||||||
state() == s_aborting ||
|
state() == s_aborting ||
|
||||||
@ -517,6 +518,10 @@ int wsrep::transaction::before_rollback()
|
|||||||
case wsrep::client_state::m_local:
|
case wsrep::client_state::m_local:
|
||||||
switch (state())
|
switch (state())
|
||||||
{
|
{
|
||||||
|
case s_preparing:
|
||||||
|
// Error detected during prepare phase
|
||||||
|
state(lock, s_must_abort);
|
||||||
|
// fall through
|
||||||
case s_executing:
|
case s_executing:
|
||||||
// Voluntary rollback
|
// Voluntary rollback
|
||||||
if (is_streaming())
|
if (is_streaming())
|
||||||
|
Reference in New Issue
Block a user