1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-06-16 02:01:44 +03:00

Renamed client context m_applier to m_high_priority

This commit is contained in:
Teemu Ollakka
2018-06-16 15:08:31 +03:00
parent d12513303a
commit 47cb8e604c
9 changed files with 30 additions and 31 deletions

View File

@ -40,7 +40,7 @@ enum wsrep::provider::status
db::client_service::replay(wsrep::client_context&,
wsrep::transaction_context& transaction_context)
{
wsrep::client_applier_mode applier_mode(client_context_);
wsrep::high_priority_context high_priority_context(client_context_);
auto ret(provider_.replay(transaction_context.ws_handle(),
&client_context_));
if (ret == wsrep::provider::success)

View File

@ -26,7 +26,8 @@ void db::server::applier_thread()
{
wsrep::client_id client_id(last_client_id_.fetch_add(1) + 1);
db::client applier(*this, client_id,
wsrep::client_context::m_applier, simulator_.params());
wsrep::client_context::m_high_priority,
simulator_.params());
wsrep::client_context* cc(static_cast<wsrep::client_context*>(
&applier.client_context()));
enum wsrep::provider::status ret(

View File

@ -93,8 +93,8 @@ namespace wsrep
m_local,
/*! Generates write sets for replication by the provider. */
m_replicating,
/*! Applies write sets from the provider. */
m_applier,
/*! High priority mode */
m_high_priority,
/*! Client is in total order isolation mode */
m_toi
};
@ -321,19 +321,19 @@ namespace wsrep
int start_transaction(const wsrep::ws_handle& wsh,
const wsrep::ws_meta& meta)
{
assert(mode_ == m_applier);
assert(mode_ == m_high_priority);
return transaction_.start_transaction(wsh, meta);
}
int apply(const wsrep::const_buffer& data)
{
assert(mode_ == m_applier);
assert(mode_ == m_high_priority);
return client_service_.apply(*this, data);
}
int commit()
{
assert(mode_ == m_applier || mode_ == m_local);
assert(mode_ == m_high_priority || mode_ == m_local);
return client_service_.commit(
*this,
transaction_.ws_handle(), transaction_.ws_meta());
@ -411,13 +411,13 @@ namespace wsrep
int start_replaying(const wsrep::ws_meta& ws_meta)
{
assert(mode_ == m_applier);
assert(mode_ == m_high_priority);
return transaction_.start_replaying(ws_meta);
}
void adopt_transaction(wsrep::transaction_context& transaction)
{
assert(mode_ == m_applier);
assert(mode_ == m_high_priority);
transaction_.start_transaction(transaction.id());
transaction_.streaming_context_ = transaction.streaming_context_;
}
@ -561,7 +561,7 @@ namespace wsrep
client_context& operator=(client_context&);
friend class client_context_switch;
friend class client_applier_mode;
friend class high_priority_context;
friend class client_toi_mode;
friend class transaction_context;
@ -612,16 +612,16 @@ namespace wsrep
client_context& current_context_;
};
class client_applier_mode
class high_priority_context
{
public:
client_applier_mode(wsrep::client_context& client)
high_priority_context(wsrep::client_context& client)
: client_(client)
, orig_mode_(client.mode_)
{
client_.mode_ = wsrep::client_context::m_applier;
client_.mode_ = wsrep::client_context::m_high_priority;
}
~client_applier_mode()
~high_priority_context()
{
client_.mode_ = orig_mode_;
}
@ -673,7 +673,6 @@ namespace wsrep
wsrep::client_context* client_context_;
D deleter_;
};
}
#endif // WSREP_CLIENT_CONTEXT_HPP

View File

@ -55,7 +55,7 @@ int wsrep::transaction_context::start_transaction(
switch (client_context_.mode())
{
case wsrep::client_context::m_local:
case wsrep::client_context::m_applier:
case wsrep::client_context::m_high_priority:
return 0;
case wsrep::client_context::m_replicating:
return provider_.start_transaction(ws_handle_);
@ -72,7 +72,7 @@ int wsrep::transaction_context::start_transaction(
assert(ws_meta.flags());
assert(active() == false);
id_ = ws_meta.transaction_id();
assert(client_context_.mode() == wsrep::client_context::m_applier);
assert(client_context_.mode() == wsrep::client_context::m_high_priority);
state_ = s_executing;
state_hist_.clear();
ws_handle_ = ws_handle;
@ -86,7 +86,7 @@ int wsrep::transaction_context::start_replaying(const wsrep::ws_meta& ws_meta)
ws_meta_ = ws_meta;
assert(ws_meta_.flags() & wsrep::provider::flag::commit);
assert(active());
assert(client_context_.mode() == wsrep::client_context::m_applier);
assert(client_context_.mode() == wsrep::client_context::m_high_priority);
assert(state() == s_replaying);
assert(ws_handle_.opaque());
assert(ws_meta_.seqno().nil() == false);
@ -180,7 +180,7 @@ int wsrep::transaction_context::before_prepare(
}
break;
case wsrep::client_context::m_local:
case wsrep::client_context::m_applier:
case wsrep::client_context::m_high_priority:
if (is_streaming())
{
client_context_.remove_fragments();
@ -220,7 +220,7 @@ int wsrep::transaction_context::after_prepare(
state() == s_cert_failed));
break;
case wsrep::client_context::m_local:
case wsrep::client_context::m_applier:
case wsrep::client_context::m_high_priority:
state(lock, s_certifying);
state(lock, s_committing);
ret = 0;
@ -310,7 +310,7 @@ int wsrep::transaction_context::before_commit()
}
}
break;
case wsrep::client_context::m_applier:
case wsrep::client_context::m_high_priority:
assert(certified());
assert(ordered());
if (client_context_.do_2pc() == false)
@ -360,7 +360,7 @@ int wsrep::transaction_context::after_commit()
if (is_streaming())
{
assert(client_context_.mode() == wsrep::client_context::m_replicating ||
client_context_.mode() == wsrep::client_context::m_applier);
client_context_.mode() == wsrep::client_context::m_high_priority);
clear_fragments();
}
@ -372,7 +372,7 @@ int wsrep::transaction_context::after_commit()
case wsrep::client_context::m_replicating:
ret = provider_.release(ws_handle_);
break;
case wsrep::client_context::m_applier:
case wsrep::client_context::m_high_priority:
break;
default:
assert(0);

View File

@ -312,7 +312,7 @@ namespace
wsrep::client_context* client_context(
reinterpret_cast<wsrep::client_context*>(ctx));
assert(client_context);
assert(client_context->mode() == wsrep::client_context::m_applier);
assert(client_context->mode() == wsrep::client_context::m_high_priority);
wsrep::const_buffer data(buf->ptr, buf->len);
wsrep::ws_handle ws_handle(wsh->trx_id, wsh->opaque);

View File

@ -98,7 +98,7 @@ namespace
wsrep::server_context::rm_async)
, cc(sc, sc.client_service(),
wsrep::client_id(1),
wsrep::client_context::m_applier)
wsrep::client_context::m_high_priority)
, tc(cc.transaction())
{
BOOST_REQUIRE(cc.before_command() == 0);
@ -126,7 +126,7 @@ namespace
wsrep::server_context::rm_async)
, cc(sc, sc.client_service(),
wsrep::client_id(1),
wsrep::client_context::m_applier)
wsrep::client_context::m_high_priority)
, tc(cc.transaction())
{
sc.client_service().do_2pc_ = true;

View File

@ -156,7 +156,7 @@ namespace wsrep
{
wsrep::client_context& cc(
*static_cast<wsrep::client_context*>(ctx));
wsrep::client_applier_mode applier_mode(cc);
wsrep::high_priority_context high_priority_context(cc);
const wsrep::transaction_context& tc(cc.transaction());
wsrep::ws_meta ws_meta;
if (replay_result_ == wsrep::provider::success)

View File

@ -39,7 +39,7 @@ namespace wsrep
{
return new wsrep::mock_client_context(
*this, client_service_, ++last_client_id_,
wsrep::client_context::m_applier);
wsrep::client_context::m_high_priority);
}
void release_client_context(wsrep::client_context* client_context)
{
@ -50,7 +50,6 @@ namespace wsrep
const wsrep::ws_meta&)
WSREP_OVERRIDE
{
//
}
void on_connect() WSREP_OVERRIDE { }
void wait_until_connected() WSREP_OVERRIDE { }

View File

@ -15,7 +15,7 @@ namespace
wsrep::server_context::rm_sync)
, cc(sc, sc.client_service(),
wsrep::client_id(1),
wsrep::client_context::m_applier)
wsrep::client_context::m_high_priority)
, ws_handle(1, (void*)1)
, ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
wsrep::stid(wsrep::id("1"), 1, 1),
@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(server_context_streaming)
wsrep::mock_client_context cc(sc,
sc.client_service(),
wsrep::client_id(1),
wsrep::client_context::m_applier);
wsrep::client_context::m_high_priority);
wsrep::ws_handle ws_handle(1, (void*)1);
wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
wsrep::stid(wsrep::id("1"), 1, 1),