mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-24 10:42:31 +03:00
Replaced replicating mode with local.
The intended purpose for local mode was local storage access without entering replication hooks. However, the same can be achieved with high priority mode. Removed replicating mode and use local instead to denote locally processing clients.
This commit is contained in:
@ -202,7 +202,7 @@ int wsrep::client_state::after_statement()
|
||||
(void)transaction_.after_statement();
|
||||
if (current_error() == wsrep::e_deadlock_error)
|
||||
{
|
||||
if (mode_ == m_replicating)
|
||||
if (mode_ == m_local)
|
||||
{
|
||||
debug_log_state("after_statement: may_retry");
|
||||
return 1;
|
||||
@ -222,7 +222,7 @@ int wsrep::client_state::enable_streaming(
|
||||
fragment_unit,
|
||||
size_t fragment_size)
|
||||
{
|
||||
assert(mode_ == m_replicating);
|
||||
assert(mode_ == m_local);
|
||||
if (transaction_.active() &&
|
||||
transaction_.streaming_context_.fragment_unit() !=
|
||||
fragment_unit)
|
||||
@ -242,7 +242,7 @@ int wsrep::client_state::enter_toi(const wsrep::key_array& keys,
|
||||
int flags)
|
||||
{
|
||||
assert(state_ == s_exec);
|
||||
assert(mode_ == m_replicating);
|
||||
assert(mode_ == m_local);
|
||||
int ret;
|
||||
switch (provider().enter_toi(id_, keys, buffer, toi_meta_, flags))
|
||||
{
|
||||
@ -276,7 +276,7 @@ int wsrep::client_state::enter_toi(const wsrep::ws_meta& ws_meta)
|
||||
int wsrep::client_state::leave_toi()
|
||||
{
|
||||
int ret;
|
||||
if (toi_mode_ == m_replicating)
|
||||
if (toi_mode_ == m_local)
|
||||
{
|
||||
switch (provider().leave_toi(id_))
|
||||
{
|
||||
@ -431,12 +431,11 @@ void wsrep::client_state::mode(
|
||||
{
|
||||
assert(lock.owns_lock());
|
||||
static const char allowed[n_modes_][n_modes_] =
|
||||
{ /* l r h t r */
|
||||
{ 0, 0, 0, 0, 0 }, /* local */
|
||||
{ 0, 0, 1, 1, 1 }, /* repl */
|
||||
{ 0, 1, 0, 1, 0 }, /* high prio */
|
||||
{ 0, 1, 1, 0, 0 }, /* toi */
|
||||
{ 0, 1, 0, 0, 0 } /* rsu */
|
||||
{ /* l h t r */
|
||||
{ 0, 1, 1, 1 }, /* local */
|
||||
{ 1, 0, 1, 0 }, /* high prio */
|
||||
{ 1, 1, 0, 0 }, /* toi */
|
||||
{ 1, 0, 0, 0 } /* rsu */
|
||||
};
|
||||
if (allowed[mode_][mode])
|
||||
{
|
||||
|
@ -58,11 +58,10 @@ int wsrep::transaction::start_transaction(
|
||||
flags_ |= wsrep::provider::flag::start_transaction;
|
||||
switch (client_state_.mode())
|
||||
{
|
||||
case wsrep::client_state::m_local:
|
||||
case wsrep::client_state::m_high_priority:
|
||||
debug_log_state("start_transaction success");
|
||||
return 0;
|
||||
case wsrep::client_state::m_replicating:
|
||||
case wsrep::client_state::m_local:
|
||||
debug_log_state("start_transaction success");
|
||||
return provider().start_transaction(ws_handle_);
|
||||
default:
|
||||
@ -162,7 +161,7 @@ int wsrep::transaction::before_prepare(
|
||||
|
||||
if (state() == s_must_abort)
|
||||
{
|
||||
assert(client_state_.mode() == wsrep::client_state::m_replicating);
|
||||
assert(client_state_.mode() == wsrep::client_state::m_local);
|
||||
client_state_.override_error(wsrep::e_deadlock_error);
|
||||
return 1;
|
||||
}
|
||||
@ -171,7 +170,7 @@ int wsrep::transaction::before_prepare(
|
||||
|
||||
switch (client_state_.mode())
|
||||
{
|
||||
case wsrep::client_state::m_replicating:
|
||||
case wsrep::client_state::m_local:
|
||||
if (is_streaming())
|
||||
{
|
||||
client_service_.debug_crash(
|
||||
@ -193,7 +192,6 @@ int wsrep::transaction::before_prepare(
|
||||
"crash_last_fragment_commit_after_fragment_removal");
|
||||
}
|
||||
break;
|
||||
case wsrep::client_state::m_local:
|
||||
case wsrep::client_state::m_high_priority:
|
||||
if (is_streaming())
|
||||
{
|
||||
@ -219,21 +217,20 @@ int wsrep::transaction::after_prepare(
|
||||
assert(state() == s_preparing || state() == s_must_abort);
|
||||
if (state() == s_must_abort)
|
||||
{
|
||||
assert(client_state_.mode() == wsrep::client_state::m_replicating);
|
||||
assert(client_state_.mode() == wsrep::client_state::m_local);
|
||||
client_state_.override_error(wsrep::e_deadlock_error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (client_state_.mode())
|
||||
{
|
||||
case wsrep::client_state::m_replicating:
|
||||
case wsrep::client_state::m_local:
|
||||
ret = certify_commit(lock);
|
||||
assert((ret == 0 && state() == s_committing) ||
|
||||
(state() == s_must_abort ||
|
||||
state() == s_must_replay ||
|
||||
state() == s_cert_failed));
|
||||
break;
|
||||
case wsrep::client_state::m_local:
|
||||
case wsrep::client_state::m_high_priority:
|
||||
state(lock, s_certifying);
|
||||
state(lock, s_committing);
|
||||
@ -264,12 +261,6 @@ int wsrep::transaction::before_commit()
|
||||
switch (client_state_.mode())
|
||||
{
|
||||
case wsrep::client_state::m_local:
|
||||
if (ordered())
|
||||
{
|
||||
ret = provider().commit_order_enter(ws_handle_, ws_meta_);
|
||||
}
|
||||
break;
|
||||
case wsrep::client_state::m_replicating:
|
||||
if (state() == s_executing)
|
||||
{
|
||||
assert(client_service_.do_2pc() == false);
|
||||
@ -380,7 +371,7 @@ int wsrep::transaction::after_commit()
|
||||
|
||||
if (is_streaming())
|
||||
{
|
||||
assert(client_state_.mode() == wsrep::client_state::m_replicating ||
|
||||
assert(client_state_.mode() == wsrep::client_state::m_local ||
|
||||
client_state_.mode() == wsrep::client_state::m_high_priority);
|
||||
clear_fragments();
|
||||
}
|
||||
@ -388,9 +379,6 @@ int wsrep::transaction::after_commit()
|
||||
switch (client_state_.mode())
|
||||
{
|
||||
case wsrep::client_state::m_local:
|
||||
// Nothing to do
|
||||
break;
|
||||
case wsrep::client_state::m_replicating:
|
||||
ret = provider().release(ws_handle_);
|
||||
break;
|
||||
case wsrep::client_state::m_high_priority:
|
||||
@ -735,7 +723,7 @@ int wsrep::transaction::certify_fragment(
|
||||
{
|
||||
assert(lock.owns_lock());
|
||||
|
||||
assert(client_state_.mode() == wsrep::client_state::m_replicating);
|
||||
assert(client_state_.mode() == wsrep::client_state::m_local);
|
||||
assert(streaming_context_.rolled_back() == false);
|
||||
|
||||
client_service_.wait_for_replayers(lock);
|
||||
|
Reference in New Issue
Block a user