From 790c2bec4e7842302bfc1ac885d9893cafd22ca4 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Sun, 17 Jun 2018 10:04:00 +0300 Subject: [PATCH] Renamed transcation_context to transaction --- dbsim/db_client.cpp | 12 +- dbsim/db_client_service.cpp | 4 +- dbsim/db_client_service.hpp | 14 +- dbsim/db_storage_engine.cpp | 6 +- dbsim/db_storage_engine.hpp | 4 +- include/wsrep/client_service.hpp | 14 +- include/wsrep/client_state.hpp | 20 +- include/wsrep/server_context.hpp | 6 +- ...ransaction_context.hpp => transaction.hpp} | 36 +- src/CMakeLists.txt | 2 +- src/client_state.cpp | 26 +- src/server_context.cpp | 10 +- src/server_context_test.cpp | 16 +- ...ransaction_context.cpp => transaction.cpp} | 74 ++-- test/CMakeLists.txt | 4 +- test/client_state_fixture.hpp | 32 +- test/mock_client_state.cpp | 6 +- test/mock_client_state.hpp | 12 +- test/mock_provider.hpp | 2 +- test/mock_server_context.hpp | 4 +- test/server_context_test.cpp | 16 +- test/test_utils.cpp | 2 +- test/test_utils.hpp | 4 +- ..._context_test.cpp => transaction_test.cpp} | 348 +++++++++--------- ..._test_2pc.cpp => transaction_test_2pc.cpp} | 90 ++--- 25 files changed, 382 insertions(+), 382 deletions(-) rename include/wsrep/{transaction_context.hpp => transaction.hpp} (76%) rename src/{transaction_context.cpp => transaction.cpp} (93%) rename test/{transaction_context_test.cpp => transaction_test.cpp} (75%) rename test/{transaction_context_test_2pc.cpp => transaction_test_2pc.cpp} (70%) diff --git a/dbsim/db_client.cpp b/dbsim/db_client.cpp index a96aa56..114362b 100644 --- a/dbsim/db_client.cpp +++ b/dbsim/db_client.cpp @@ -57,7 +57,7 @@ int db::client::client_command(F f) { // wsrep::log_info() << "Current error"; assert(client_state_.transaction().state() == - wsrep::transaction_context::s_aborted); + wsrep::transaction::s_aborted); err = 1; } client_state_.after_command_after_result(); @@ -79,7 +79,7 @@ void db::client::run_one_transaction() return err; }); - const wsrep::transaction_context& transaction( + const wsrep::transaction& transaction( client_state_.transaction()); err = err || client_command( @@ -125,17 +125,17 @@ void db::client::run_one_transaction() }); assert(err || - transaction.state() == wsrep::transaction_context::s_aborted || - transaction.state() == wsrep::transaction_context::s_committed); + transaction.state() == wsrep::transaction::s_aborted || + transaction.state() == wsrep::transaction::s_committed); assert(se_trx_.active() == false); assert(transaction.active() == false); switch (transaction.state()) { - case wsrep::transaction_context::s_committed: + case wsrep::transaction::s_committed: ++stats_.commits; break; - case wsrep::transaction_context::s_aborted: + case wsrep::transaction::s_aborted: ++stats_.rollbacks; break; default: diff --git a/dbsim/db_client_service.cpp b/dbsim/db_client_service.cpp index 2b9bfad..7f54736 100644 --- a/dbsim/db_client_service.cpp +++ b/dbsim/db_client_service.cpp @@ -38,10 +38,10 @@ int db::client_service::rollback(wsrep::client_state&) } enum wsrep::provider::status db::client_service::replay(wsrep::client_state&, - wsrep::transaction_context& transaction_context) + wsrep::transaction& transaction) { wsrep::high_priority_context high_priority_context(client_state_); - auto ret(provider_.replay(transaction_context.ws_handle(), + auto ret(provider_.replay(transaction.ws_handle(), &client_state_)); if (ret == wsrep::provider::success) { diff --git a/dbsim/db_client_service.hpp b/dbsim/db_client_service.hpp index ca33a8e..650a8ef 100644 --- a/dbsim/db_client_service.hpp +++ b/dbsim/db_client_service.hpp @@ -6,7 +6,7 @@ #define WSREP_DB_CLIENT_SERVICE_HPP #include "wsrep/client_service.hpp" -#include "wsrep/transaction_context.hpp" +#include "wsrep/transaction.hpp" #include "db_client_state.hpp" @@ -46,7 +46,7 @@ namespace db client_state_.store_globals(); } - int prepare_data_for_replication(wsrep::client_state&, const wsrep::transaction_context&) override + int prepare_data_for_replication(wsrep::client_state&, const wsrep::transaction&) override { return 0; } @@ -57,13 +57,13 @@ namespace db } int prepare_fragment_for_replication(wsrep::client_state&, - const wsrep::transaction_context&, + const wsrep::transaction&, wsrep::mutable_buffer&) override { return 0; } - void remove_fragments(const wsrep::transaction_context&) override + void remove_fragments(const wsrep::transaction&) override { } int apply(wsrep::client_state&, const wsrep::const_buffer&) override; @@ -73,16 +73,16 @@ namespace db int rollback(wsrep::client_state&) override; - void will_replay(const wsrep::transaction_context&) override + void will_replay(const wsrep::transaction&) override { } void wait_for_replayers(wsrep::client_state&, wsrep::unique_lock&) override { } enum wsrep::provider::status replay(wsrep::client_state&, - wsrep::transaction_context&) + wsrep::transaction&) override; - int append_fragment(const wsrep::transaction_context&, int, + int append_fragment(const wsrep::transaction&, int, const wsrep::const_buffer&) override { return 0; diff --git a/dbsim/db_storage_engine.cpp b/dbsim/db_storage_engine.cpp index 66f82bf..5ac9622 100644 --- a/dbsim/db_storage_engine.cpp +++ b/dbsim/db_storage_engine.cpp @@ -16,10 +16,10 @@ void db::storage_engine::transaction::start(db::client* cc) } void db::storage_engine::transaction::apply( - const wsrep::transaction_context& transaction_context) + const wsrep::transaction& transaction) { assert(cc_); - se_.bf_abort_some(transaction_context); + se_.bf_abort_some(transaction); } void db::storage_engine::transaction::commit() @@ -43,7 +43,7 @@ void db::storage_engine::transaction::rollback() cc_ = nullptr; } -void db::storage_engine::bf_abort_some(const wsrep::transaction_context& txc) +void db::storage_engine::bf_abort_some(const wsrep::transaction& txc) { wsrep::unique_lock lock(mutex_); if (alg_freq_ && (std::rand() % alg_freq_) == 0) diff --git a/dbsim/db_storage_engine.hpp b/dbsim/db_storage_engine.hpp index 4834537..e090350 100644 --- a/dbsim/db_storage_engine.hpp +++ b/dbsim/db_storage_engine.hpp @@ -39,7 +39,7 @@ namespace db } bool active() const { return cc_ != nullptr; } void start(client* cc); - void apply(const wsrep::transaction_context&); + void apply(const wsrep::transaction&); void commit(); void rollback(); db::client* client() { return cc_; } @@ -49,7 +49,7 @@ namespace db db::storage_engine& se_; db::client* cc_; }; - void bf_abort_some(const wsrep::transaction_context& tc); + void bf_abort_some(const wsrep::transaction& tc); long long bf_aborts() const { return bf_aborts_; } private: wsrep::default_mutex mutex_; diff --git a/include/wsrep/client_service.hpp b/include/wsrep/client_service.hpp index d4f1099..d42cc0c 100644 --- a/include/wsrep/client_service.hpp +++ b/include/wsrep/client_service.hpp @@ -21,7 +21,7 @@ namespace wsrep { - class transaction_context; + class transaction; class client_state; class client_service { @@ -60,15 +60,15 @@ namespace wsrep /** * Set up a data for replication. */ - virtual int prepare_data_for_replication(wsrep::client_state&, const wsrep::transaction_context&) = 0; + virtual int prepare_data_for_replication(wsrep::client_state&, const wsrep::transaction&) = 0; // // Streaming // virtual size_t bytes_generated() const = 0; virtual int prepare_fragment_for_replication( - wsrep::client_state&, const wsrep::transaction_context&, wsrep::mutable_buffer&) = 0; - virtual void remove_fragments(const wsrep::transaction_context&) = 0; + wsrep::client_state&, const wsrep::transaction&, wsrep::mutable_buffer&) = 0; + virtual void remove_fragments(const wsrep::transaction&) = 0; // // Applying interface @@ -109,7 +109,7 @@ namespace wsrep * @todo This should not be visible to DBMS level, should be * handled internally by wsrep-lib. */ - virtual void will_replay(const wsrep::transaction_context&) = 0; + virtual void will_replay(const wsrep::transaction&) = 0; /** * Replay the current transaction. The implementation must put @@ -121,7 +121,7 @@ namespace wsrep */ virtual enum wsrep::provider::status replay( wsrep::client_state&, - wsrep::transaction_context&) = 0; + wsrep::transaction&) = 0; /** * Wait until all replaying transactions have been finished @@ -136,7 +136,7 @@ namespace wsrep /** * Append a write set fragment into fragment storage. */ - virtual int append_fragment(const wsrep::transaction_context&, int flag, const wsrep::const_buffer&) = 0; + virtual int append_fragment(const wsrep::transaction&, int flag, const wsrep::const_buffer&) = 0; // // Debug interface diff --git a/include/wsrep/client_state.hpp b/include/wsrep/client_state.hpp index fb335f8..139c41d 100644 --- a/include/wsrep/client_state.hpp +++ b/include/wsrep/client_state.hpp @@ -40,7 +40,7 @@ #include "server_context.hpp" #include "provider.hpp" -#include "transaction_context.hpp" +#include "transaction.hpp" #include "client_id.hpp" #include "client_service.hpp" #include "mutex.hpp" @@ -249,7 +249,7 @@ namespace wsrep return transaction_.append_data(data); } - int prepare_data_for_replication(const wsrep::transaction_context& tc) + int prepare_data_for_replication(const wsrep::transaction& tc) { return client_service_.prepare_data_for_replication(*this, tc); } @@ -291,14 +291,14 @@ namespace wsrep } int prepare_fragment_for_replication( - const wsrep::transaction_context& tc, + const wsrep::transaction& tc, wsrep::mutable_buffer& mb) { return client_service_.prepare_fragment_for_replication( *this, tc, mb); } - int append_fragment(const wsrep::transaction_context& tc, + int append_fragment(const wsrep::transaction& tc, int flags, const wsrep::const_buffer& buf) { @@ -415,7 +415,7 @@ namespace wsrep return transaction_.start_replaying(ws_meta); } - void adopt_transaction(wsrep::transaction_context& transaction) + void adopt_transaction(wsrep::transaction& transaction) { assert(mode_ == m_high_priority); transaction_.start_transaction(transaction.id()); @@ -423,7 +423,7 @@ namespace wsrep } enum wsrep::provider::status replay( - wsrep::transaction_context& tc) + wsrep::transaction& tc) { return client_service_.replay(*this, tc); } @@ -432,7 +432,7 @@ namespace wsrep // // - void will_replay(const wsrep::transaction_context& tc) + void will_replay(const wsrep::transaction& tc) { client_service_.will_replay(tc); } @@ -512,7 +512,7 @@ namespace wsrep */ enum state state() const { return state_; } - const wsrep::transaction_context& transaction() const + const wsrep::transaction& transaction() const { return transaction_; } @@ -563,7 +563,7 @@ namespace wsrep friend class client_state_switch; friend class high_priority_context; friend class client_toi_mode; - friend class transaction_context; + friend class transaction; void debug_log_state(const char*) const; /** @@ -581,7 +581,7 @@ namespace wsrep enum mode mode_; enum state state_; protected: - wsrep::transaction_context transaction_; + wsrep::transaction transaction_; private: /** * @todo This boolean should be converted to better read isolation diff --git a/include/wsrep/server_context.hpp b/include/wsrep/server_context.hpp index ef3f183..7fd1592 100644 --- a/include/wsrep/server_context.hpp +++ b/include/wsrep/server_context.hpp @@ -76,7 +76,7 @@ namespace wsrep class provider; class client_state; class transaction_id; - class transaction_context; + class transaction; class id; class gtid; class view; @@ -365,7 +365,7 @@ namespace wsrep * @todo Make this private, allow calls for provider implementations * only. * @param client_state Applier client context. - * @param transaction_context Transaction context. + * @param transaction Transaction context. * @param data Write set data * * @return Zero on success, non-zero on failure. @@ -385,7 +385,7 @@ namespace wsrep */ virtual bool statement_allowed_for_streaming( const wsrep::client_state& client_state, - const wsrep::transaction_context& transaction_context) const; + const wsrep::transaction& transaction) const; void debug_log_level(int level) { debug_log_level_ = level; } int debug_log_level() const { return debug_log_level_; } diff --git a/include/wsrep/transaction_context.hpp b/include/wsrep/transaction.hpp similarity index 76% rename from include/wsrep/transaction_context.hpp rename to include/wsrep/transaction.hpp index 8336821..563376a 100644 --- a/include/wsrep/transaction_context.hpp +++ b/include/wsrep/transaction.hpp @@ -21,7 +21,7 @@ namespace wsrep class const_buffer; - class transaction_context + class transaction { public: enum state @@ -43,8 +43,8 @@ namespace wsrep enum state state() const { return state_; } - transaction_context(wsrep::client_state& client_state); - ~transaction_context(); + transaction(wsrep::client_state& client_state); + ~transaction(); // Accessors wsrep::transaction_id id() const { return id_; } @@ -124,8 +124,8 @@ namespace wsrep const wsrep::ws_handle& ws_handle() const { return ws_handle_; } const wsrep::ws_meta& ws_meta() const { return ws_meta_; } private: - transaction_context(const transaction_context&); - transaction_context operator=(const transaction_context&); + transaction(const transaction&); + transaction operator=(const transaction&); void flags(int flags) { flags_ = flags; } int certify_fragment(wsrep::unique_lock&); @@ -151,22 +151,22 @@ namespace wsrep wsrep::streaming_context streaming_context_; }; - static inline std::string to_string(enum wsrep::transaction_context::state state) + static inline std::string to_string(enum wsrep::transaction::state state) { switch (state) { - case wsrep::transaction_context::s_executing: return "executing"; - case wsrep::transaction_context::s_preparing: return "preparing"; - case wsrep::transaction_context::s_certifying: return "certifying"; - case wsrep::transaction_context::s_committing: return "committing"; - case wsrep::transaction_context::s_ordered_commit: return "ordered_commit"; - case wsrep::transaction_context::s_committed: return "committed"; - case wsrep::transaction_context::s_cert_failed: return "cert_failed"; - case wsrep::transaction_context::s_must_abort: return "must_abort"; - case wsrep::transaction_context::s_aborting: return "aborting"; - case wsrep::transaction_context::s_aborted: return "aborted"; - case wsrep::transaction_context::s_must_replay: return "must_replay"; - case wsrep::transaction_context::s_replaying: return "replaying"; + case wsrep::transaction::s_executing: return "executing"; + case wsrep::transaction::s_preparing: return "preparing"; + case wsrep::transaction::s_certifying: return "certifying"; + case wsrep::transaction::s_committing: return "committing"; + case wsrep::transaction::s_ordered_commit: return "ordered_commit"; + case wsrep::transaction::s_committed: return "committed"; + case wsrep::transaction::s_cert_failed: return "cert_failed"; + case wsrep::transaction::s_must_abort: return "must_abort"; + case wsrep::transaction::s_aborting: return "aborting"; + case wsrep::transaction::s_aborted: return "aborted"; + case wsrep::transaction::s_must_replay: return "must_replay"; + case wsrep::transaction::s_replaying: return "replaying"; } return "unknown"; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8189803..7acc2c1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,6 @@ add_library(wsrep-lib logger.cpp provider.cpp server_context.cpp - transaction_context.cpp + transaction.cpp wsrep_provider_v26.cpp) target_link_libraries(wsrep-lib wsrep_api_v26 pthread dl) diff --git a/src/client_state.cpp b/src/client_state.cpp index 2bbe1e7..d92a596 100644 --- a/src/client_state.cpp +++ b/src/client_state.cpp @@ -38,21 +38,21 @@ int wsrep::client_state::before_command() * @todo Wait until the possible synchronous rollback * has been finished. */ - while (transaction_.state() == wsrep::transaction_context::s_aborting) + while (transaction_.state() == wsrep::transaction::s_aborting) { // cond_.wait(lock); } } state(lock, s_exec); assert(transaction_.active() == false || - (transaction_.state() == wsrep::transaction_context::s_executing || - transaction_.state() == wsrep::transaction_context::s_aborted || - (transaction_.state() == wsrep::transaction_context::s_must_abort && + (transaction_.state() == wsrep::transaction::s_executing || + transaction_.state() == wsrep::transaction::s_aborted || + (transaction_.state() == wsrep::transaction::s_must_abort && server_context_.rollback_mode() == wsrep::server_context::rm_async))); if (transaction_.active()) { - if (transaction_.state() == wsrep::transaction_context::s_must_abort) + if (transaction_.state() == wsrep::transaction::s_must_abort) { assert(server_context_.rollback_mode() == wsrep::server_context::rm_async); @@ -62,13 +62,13 @@ int wsrep::client_state::before_command() (void)transaction_.after_statement(); lock.lock(); assert(transaction_.state() == - wsrep::transaction_context::s_aborted); + wsrep::transaction::s_aborted); assert(transaction_.active() == false); assert(current_error() != wsrep::e_success); debug_log_state("before_command: error"); return 1; } - else if (transaction_.state() == wsrep::transaction_context::s_aborted) + else if (transaction_.state() == wsrep::transaction::s_aborted) { // Transaction was rolled back either just before sending result // to the client, or after client_state become idle. @@ -92,14 +92,14 @@ void wsrep::client_state::after_command_before_result() debug_log_state("after_command_before_result: enter"); assert(state() == s_exec); if (transaction_.active() && - transaction_.state() == wsrep::transaction_context::s_must_abort) + transaction_.state() == wsrep::transaction::s_must_abort) { override_error(wsrep::e_deadlock_error); lock.unlock(); client_service_.rollback(*this); (void)transaction_.after_statement(); lock.lock(); - assert(transaction_.state() == wsrep::transaction_context::s_aborted); + assert(transaction_.state() == wsrep::transaction::s_aborted); assert(current_error() != wsrep::e_success); } state(lock, s_result); @@ -111,14 +111,14 @@ void wsrep::client_state::after_command_after_result() wsrep::unique_lock lock(mutex_); debug_log_state("after_command_after_result_enter"); assert(state() == s_result); - assert(transaction_.state() != wsrep::transaction_context::s_aborting); + assert(transaction_.state() != wsrep::transaction::s_aborting); if (transaction_.active() && - transaction_.state() == wsrep::transaction_context::s_must_abort) + transaction_.state() == wsrep::transaction::s_must_abort) { lock.unlock(); client_service_.rollback(*this); lock.lock(); - assert(transaction_.state() == wsrep::transaction_context::s_aborted); + assert(transaction_.state() == wsrep::transaction::s_aborted); override_error(wsrep::e_deadlock_error); } else if (transaction_.active() == false) @@ -146,7 +146,7 @@ int wsrep::client_state::before_statement() #endif // 0 if (transaction_.active() && - transaction_.state() == wsrep::transaction_context::s_must_abort) + transaction_.state() == wsrep::transaction::s_must_abort) { // Rollback and cleanup will happen in after_command_before_result() debug_log_state("before_statement_error"); diff --git a/src/server_context.cpp b/src/server_context.cpp index 6d3ecb8..426c567 100644 --- a/src/server_context.cpp +++ b/src/server_context.cpp @@ -4,7 +4,7 @@ #include "wsrep/server_context.hpp" #include "wsrep/client_state.hpp" -#include "wsrep/transaction_context.hpp" +#include "wsrep/transaction.hpp" #include "wsrep/view.hpp" #include "wsrep/logger.hpp" #include "wsrep/compiler.hpp" @@ -124,11 +124,11 @@ int wsrep::server_context::on_apply( const wsrep::const_buffer& data) { int ret(0); - const wsrep::transaction_context& txc(client_state.transaction()); + const wsrep::transaction& txc(client_state.transaction()); assert(client_state.mode() == wsrep::client_state::m_high_priority); bool not_replaying(txc.state() != - wsrep::transaction_context::s_replaying); + wsrep::transaction::s_replaying); if (starts_transaction(ws_meta.flags()) && commits_transaction(ws_meta.flags())) @@ -166,7 +166,7 @@ int wsrep::server_context::on_apply( client_state.after_command_after_result(); } assert(ret || - txc.state() == wsrep::transaction_context::s_committed); + txc.state() == wsrep::transaction::s_committed); } else if (starts_transaction(ws_meta.flags())) { @@ -275,7 +275,7 @@ int wsrep::server_context::on_apply( bool wsrep::server_context::statement_allowed_for_streaming( const wsrep::client_state&, - const wsrep::transaction_context&) const + const wsrep::transaction&) const { /* Streaming not implemented yet. */ return false; diff --git a/src/server_context_test.cpp b/src/server_context_test.cpp index 350e91b..6010cf3 100644 --- a/src/server_context_test.cpp +++ b/src/server_context_test.cpp @@ -40,10 +40,10 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_1pc, char buf[1] = { 1 }; BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 0); - const wsrep::transaction_context& txc(cc.transaction()); + const wsrep::transaction& txc(cc.transaction()); // ::abort(); BOOST_REQUIRE_MESSAGE( - txc.state() == wsrep::transaction_context::s_committed, + txc.state() == wsrep::transaction::s_committed, "Transaction state " << txc.state() << " not committed"); } @@ -54,8 +54,8 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_2pc, char buf[1] = { 1 }; BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 0); - const wsrep::transaction_context& txc(cc.transaction()); - BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_committed); + const wsrep::transaction& txc(cc.transaction()); + BOOST_REQUIRE(txc.state() == wsrep::transaction::s_committed); } // Test on_apply() method for 1pc transaction which @@ -67,8 +67,8 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_1pc_rollback, char buf[1] = { 1 }; BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 1); - const wsrep::transaction_context& txc(cc.transaction()); - BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); + const wsrep::transaction& txc(cc.transaction()); + BOOST_REQUIRE(txc.state() == wsrep::transaction::s_aborted); } // Test on_apply() method for 2pc transaction which @@ -80,6 +80,6 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_2pc_rollback, char buf[1] = { 1 }; BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 1); - const wsrep::transaction_context& txc(cc.transaction()); - BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); + const wsrep::transaction& txc(cc.transaction()); + BOOST_REQUIRE(txc.state() == wsrep::transaction::s_aborted); } diff --git a/src/transaction_context.cpp b/src/transaction.cpp similarity index 93% rename from src/transaction_context.cpp rename to src/transaction.cpp index 9d5df61..993ec2b 100644 --- a/src/transaction_context.cpp +++ b/src/transaction.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2018 Codership Oy // -#include "wsrep/transaction_context.hpp" +#include "wsrep/transaction.hpp" #include "wsrep/client_state.hpp" #include "wsrep/server_context.hpp" #include "wsrep/key.hpp" @@ -21,7 +21,7 @@ // Public -wsrep::transaction_context::transaction_context( +wsrep::transaction::transaction( wsrep::client_state& client_state) : provider_(client_state.provider()) , client_state_(client_state) @@ -39,11 +39,11 @@ wsrep::transaction_context::transaction_context( { } -wsrep::transaction_context::~transaction_context() +wsrep::transaction::~transaction() { } -int wsrep::transaction_context::start_transaction( +int wsrep::transaction::start_transaction( const wsrep::transaction_id& id) { assert(active() == false); @@ -65,7 +65,7 @@ int wsrep::transaction_context::start_transaction( } } -int wsrep::transaction_context::start_transaction( +int wsrep::transaction::start_transaction( const wsrep::ws_handle& ws_handle, const wsrep::ws_meta& ws_meta) { @@ -81,7 +81,7 @@ int wsrep::transaction_context::start_transaction( return 0; } -int wsrep::transaction_context::start_replaying(const wsrep::ws_meta& ws_meta) +int wsrep::transaction::start_replaying(const wsrep::ws_meta& ws_meta) { ws_meta_ = ws_meta; assert(ws_meta_.flags() & wsrep::provider::flag::commit); @@ -93,19 +93,19 @@ int wsrep::transaction_context::start_replaying(const wsrep::ws_meta& ws_meta) return 0; } -int wsrep::transaction_context::append_key(const wsrep::key& key) +int wsrep::transaction::append_key(const wsrep::key& key) { /** @todo Collect table level keys for SR commit */ return provider_.append_key(ws_handle_, key); } -int wsrep::transaction_context::append_data(const wsrep::const_buffer& data) +int wsrep::transaction::append_data(const wsrep::const_buffer& data) { return provider_.append_data(ws_handle_, data); } -int wsrep::transaction_context::after_row() +int wsrep::transaction::after_row() { wsrep::unique_lock lock(client_state_.mutex()); if (streaming_context_.fragment_size() > 0) @@ -137,7 +137,7 @@ int wsrep::transaction_context::after_row() return 0; } -int wsrep::transaction_context::before_prepare( +int wsrep::transaction::before_prepare( wsrep::unique_lock& lock) { assert(lock.owns_lock()); @@ -195,7 +195,7 @@ int wsrep::transaction_context::before_prepare( return ret; } -int wsrep::transaction_context::after_prepare( +int wsrep::transaction::after_prepare( wsrep::unique_lock& lock) { assert(lock.owns_lock()); @@ -232,7 +232,7 @@ int wsrep::transaction_context::after_prepare( return ret; } -int wsrep::transaction_context::before_commit() +int wsrep::transaction::before_commit() { int ret(1); @@ -334,7 +334,7 @@ int wsrep::transaction_context::before_commit() return ret; } -int wsrep::transaction_context::ordered_commit() +int wsrep::transaction::ordered_commit() { wsrep::unique_lock lock(client_state_.mutex()); debug_log_state("ordered_commit_enter"); @@ -348,7 +348,7 @@ int wsrep::transaction_context::ordered_commit() return ret; } -int wsrep::transaction_context::after_commit() +int wsrep::transaction::after_commit() { int ret(0); @@ -383,7 +383,7 @@ int wsrep::transaction_context::after_commit() return ret; } -int wsrep::transaction_context::before_rollback() +int wsrep::transaction::before_rollback() { wsrep::unique_lock lock(client_state_.mutex()); debug_log_state("before_rollback_enter"); @@ -440,7 +440,7 @@ int wsrep::transaction_context::before_rollback() return 0; } -int wsrep::transaction_context::after_rollback() +int wsrep::transaction::after_rollback() { wsrep::unique_lock lock(client_state_.mutex()); debug_log_state("after_rollback_enter"); @@ -462,7 +462,7 @@ int wsrep::transaction_context::after_rollback() return 0; } -int wsrep::transaction_context::after_statement() +int wsrep::transaction::after_statement() { int ret(0); wsrep::unique_lock lock(client_state_.mutex()); @@ -565,7 +565,7 @@ int wsrep::transaction_context::after_statement() return ret; } -bool wsrep::transaction_context::bf_abort( +bool wsrep::transaction::bf_abort( wsrep::unique_lock& lock WSREP_UNUSED, wsrep::seqno bf_seqno) { @@ -634,7 +634,7 @@ bool wsrep::transaction_context::bf_abort( // otherwise it could happend that the client gains control // between releasing the lock and before background // rollbacker gets control. - state(lock, wsrep::transaction_context::s_aborting); + state(lock, wsrep::transaction::s_aborting); lock.unlock(); client_state_.server_context().background_rollback(client_state_); } @@ -646,9 +646,9 @@ bool wsrep::transaction_context::bf_abort( // Private // //////////////////////////////////////////////////////////////////////////////// -void wsrep::transaction_context::state( +void wsrep::transaction::state( wsrep::unique_lock& lock __attribute__((unused)), - enum wsrep::transaction_context::state next_state) + enum wsrep::transaction::state next_state) { if (client_state_.debug_log_level() >= 1) { @@ -689,7 +689,7 @@ void wsrep::transaction_context::state( } } -int wsrep::transaction_context::certify_fragment( +int wsrep::transaction::certify_fragment( wsrep::unique_lock& lock) { assert(lock.owns_lock()); @@ -717,7 +717,7 @@ int wsrep::transaction_context::certify_fragment( } // Client context to store fragment in separate transaction - // Switch temporarily to sr_transaction_context, switch back + // Switch temporarily to sr_transaction, switch back // to original when this goes out of scope // std::auto_ptr sr_client_state( // client_state_.server_context().local_client_state()); @@ -731,12 +731,12 @@ int wsrep::transaction_context::certify_fragment( sr_client_state); wsrep::unique_lock sr_lock(sr_client_state.mutex()); - wsrep::transaction_context& sr_transaction_context( + wsrep::transaction& sr_transaction( sr_client_state.transaction_); - sr_transaction_context.state(sr_lock, s_certifying); + sr_transaction.state(sr_lock, s_certifying); sr_lock.unlock(); if (sr_client_state.append_fragment( - sr_transaction_context, flags_, + sr_transaction, flags_, wsrep::const_buffer(data.data(), data.size()))) { lock.lock(); @@ -747,18 +747,18 @@ int wsrep::transaction_context::certify_fragment( enum wsrep::provider::status cert_ret(provider_.certify(client_state_.id().get(), - sr_transaction_context.ws_handle_, + sr_transaction.ws_handle_, flags_, - sr_transaction_context.ws_meta_)); + sr_transaction.ws_meta_)); int ret(0); switch (cert_ret) { case wsrep::provider::success: - streaming_context_.certified(sr_transaction_context.ws_meta().seqno()); + streaming_context_.certified(sr_transaction.ws_meta().seqno()); sr_lock.lock(); - sr_transaction_context.certified_ = true; - sr_transaction_context.state(sr_lock, s_committing); + sr_transaction.certified_ = true; + sr_transaction.state(sr_lock, s_committing); sr_lock.unlock(); if (sr_client_state.commit()) { @@ -767,7 +767,7 @@ int wsrep::transaction_context::certify_fragment( break; default: sr_lock.lock(); - sr_transaction_context.state(sr_lock, s_must_abort); + sr_transaction.state(sr_lock, s_must_abort); sr_lock.unlock(); sr_client_state.rollback(); ret = 1; @@ -786,7 +786,7 @@ int wsrep::transaction_context::certify_fragment( return ret; } -int wsrep::transaction_context::certify_commit( +int wsrep::transaction::certify_commit( wsrep::unique_lock& lock) { assert(lock.owns_lock()); @@ -925,7 +925,7 @@ int wsrep::transaction_context::certify_commit( return ret; } -void wsrep::transaction_context::streaming_rollback() +void wsrep::transaction::streaming_rollback() { assert(streaming_context_.rolled_back() == false); wsrep::client_state* sac( @@ -938,12 +938,12 @@ void wsrep::transaction_context::streaming_rollback() provider_.rollback(id_.get()); } -void wsrep::transaction_context::clear_fragments() +void wsrep::transaction::clear_fragments() { streaming_context_.cleanup(); } -void wsrep::transaction_context::cleanup() +void wsrep::transaction::cleanup() { assert(is_streaming() == false); assert(state() == s_committed || state() == s_aborted); @@ -958,7 +958,7 @@ void wsrep::transaction_context::cleanup() debug_log_state("cleanup_leave"); } -void wsrep::transaction_context::debug_log_state( +void wsrep::transaction::debug_log_state( const char* context) const { WSREP_TC_LOG_DEBUG( diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2f2b5e1..6c37933 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,8 +7,8 @@ add_executable(wsrep-lib_test test_utils.cpp id_test.cpp server_context_test.cpp - transaction_context_test.cpp - transaction_context_test_2pc.cpp + transaction_test.cpp + transaction_test_2pc.cpp wsrep-lib_test.cpp ) target_link_libraries(wsrep-lib_test wsrep-lib) diff --git a/test/client_state_fixture.hpp b/test/client_state_fixture.hpp index f8edeed..fd314f4 100644 --- a/test/client_state_fixture.hpp +++ b/test/client_state_fixture.hpp @@ -25,11 +25,11 @@ namespace BOOST_REQUIRE(cc.before_statement() == 0); // Verify initial state BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; struct replicating_client_fixture_async_rm @@ -44,11 +44,11 @@ namespace BOOST_REQUIRE(cc.before_statement() == 0); // Verify initial state BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; struct replicating_client_fixture_2pc @@ -64,11 +64,11 @@ namespace BOOST_REQUIRE(cc.before_statement() == 0); // Verify initial state BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; struct replicating_client_fixture_autocommit @@ -84,11 +84,11 @@ namespace BOOST_REQUIRE(cc.before_statement() == 0); // Verify initial state BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; struct applying_client_fixture @@ -116,7 +116,7 @@ namespace } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; struct applying_client_fixture_2pc @@ -145,7 +145,7 @@ namespace } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; struct streaming_client_fixture_row @@ -160,12 +160,12 @@ namespace BOOST_REQUIRE(cc.before_statement() == 0); // Verify initial state BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); cc.enable_streaming(wsrep::streaming_context::row, 1); } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; struct streaming_client_fixture_byte @@ -180,12 +180,12 @@ namespace BOOST_REQUIRE(cc.before_statement() == 0); // Verify initial state BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); cc.enable_streaming(wsrep::streaming_context::bytes, 1); } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; struct streaming_client_fixture_statement @@ -200,13 +200,13 @@ namespace BOOST_REQUIRE(cc.before_statement() == 0); // Verify initial state BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); cc.enable_streaming(wsrep::streaming_context::row, 1); } wsrep::mock_server_context sc; wsrep::mock_client_state cc; - const wsrep::transaction_context& tc; + const wsrep::transaction& tc; }; } #endif // WSREP_TEST_CLIENT_CONTEXT_FIXTURE_HPP diff --git a/test/mock_client_state.cpp b/test/mock_client_state.cpp index 654174d..2488304 100644 --- a/test/mock_client_state.cpp +++ b/test/mock_client_state.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2018 Codership Oy // -#include "wsrep/transaction_context.hpp" +#include "wsrep/transaction.hpp" #include "mock_client_state.hpp" @@ -11,8 +11,8 @@ int wsrep::mock_client_service::apply( const wsrep::const_buffer&) { - assert(client_state.transaction().state() == wsrep::transaction_context::s_executing || - client_state.transaction().state() == wsrep::transaction_context::s_replaying); + assert(client_state.transaction().state() == wsrep::transaction::s_executing || + client_state.transaction().state() == wsrep::transaction::s_replaying); return (fail_next_applying_ ? 1 : 0); } diff --git a/test/mock_client_state.hpp b/test/mock_client_state.hpp index 6d888e7..694aa11 100644 --- a/test/mock_client_state.hpp +++ b/test/mock_client_state.hpp @@ -76,17 +76,17 @@ namespace wsrep void reset_globals() WSREP_OVERRIDE { } void emergency_shutdown() WSREP_OVERRIDE { ++aborts_; } - int append_fragment(const wsrep::transaction_context&, + int append_fragment(const wsrep::transaction&, int, const wsrep::const_buffer&) WSREP_OVERRIDE { return 0; } - void remove_fragments(const wsrep::transaction_context& ) + void remove_fragments(const wsrep::transaction& ) WSREP_OVERRIDE { } - void will_replay(const wsrep::transaction_context&) + void will_replay(const wsrep::transaction&) WSREP_OVERRIDE { } enum wsrep::provider::status replay(wsrep::client_state& client_state, - wsrep::transaction_context& tc) WSREP_OVERRIDE + wsrep::transaction& tc) WSREP_OVERRIDE { enum wsrep::provider::status ret( provider_.replay(tc.ws_handle(), &client_state)); @@ -109,7 +109,7 @@ namespace wsrep int prepare_data_for_replication( wsrep::client_state& client_state, - const wsrep::transaction_context&) WSREP_OVERRIDE + const wsrep::transaction&) WSREP_OVERRIDE { if (error_during_prepare_data_) { @@ -127,7 +127,7 @@ namespace wsrep int prepare_fragment_for_replication( wsrep::client_state& client_state, - const wsrep::transaction_context&, + const wsrep::transaction&, wsrep::mutable_buffer& buffer) WSREP_OVERRIDE { diff --git a/test/mock_provider.hpp b/test/mock_provider.hpp index d089405..7040be9 100644 --- a/test/mock_provider.hpp +++ b/test/mock_provider.hpp @@ -157,7 +157,7 @@ namespace wsrep wsrep::client_state& cc( *static_cast(ctx)); wsrep::high_priority_context high_priority_context(cc); - const wsrep::transaction_context& tc(cc.transaction()); + const wsrep::transaction& 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 545bde3..1511942 100644 --- a/test/mock_server_context.hpp +++ b/test/mock_server_context.hpp @@ -67,8 +67,8 @@ namespace wsrep client_state.after_rollback(); } // void sst_received(const wsrep_gtid_t&, int) WSREP_OVERRIDE { } - // void on_apply(wsrep::transaction_context&) { } - // void on_commit(wsrep::transaction_context&) { } + // void on_apply(wsrep::transaction&) { } + // void on_commit(wsrep::transaction&) { } wsrep::mock_client_service& client_service() { return client_service_; diff --git a/test/server_context_test.cpp b/test/server_context_test.cpp index 87f34e1..9bd9301 100644 --- a/test/server_context_test.cpp +++ b/test/server_context_test.cpp @@ -38,10 +38,10 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_1pc, char buf[1] = { 1 }; BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 0); - const wsrep::transaction_context& txc(cc.transaction()); + const wsrep::transaction& txc(cc.transaction()); // ::abort(); BOOST_REQUIRE_MESSAGE( - txc.state() == wsrep::transaction_context::s_committed, + txc.state() == wsrep::transaction::s_committed, "Transaction state " << txc.state() << " not committed"); } @@ -52,8 +52,8 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_2pc, char buf[1] = { 1 }; BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 0); - const wsrep::transaction_context& txc(cc.transaction()); - BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_committed); + const wsrep::transaction& txc(cc.transaction()); + BOOST_REQUIRE(txc.state() == wsrep::transaction::s_committed); } // Test on_apply() method for 1pc transaction which @@ -65,8 +65,8 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_1pc_rollback, char buf[1] = { 1 }; BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 1); - const wsrep::transaction_context& txc(cc.transaction()); - BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); + const wsrep::transaction& txc(cc.transaction()); + BOOST_REQUIRE(txc.state() == wsrep::transaction::s_aborted); } // Test on_apply() method for 2pc transaction which @@ -78,8 +78,8 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_2pc_rollback, char buf[1] = { 1 }; BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, wsrep::const_buffer(buf, 1)) == 1); - const wsrep::transaction_context& txc(cc.transaction()); - BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); + const wsrep::transaction& txc(cc.transaction()); + BOOST_REQUIRE(txc.state() == wsrep::transaction::s_aborted); } BOOST_AUTO_TEST_CASE(server_context_streaming) diff --git a/test/test_utils.cpp b/test/test_utils.cpp index f1ceeab..a9d909c 100644 --- a/test/test_utils.cpp +++ b/test/test_utils.cpp @@ -21,7 +21,7 @@ void wsrep_test::bf_abort_ordered(wsrep::client_state& cc) } // BF abort method to abort transactions via provider void wsrep_test::bf_abort_provider(wsrep::mock_server_context& sc, - const wsrep::transaction_context& tc, + const wsrep::transaction& tc, wsrep::seqno bf_seqno) { wsrep::seqno victim_seqno; diff --git a/test/test_utils.hpp b/test/test_utils.hpp index 8d3780a..81f9f76 100644 --- a/test/test_utils.hpp +++ b/test/test_utils.hpp @@ -9,7 +9,7 @@ namespace wsrep class mock_server_context; } -#include "wsrep/transaction_context.hpp" +#include "wsrep/transaction.hpp" #include "wsrep/provider.hpp" // @@ -26,7 +26,7 @@ namespace wsrep_test // BF abort method to abort transactions via provider void bf_abort_provider(wsrep::mock_server_context& sc, - const wsrep::transaction_context& tc, + const wsrep::transaction& tc, wsrep::seqno bf_seqno); } diff --git a/test/transaction_context_test.cpp b/test/transaction_test.cpp similarity index 75% rename from test/transaction_context_test.cpp rename to test/transaction_test.cpp index 209965d..4056dd6 100644 --- a/test/transaction_context_test.cpp +++ b/test/transaction_test.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2018 Codership Oy // -#include "wsrep/transaction_context.hpp" +#include "wsrep/transaction.hpp" #include "wsrep/provider.hpp" #include "test_utils.hpp" @@ -18,7 +18,7 @@ namespace replicating_fixtures; } -BOOST_FIXTURE_TEST_CASE(transaction_context_append_key_data, +BOOST_FIXTURE_TEST_CASE(transaction_append_key_data, replicating_client_fixture_sync_rm) { cc.start_transaction(1); @@ -40,16 +40,16 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_append_key_data, // // Test a succesful 1PC transaction lifecycle // -BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_1pc, T, +BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc, T, replicating_fixtures, T) { wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); // Verify that the commit can be succesfully executed in separate command BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success); @@ -60,15 +60,15 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_1pc, T, BOOST_REQUIRE(cc.before_statement() == 0); // Run before commit BOOST_REQUIRE(cc.before_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); // Run ordered commit BOOST_REQUIRE(cc.ordered_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_ordered_commit); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_ordered_commit); // Run after commit BOOST_REQUIRE(cc.after_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed); // Cleanup after statement cc.after_statement(); @@ -82,25 +82,25 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_1pc, T, // // Test a voluntary rollback // -BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_rollback, T, +BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_rollback, T, replicating_fixtures, T) { wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); // Run before commit BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); // Run after commit BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -114,31 +114,31 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_rollback, T, // Test a 1PC transaction which gets BF aborted before before_commit // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_before_before_commit, T, + transaction_1pc_bf_before_before_commit, T, replicating_fixtures, T) { wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); wsrep_test::bf_abort_unordered(cc); // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -155,32 +155,32 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // provider before the write set was ordered and certified. // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_during_before_commit_uncertified, T, + transaction_1pc_bf_during_before_commit_uncertified, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); wsrep_test::bf_abort_provider(sc, tc, wsrep::seqno::undefined()); // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_cert_failed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_cert_failed); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -195,32 +195,32 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // when waiting for replayers // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_during_commit_wait_for_replayers, T, + transaction_1pc_bf_during_commit_wait_for_replayers, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::mock_client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.client_service().bf_abort_during_wait_ = true; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -234,33 +234,33 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction for which prepare data fails // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_error_during_prepare_data, T, + transaction_1pc_error_during_prepare_data, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::mock_client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.client_service().error_during_prepare_data_ = true; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(cc.current_error() == wsrep::e_error_during_commit); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -274,33 +274,33 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction which gets killed by DBMS before certification // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_killed_before_certify, T, + transaction_1pc_killed_before_certify, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::mock_client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.client_service().killed_before_certify_ = true; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(cc.current_error() == wsrep::e_interrupted_error); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -315,7 +315,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // certification result is known. Replaying will be successful // BOOST_FIXTURE_TEST_CASE( - transaction_context_bf_before_cert_result_replay_success, + transaction_bf_before_cert_result_replay_success, replicating_client_fixture_sync_rm) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -323,9 +323,9 @@ BOOST_FIXTURE_TEST_CASE( sc.provider().replay_result_ = wsrep::provider::success; BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_statement() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed); BOOST_REQUIRE(cc.current_error() == wsrep::e_success); } @@ -335,7 +335,7 @@ BOOST_FIXTURE_TEST_CASE( // certification failure. // BOOST_FIXTURE_TEST_CASE( - transaction_context_bf_before_cert_result_replay_cert_fail, + transaction_bf_before_cert_result_replay_cert_fail, replicating_client_fixture_sync_rm) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -343,9 +343,9 @@ BOOST_FIXTURE_TEST_CASE( sc.provider().replay_result_ = wsrep::provider::error_certification_failed; BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error); BOOST_REQUIRE(tc.active() == false); } @@ -356,32 +356,32 @@ BOOST_FIXTURE_TEST_CASE( // result replaying of transaction. // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_during_before_commit_certified, T, + transaction_1pc_bf_during_before_commit_certified, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::mock_client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); wsrep_test::bf_abort_provider(sc, tc, wsrep::seqno(1)); // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == true); // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); // Cleanup after statement cc.after_statement(); @@ -399,28 +399,28 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // should not generate seqno for write set meta. // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_before_unordered_cert_failure, T, + transaction_1pc_bf_before_unordered_cert_failure, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::mock_client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.client_service().sync_point_enabled_ = "wsrep_before_certification"; sc.client_service().sync_point_action_ = wsrep::mock_client_service::spa_bf_abort_unordered; sc.provider().certify_result_ = wsrep::provider::error_certification_failed; BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_cert_failed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_cert_failed); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -432,24 +432,24 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction which gets "warning error" from certify call // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_warning_error_from_certify, T, + transaction_1pc_warning_error_from_certify, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.provider().certify_result_ = wsrep::provider::error_warning; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -457,9 +457,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -473,24 +473,24 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction which gets transaction missing from certify call // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_transaction_missing_from_certify, T, + transaction_1pc_transaction_missing_from_certify, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.provider().certify_result_ = wsrep::provider::error_transaction_missing; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -498,9 +498,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -514,24 +514,24 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction which gets size exceeded error from certify call // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_size_exceeded_from_certify, T, + transaction_1pc_size_exceeded_from_certify, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.provider().certify_result_ = wsrep::provider::error_size_exceeded; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -539,9 +539,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -555,24 +555,24 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction which gets connection failed error from certify call // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_connection_failed_from_certify, T, + transaction_1pc_connection_failed_from_certify, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.provider().certify_result_ = wsrep::provider::error_connection_failed; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -580,9 +580,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -596,24 +596,24 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction which gets not allowed error from certify call // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_no_allowed_from_certify, T, + transaction_1pc_no_allowed_from_certify, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.provider().certify_result_ = wsrep::provider::error_not_allowed; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -621,9 +621,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -637,24 +637,24 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction which gets fatal error from certify call // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_fatal_from_certify, T, + transaction_1pc_fatal_from_certify, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::mock_client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.provider().certify_result_ = wsrep::provider::error_fatal; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -662,9 +662,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -679,24 +679,24 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a 1PC transaction which gets unknown from certify call // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_unknown_from_certify, T, + transaction_1pc_unknown_from_certify, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::mock_client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.provider().certify_result_ = wsrep::provider::error_unknown; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -704,9 +704,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); // Cleanup after statement cc.after_statement(); @@ -721,32 +721,32 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // after certify call // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_abort_before_certify_regain_lock, T, + transaction_1pc_bf_abort_before_certify_regain_lock, T, replicating_fixtures, T) { wsrep::mock_server_context& sc(T::sc); wsrep::mock_client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); sc.client_service().sync_point_enabled_ = "wsrep_after_certification"; sc.client_service().sync_point_action_ = wsrep::mock_client_service::spa_bf_abort_ordered; // Run before commit BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(tc.certified() == true); BOOST_REQUIRE(tc.ordered() == true); // Rollback sequence BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); // Cleanup after statement cc.after_statement(); @@ -763,49 +763,49 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // Test a transaction which gets BF aborted before before_statement. // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_before_before_statement, T, + transaction_1pc_bf_before_before_statement, T, replicating_fixtures, T) { wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); cc.after_statement(); cc.after_command_before_result(); cc.after_command_after_result(); BOOST_REQUIRE(cc.before_command() == 0); BOOST_REQUIRE(tc.active()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); wsrep_test::bf_abort_unordered(cc); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(cc.before_statement() == 1); BOOST_REQUIRE(tc.active()); cc.after_command_before_result(); BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error); cc.after_command_after_result(); BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); } // // Test a transaction which gets BF aborted before after_statement. // BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_before_after_statement, T, + transaction_1pc_bf_before_after_statement, T, replicating_fixtures, T) { wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); // Start a new transaction with ID 1 cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); wsrep_test::bf_abort_unordered(cc); @@ -817,11 +817,11 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( } BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_abort_after_after_statement, T, + transaction_1pc_bf_abort_after_after_statement, T, replicating_fixtures, T) { wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); cc.start_transaction(1); BOOST_REQUIRE(tc.active()); @@ -830,19 +830,19 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( wsrep_test::bf_abort_unordered(cc); BOOST_REQUIRE(cc.current_error() == wsrep::e_success); BOOST_REQUIRE(tc.active()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); cc.after_command_before_result(); BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error); BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); cc.after_command_after_result(); BOOST_REQUIRE(cc.current_error() == wsrep::e_success); BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); } BOOST_FIXTURE_TEST_CASE( - transaction_context_1pc_autocommit_retry_bf_aborted, + transaction_1pc_autocommit_retry_bf_aborted, replicating_client_fixture_autocommit) { @@ -855,16 +855,16 @@ BOOST_FIXTURE_TEST_CASE( BOOST_REQUIRE(cc.after_rollback() == 0); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_may_retry); BOOST_REQUIRE(tc.active() == false); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec); } BOOST_FIXTURE_TEST_CASE_TEMPLATE( - transaction_context_1pc_bf_abort_after_after_command_before_result, T, + transaction_1pc_bf_abort_after_after_command_before_result, T, replicating_fixtures, T) { wsrep::client_state& cc(T::cc); - const wsrep::transaction_context& tc(T::tc); + const wsrep::transaction& tc(T::tc); cc.start_transaction(1); BOOST_REQUIRE(tc.active()); @@ -877,7 +877,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( // The result is being sent to client. We need to mark transaction // as must_abort but not override error yet as this might cause // a race condition resulting incorrect result returned to the DBMS client. - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(cc.current_error() == wsrep::e_success); // After the result has been sent to the DBMS client, the after result // processing should roll back the transaction and set the error. @@ -885,7 +885,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( BOOST_REQUIRE(cc.state() == wsrep::client_state::s_idle); BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error); BOOST_REQUIRE(tc.active() == true); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(cc.before_command() == 1); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error); @@ -896,7 +896,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE( } BOOST_FIXTURE_TEST_CASE( - transaction_context_1pc_bf_abort_after_after_command_after_result_sync_rm, + transaction_1pc_bf_abort_after_after_command_after_result_sync_rm, replicating_client_fixture_sync_rm) { cc.start_transaction(1); @@ -908,7 +908,7 @@ BOOST_FIXTURE_TEST_CASE( cc.after_command_after_result(); BOOST_REQUIRE(cc.state() == wsrep::client_state::s_idle); wsrep_test::bf_abort_unordered(cc); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(cc.before_command() == 1); BOOST_REQUIRE(tc.active() == false); @@ -921,7 +921,7 @@ BOOST_FIXTURE_TEST_CASE( } BOOST_FIXTURE_TEST_CASE( - transaction_context_1pc_bf_abort_after_after_command_after_result_async_rm, + transaction_1pc_bf_abort_after_after_command_after_result_async_rm, replicating_client_fixture_async_rm) { cc.start_transaction(1); @@ -933,7 +933,7 @@ BOOST_FIXTURE_TEST_CASE( cc.after_command_after_result(); BOOST_REQUIRE(cc.state() == wsrep::client_state::s_idle); wsrep_test::bf_abort_unordered(cc); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(cc.before_command() == 1); BOOST_REQUIRE(tc.active() == false); @@ -945,31 +945,31 @@ BOOST_FIXTURE_TEST_CASE( BOOST_REQUIRE(tc.active() == false); } -BOOST_FIXTURE_TEST_CASE(transaction_context_1pc_applying, +BOOST_FIXTURE_TEST_CASE(transaction_1pc_applying, applying_client_fixture) { BOOST_REQUIRE(cc.before_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); BOOST_REQUIRE(cc.ordered_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_ordered_commit); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_ordered_commit); BOOST_REQUIRE(cc.after_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed); cc.after_statement(); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(cc.current_error() == wsrep::e_success); } -BOOST_FIXTURE_TEST_CASE(transaction_context_applying_rollback, +BOOST_FIXTURE_TEST_CASE(transaction_applying_rollback, applying_client_fixture) { BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); cc.after_statement(); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(cc.current_error() == wsrep::e_success); } @@ -981,7 +981,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_applying_rollback, // // Test 1PC with row streaming with one row // -BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_1pc_commit, +BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_1pc_commit, streaming_client_fixture_row) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -999,7 +999,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_1pc_commit, // // Test 1PC with row streaming with one row // -BOOST_FIXTURE_TEST_CASE(transaction_context_row_batch_streaming_1pc_commit, +BOOST_FIXTURE_TEST_CASE(transaction_row_batch_streaming_1pc_commit, streaming_client_fixture_row) { BOOST_REQUIRE(cc.enable_streaming( @@ -1022,7 +1022,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_batch_streaming_1pc_commit, // Test 1PC row streaming with two separate statements // BOOST_FIXTURE_TEST_CASE( - transaction_context_row_streaming_1pc_commit_two_statements, + transaction_row_streaming_1pc_commit_two_statements, streaming_client_fixture_row) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -1044,7 +1044,7 @@ BOOST_FIXTURE_TEST_CASE( // // Test streaming rollback // -BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_rollback, +BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_rollback, streaming_client_fixture_row) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -1061,7 +1061,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_rollback, // // Test streaming certification failure during fragment replication // -BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_cert_fail_non_commit, +BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_non_commit, streaming_client_fixture_row) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -1081,7 +1081,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_cert_fail_non_commit, // // Test streaming certification failure during commit // -BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_cert_fail_commit, +BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_commit, streaming_client_fixture_row) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -1089,12 +1089,12 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_cert_fail_commit, BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1); sc.provider().certify_result_ = wsrep::provider::error_certification_failed; BOOST_REQUIRE(cc.before_commit() == 1); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_cert_failed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_cert_failed); sc.provider().certify_result_ = wsrep::provider::success; BOOST_REQUIRE(cc.before_rollback() == 0); BOOST_REQUIRE(cc.after_rollback() == 0); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(sc.provider().fragments() == 2); BOOST_REQUIRE(sc.provider().start_fragments() == 1); BOOST_REQUIRE(sc.provider().rollback_fragments() == 1); @@ -1103,21 +1103,21 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_cert_fail_commit, // // Test streaming BF abort after succesful certification // -BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_bf_abort_committing, +BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_bf_abort_committing, streaming_client_fixture_row) { BOOST_REQUIRE(cc.start_transaction(1) == 0); BOOST_REQUIRE(cc.after_row() == 0); BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1); BOOST_REQUIRE(cc.before_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); wsrep_test::bf_abort_ordered(cc); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(cc.before_rollback() == 0); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed); BOOST_REQUIRE(sc.provider().fragments() == 2); BOOST_REQUIRE(sc.provider().start_fragments() == 1); BOOST_REQUIRE(sc.provider().commit_fragments() == 1); @@ -1125,7 +1125,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_bf_abort_committing, -BOOST_FIXTURE_TEST_CASE(transaction_context_byte_streaming_1pc_commit, +BOOST_FIXTURE_TEST_CASE(transaction_byte_streaming_1pc_commit, streaming_client_fixture_byte) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -1141,7 +1141,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_byte_streaming_1pc_commit, BOOST_REQUIRE(sc.provider().commit_fragments() == 1); } -BOOST_FIXTURE_TEST_CASE(transaction_context_byte_batch_streaming_1pc_commit, +BOOST_FIXTURE_TEST_CASE(transaction_byte_batch_streaming_1pc_commit, streaming_client_fixture_byte) { BOOST_REQUIRE( @@ -1164,7 +1164,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_byte_batch_streaming_1pc_commit, } -BOOST_FIXTURE_TEST_CASE(transaction_context_statement_streaming_1pc_commit, +BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_1pc_commit, streaming_client_fixture_statement) { BOOST_REQUIRE( @@ -1185,7 +1185,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_statement_streaming_1pc_commit, BOOST_REQUIRE(sc.provider().commit_fragments() == 1); } -BOOST_FIXTURE_TEST_CASE(transaction_context_statement_batch_streaming_1pc_commit, +BOOST_FIXTURE_TEST_CASE(transaction_statement_batch_streaming_1pc_commit, streaming_client_fixture_statement) { BOOST_REQUIRE( @@ -1211,7 +1211,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_statement_batch_streaming_1pc_commit BOOST_REQUIRE(sc.provider().commit_fragments() == 1); } -BOOST_FIXTURE_TEST_CASE(transaction_context_statement_streaming_cert_fail, +BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_cert_fail, streaming_client_fixture_row) { BOOST_REQUIRE( @@ -1232,44 +1232,44 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_statement_streaming_cert_fail, // misc // /////////////////////////////////////////////////////////////////////////////// -BOOST_AUTO_TEST_CASE(transaction_context_state_strings) +BOOST_AUTO_TEST_CASE(transaction_state_strings) { BOOST_REQUIRE(wsrep::to_string( - wsrep::transaction_context::s_executing) == "executing"); + wsrep::transaction::s_executing) == "executing"); BOOST_REQUIRE(wsrep::to_string( - wsrep::transaction_context::s_preparing) == "preparing"); + wsrep::transaction::s_preparing) == "preparing"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_certifying) == "certifying"); + wsrep::transaction::s_certifying) == "certifying"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_committing) == "committing"); + wsrep::transaction::s_committing) == "committing"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_ordered_commit) == "ordered_commit"); + wsrep::transaction::s_ordered_commit) == "ordered_commit"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_committed) == "committed"); + wsrep::transaction::s_committed) == "committed"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_cert_failed) == "cert_failed"); + wsrep::transaction::s_cert_failed) == "cert_failed"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_must_abort) == "must_abort"); + wsrep::transaction::s_must_abort) == "must_abort"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_aborting) == "aborting"); + wsrep::transaction::s_aborting) == "aborting"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_aborted) == "aborted"); + wsrep::transaction::s_aborted) == "aborted"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_must_replay) == "must_replay"); + wsrep::transaction::s_must_replay) == "must_replay"); BOOST_REQUIRE( wsrep::to_string( - wsrep::transaction_context::s_replaying) == "replaying"); + wsrep::transaction::s_replaying) == "replaying"); BOOST_REQUIRE( wsrep::to_string( - static_cast(0xff)) == "unknown"); + static_cast(0xff)) == "unknown"); } diff --git a/test/transaction_context_test_2pc.cpp b/test/transaction_test_2pc.cpp similarity index 70% rename from test/transaction_context_test_2pc.cpp rename to test/transaction_test_2pc.cpp index 88014d3..0d0299d 100644 --- a/test/transaction_context_test_2pc.cpp +++ b/test/transaction_test_2pc.cpp @@ -7,23 +7,23 @@ // // Test a succesful 2PC transaction lifecycle // -BOOST_FIXTURE_TEST_CASE(transaction_context_2pc, +BOOST_FIXTURE_TEST_CASE(transaction_2pc, replicating_client_fixture_2pc) { cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); BOOST_REQUIRE(cc.before_prepare() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_preparing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_preparing); BOOST_REQUIRE(cc.after_prepare() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); BOOST_REQUIRE(cc.before_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); BOOST_REQUIRE(cc.ordered_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_ordered_commit); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_ordered_commit); BOOST_REQUIRE(cc.after_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -35,22 +35,22 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_2pc, // Test a 2PC transaction which gets BF aborted before before_prepare // BOOST_FIXTURE_TEST_CASE( - transaction_context_2pc_bf_before_before_prepare, + transaction_2pc_bf_before_before_prepare, replicating_client_fixture_2pc) { cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); wsrep_test::bf_abort_unordered(cc); BOOST_REQUIRE(cc.before_prepare()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -62,24 +62,24 @@ BOOST_FIXTURE_TEST_CASE( // Test a 2PC transaction which gets BF aborted before before_prepare // BOOST_FIXTURE_TEST_CASE( - transaction_context_2pc_bf_before_after_prepare, + transaction_2pc_bf_before_after_prepare, replicating_client_fixture_2pc) { cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); BOOST_REQUIRE(cc.before_prepare() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_preparing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_preparing); wsrep_test::bf_abort_unordered(cc); BOOST_REQUIRE(cc.after_prepare()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(tc.certified() == false); BOOST_REQUIRE(tc.ordered() == false); BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -92,22 +92,22 @@ BOOST_FIXTURE_TEST_CASE( // the rollback takes place before entering before_commit(). // BOOST_FIXTURE_TEST_CASE( - transaction_context_2pc_bf_after_after_prepare, + transaction_2pc_bf_after_after_prepare, replicating_client_fixture_2pc) { cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); BOOST_REQUIRE(cc.before_prepare() == 0); BOOST_REQUIRE(cc.after_prepare() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); wsrep_test::bf_abort_ordered(cc); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -120,26 +120,26 @@ BOOST_FIXTURE_TEST_CASE( // and before_commit() // BOOST_FIXTURE_TEST_CASE( - transaction_context_2pc_bf_before_before_commit, + transaction_2pc_bf_before_before_commit, replicating_client_fixture_2pc) { cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); BOOST_REQUIRE(cc.before_prepare() == 0); BOOST_REQUIRE(cc.after_prepare() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); wsrep_test::bf_abort_ordered(cc); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_abort); BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(tc.certified() == true); BOOST_REQUIRE(tc.ordered() == true); BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -153,25 +153,25 @@ BOOST_FIXTURE_TEST_CASE( // commit order. // BOOST_FIXTURE_TEST_CASE( - transaction_context_2pc_bf_during_commit_order_enter, + transaction_2pc_bf_during_commit_order_enter, replicating_client_fixture_2pc) { cc.start_transaction(1); BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing); BOOST_REQUIRE(cc.before_prepare() == 0); BOOST_REQUIRE(cc.after_prepare() == 0); sc.provider().commit_order_enter_result_ = wsrep::provider::error_bf_abort; BOOST_REQUIRE(cc.before_commit()); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(tc.certified() == true); BOOST_REQUIRE(tc.ordered() == true); sc.provider().commit_order_enter_result_ = wsrep::provider::success; BOOST_REQUIRE(cc.before_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_rollback() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.ordered() == false); @@ -184,7 +184,7 @@ BOOST_FIXTURE_TEST_CASE( /////////////////////////////////////////////////////////////////////////////// -BOOST_FIXTURE_TEST_CASE(transaction_context_streaming_2pc_commit, +BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit, streaming_client_fixture_row) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -201,7 +201,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_streaming_2pc_commit, BOOST_REQUIRE(sc.provider().commit_fragments() == 1); } -BOOST_FIXTURE_TEST_CASE(transaction_context_streaming_2pc_commit_two_statements, +BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit_two_statements, streaming_client_fixture_row) { BOOST_REQUIRE(cc.start_transaction(1) == 0); @@ -226,21 +226,21 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_streaming_2pc_commit_two_statements, // APPLYING // /////////////////////////////////////////////////////////////////////////////// -BOOST_FIXTURE_TEST_CASE(transaction_context_2pc_applying, +BOOST_FIXTURE_TEST_CASE(transaction_2pc_applying, applying_client_fixture_2pc) { BOOST_REQUIRE(cc.before_prepare() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_preparing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_preparing); BOOST_REQUIRE(cc.after_prepare() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); BOOST_REQUIRE(cc.before_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committing); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committing); BOOST_REQUIRE(cc.ordered_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_ordered_commit); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_ordered_commit); BOOST_REQUIRE(cc.after_commit() == 0); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed); BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success); - BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed); BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(cc.current_error() == wsrep::e_success); }