1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-08-05 04:01:12 +03:00

Extract before_commit_high_priority()

This commit is contained in:
Teemu Ollakka
2023-04-04 08:46:53 +03:00
parent 3132f7ee14
commit 55a0bd6469
2 changed files with 36 additions and 30 deletions

View File

@@ -238,6 +238,8 @@ namespace wsrep
wsrep::provider& provider(); wsrep::provider& provider();
void flags(int flags) { flags_ = flags; } void flags(int flags) { flags_ = flags; }
int before_commit_local(wsrep::unique_lock<wsrep::mutex>&);
int before_commit_high_priority(wsrep::unique_lock<wsrep::mutex>&);
// Return true if the transaction must abort, is aborting, // Return true if the transaction must abort, is aborting,
// or has been aborted, or has been interrupted by DBMS // or has been aborted, or has been interrupted by DBMS
// as indicated by client_service::interrupted() call. // as indicated by client_service::interrupted() call.
@@ -245,7 +247,6 @@ namespace wsrep
// error status accordingly. // error status accordingly.
bool abort_or_interrupt(wsrep::unique_lock<wsrep::mutex>&); bool abort_or_interrupt(wsrep::unique_lock<wsrep::mutex>&);
int streaming_step(wsrep::unique_lock<wsrep::mutex>&, bool force = false); int streaming_step(wsrep::unique_lock<wsrep::mutex>&, bool force = false);
int before_commit_local(wsrep::unique_lock<wsrep::mutex>&);
int certify_fragment(wsrep::unique_lock<wsrep::mutex>&); int certify_fragment(wsrep::unique_lock<wsrep::mutex>&);
int certify_commit(wsrep::unique_lock<wsrep::mutex>&); int certify_commit(wsrep::unique_lock<wsrep::mutex>&);
int append_sr_keys_for_commit(); int append_sr_keys_for_commit();

View File

@@ -509,27 +509,15 @@ int wsrep::transaction::before_commit_local(
return ret; return ret;
} }
int wsrep::transaction::before_commit() int wsrep::transaction::before_commit_high_priority(
wsrep::unique_lock<wsrep::mutex>& lock)
{ {
int ret(1); int ret = 1;
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
debug_log_state("before_commit_enter");
assert(client_state_.mode() != wsrep::client_state::m_toi);
switch (client_state_.mode())
{
case wsrep::client_state::m_local:
return before_commit_local(lock);
case wsrep::client_state::m_high_priority:
assert(certified()); assert(certified());
assert(ordered()); assert(ordered());
if (is_xa()) if (is_xa())
{ {
assert(state() == s_prepared || assert(state() == s_prepared || state() == s_replaying);
state() == s_replaying);
state(lock, s_committing); state(lock, s_committing);
ret = 0; ret = 0;
} }
@@ -549,6 +537,23 @@ int wsrep::transaction::before_commit()
state(lock, s_must_abort); state(lock, s_must_abort);
state(lock, s_aborting); state(lock, s_aborting);
} }
return ret;
}
int wsrep::transaction::before_commit()
{
int ret(1);
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
debug_log_state("before_commit_enter");
assert(client_state_.mode() != wsrep::client_state::m_toi);
switch (client_state_.mode())
{
case wsrep::client_state::m_local:
ret = before_commit_local(lock);
break;
case wsrep::client_state::m_high_priority:
ret = before_commit_high_priority(lock);
break; break;
default: default:
assert(0); assert(0);