diff --git a/dbsim/db_client_service.cpp b/dbsim/db_client_service.cpp index 2442170..7ff87ed 100644 --- a/dbsim/db_client_service.cpp +++ b/dbsim/db_client_service.cpp @@ -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) diff --git a/dbsim/db_server.cpp b/dbsim/db_server.cpp index 2f809fe..71512aa 100644 --- a/dbsim/db_server.cpp +++ b/dbsim/db_server.cpp @@ -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( &applier.client_context())); enum wsrep::provider::status ret( diff --git a/include/wsrep/client_context.hpp b/include/wsrep/client_context.hpp index 87d79d3..7cd0c66 100644 --- a/include/wsrep/client_context.hpp +++ b/include/wsrep/client_context.hpp @@ -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 diff --git a/src/transaction_context.cpp b/src/transaction_context.cpp index 6b40391..dc87750 100644 --- a/src/transaction_context.cpp +++ b/src/transaction_context.cpp @@ -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); diff --git a/src/wsrep_provider_v26.cpp b/src/wsrep_provider_v26.cpp index 96ab19f..293d437 100644 --- a/src/wsrep_provider_v26.cpp +++ b/src/wsrep_provider_v26.cpp @@ -312,7 +312,7 @@ namespace wsrep::client_context* client_context( reinterpret_cast(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); diff --git a/test/client_context_fixture.hpp b/test/client_context_fixture.hpp index c132bef..394ef4e 100644 --- a/test/client_context_fixture.hpp +++ b/test/client_context_fixture.hpp @@ -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; diff --git a/test/mock_provider.hpp b/test/mock_provider.hpp index 6af06b9..7853bf2 100644 --- a/test/mock_provider.hpp +++ b/test/mock_provider.hpp @@ -156,7 +156,7 @@ namespace wsrep { wsrep::client_context& cc( *static_cast(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) diff --git a/test/mock_server_context.hpp b/test/mock_server_context.hpp index 0585d78..95a6964 100644 --- a/test/mock_server_context.hpp +++ b/test/mock_server_context.hpp @@ -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 { } diff --git a/test/server_context_test.cpp b/test/server_context_test.cpp index 9f3d90a..f5901dc 100644 --- a/test/server_context_test.cpp +++ b/test/server_context_test.cpp @@ -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),