From 55f6c63328a8c16c72698c93d8b38654e0a13f29 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Wed, 16 Jan 2019 15:00:20 +0200 Subject: [PATCH] codership/wsrep-lib#52 Removed client_service do_2pc() --- dbsim/db_client_service.cpp | 5 ----- dbsim/db_client_service.hpp | 1 - include/wsrep/client_service.hpp | 9 --------- src/transaction.cpp | 1 - test/mock_client_state.hpp | 3 --- test/mock_high_priority_service.cpp | 2 +- test/mock_high_priority_service.hpp | 2 ++ test/server_context_test.cpp | 2 ++ 8 files changed, 5 insertions(+), 20 deletions(-) diff --git a/dbsim/db_client_service.cpp b/dbsim/db_client_service.cpp index df39e94..124063f 100644 --- a/dbsim/db_client_service.cpp +++ b/dbsim/db_client_service.cpp @@ -27,11 +27,6 @@ db::client_service::client_service(db::client& client) , client_state_(client_.client_state()) { } -bool db::client_service::do_2pc() const -{ - return client_.do_2pc(); -} - int db::client_service::bf_rollback() { int ret(client_state_.before_rollback()); diff --git a/dbsim/db_client_service.hpp b/dbsim/db_client_service.hpp index ae27f49..ea5c4ce 100644 --- a/dbsim/db_client_service.hpp +++ b/dbsim/db_client_service.hpp @@ -33,7 +33,6 @@ namespace db public: client_service(db::client& client); - bool do_2pc() const override; bool interrupted() const override { return false; } void reset_globals() override { } void store_globals() override { } diff --git a/include/wsrep/client_service.hpp b/include/wsrep/client_service.hpp index b45fed2..3a455d4 100644 --- a/include/wsrep/client_service.hpp +++ b/include/wsrep/client_service.hpp @@ -40,15 +40,6 @@ namespace wsrep public: client_service() { } virtual ~client_service() { } - /** - * Return true if two pahase commit is required for transaction - * to commit. - * - * @todo This interface method should be deprecated, 1pc vs 2pc - * will be deduced from transaction states in - * transaction::before_commit() call. - */ - virtual bool do_2pc() const = 0; /** * Return true if the current transaction has been interrupted diff --git a/src/transaction.cpp b/src/transaction.cpp index db6a54c..81ba1e4 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -374,7 +374,6 @@ int wsrep::transaction::before_commit() case wsrep::client_state::m_local: if (state() == s_executing) { - assert(client_service_.do_2pc() == false); ret = before_prepare(lock) || after_prepare(lock); assert((ret == 0 && state() == s_committing) || diff --git a/test/mock_client_state.hpp b/test/mock_client_state.hpp index 7c11f7b..1221171 100644 --- a/test/mock_client_state.hpp +++ b/test/mock_client_state.hpp @@ -77,9 +77,6 @@ namespace wsrep int bf_rollback() WSREP_OVERRIDE; - bool do_2pc() const WSREP_OVERRIDE - { return do_2pc_; } - bool interrupted() const WSREP_OVERRIDE { return killed_before_certify_; } diff --git a/test/mock_high_priority_service.cpp b/test/mock_high_priority_service.cpp index dc60737..b3b18dc 100644 --- a/test/mock_high_priority_service.cpp +++ b/test/mock_high_priority_service.cpp @@ -48,7 +48,7 @@ int wsrep::mock_high_priority_service::commit( { int ret(0); client_state_->prepare_for_ordering(ws_handle, ws_meta, true); - if (client_state_->client_service().do_2pc()) + if (do_2pc_) { ret = client_state_->before_prepare() || client_state_->after_prepare(); diff --git a/test/mock_high_priority_service.hpp b/test/mock_high_priority_service.hpp index 62663d0..b405d5a 100644 --- a/test/mock_high_priority_service.hpp +++ b/test/mock_high_priority_service.hpp @@ -33,6 +33,7 @@ namespace wsrep wsrep::mock_client_state* client_state, bool replaying) : wsrep::high_priority_service(server_state) + , do_2pc_() , fail_next_applying_() , fail_next_toi_() , client_state_(client_state) @@ -74,6 +75,7 @@ namespace wsrep { return client_state_; } + bool do_2pc_; bool fail_next_applying_; bool fail_next_toi_; private: diff --git a/test/server_context_test.cpp b/test/server_context_test.cpp index 09ece5a..aec7b6b 100644 --- a/test/server_context_test.cpp +++ b/test/server_context_test.cpp @@ -226,6 +226,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_applying_1pc, BOOST_FIXTURE_TEST_CASE(server_state_applying_2pc, applying_server_fixture) { + hps.do_2pc_ = true; char buf[1] = { 1 }; BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 0); @@ -251,6 +252,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_applying_1pc_rollback, BOOST_FIXTURE_TEST_CASE(server_state_applying_2pc_rollback, applying_server_fixture) { + hps.do_2pc_ = true; hps.fail_next_applying_ = true; char buf[1] = { 1 }; BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,