1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-28 20:02:00 +03:00

Renamed transcation_context to transaction

This commit is contained in:
Teemu Ollakka
2018-06-17 10:04:00 +03:00
parent dd28b173ab
commit 790c2bec4e
25 changed files with 382 additions and 382 deletions

View File

@ -57,7 +57,7 @@ int db::client::client_command(F f)
{ {
// wsrep::log_info() << "Current error"; // wsrep::log_info() << "Current error";
assert(client_state_.transaction().state() == assert(client_state_.transaction().state() ==
wsrep::transaction_context::s_aborted); wsrep::transaction::s_aborted);
err = 1; err = 1;
} }
client_state_.after_command_after_result(); client_state_.after_command_after_result();
@ -79,7 +79,7 @@ void db::client::run_one_transaction()
return err; return err;
}); });
const wsrep::transaction_context& transaction( const wsrep::transaction& transaction(
client_state_.transaction()); client_state_.transaction());
err = err || client_command( err = err || client_command(
@ -125,17 +125,17 @@ void db::client::run_one_transaction()
}); });
assert(err || assert(err ||
transaction.state() == wsrep::transaction_context::s_aborted || transaction.state() == wsrep::transaction::s_aborted ||
transaction.state() == wsrep::transaction_context::s_committed); transaction.state() == wsrep::transaction::s_committed);
assert(se_trx_.active() == false); assert(se_trx_.active() == false);
assert(transaction.active() == false); assert(transaction.active() == false);
switch (transaction.state()) switch (transaction.state())
{ {
case wsrep::transaction_context::s_committed: case wsrep::transaction::s_committed:
++stats_.commits; ++stats_.commits;
break; break;
case wsrep::transaction_context::s_aborted: case wsrep::transaction::s_aborted:
++stats_.rollbacks; ++stats_.rollbacks;
break; break;
default: default:

View File

@ -38,10 +38,10 @@ int db::client_service::rollback(wsrep::client_state&)
} }
enum wsrep::provider::status enum wsrep::provider::status
db::client_service::replay(wsrep::client_state&, db::client_service::replay(wsrep::client_state&,
wsrep::transaction_context& transaction_context) wsrep::transaction& transaction)
{ {
wsrep::high_priority_context high_priority_context(client_state_); 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_)); &client_state_));
if (ret == wsrep::provider::success) if (ret == wsrep::provider::success)
{ {

View File

@ -6,7 +6,7 @@
#define WSREP_DB_CLIENT_SERVICE_HPP #define WSREP_DB_CLIENT_SERVICE_HPP
#include "wsrep/client_service.hpp" #include "wsrep/client_service.hpp"
#include "wsrep/transaction_context.hpp" #include "wsrep/transaction.hpp"
#include "db_client_state.hpp" #include "db_client_state.hpp"
@ -46,7 +46,7 @@ namespace db
client_state_.store_globals(); 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; return 0;
} }
@ -57,13 +57,13 @@ namespace db
} }
int prepare_fragment_for_replication(wsrep::client_state&, int prepare_fragment_for_replication(wsrep::client_state&,
const wsrep::transaction_context&, const wsrep::transaction&,
wsrep::mutable_buffer&) override wsrep::mutable_buffer&) override
{ {
return 0; 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; int apply(wsrep::client_state&, const wsrep::const_buffer&) override;
@ -73,16 +73,16 @@ namespace db
int rollback(wsrep::client_state&) override; 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&, void wait_for_replayers(wsrep::client_state&,
wsrep::unique_lock<wsrep::mutex>&) override { } wsrep::unique_lock<wsrep::mutex>&) override { }
enum wsrep::provider::status replay(wsrep::client_state&, enum wsrep::provider::status replay(wsrep::client_state&,
wsrep::transaction_context&) wsrep::transaction&)
override; override;
int append_fragment(const wsrep::transaction_context&, int, int append_fragment(const wsrep::transaction&, int,
const wsrep::const_buffer&) override const wsrep::const_buffer&) override
{ {
return 0; return 0;

View File

@ -16,10 +16,10 @@ void db::storage_engine::transaction::start(db::client* cc)
} }
void db::storage_engine::transaction::apply( void db::storage_engine::transaction::apply(
const wsrep::transaction_context& transaction_context) const wsrep::transaction& transaction)
{ {
assert(cc_); assert(cc_);
se_.bf_abort_some(transaction_context); se_.bf_abort_some(transaction);
} }
void db::storage_engine::transaction::commit() void db::storage_engine::transaction::commit()
@ -43,7 +43,7 @@ void db::storage_engine::transaction::rollback()
cc_ = nullptr; 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<wsrep::mutex> lock(mutex_); wsrep::unique_lock<wsrep::mutex> lock(mutex_);
if (alg_freq_ && (std::rand() % alg_freq_) == 0) if (alg_freq_ && (std::rand() % alg_freq_) == 0)

View File

@ -39,7 +39,7 @@ namespace db
} }
bool active() const { return cc_ != nullptr; } bool active() const { return cc_ != nullptr; }
void start(client* cc); void start(client* cc);
void apply(const wsrep::transaction_context&); void apply(const wsrep::transaction&);
void commit(); void commit();
void rollback(); void rollback();
db::client* client() { return cc_; } db::client* client() { return cc_; }
@ -49,7 +49,7 @@ namespace db
db::storage_engine& se_; db::storage_engine& se_;
db::client* cc_; 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_; } long long bf_aborts() const { return bf_aborts_; }
private: private:
wsrep::default_mutex mutex_; wsrep::default_mutex mutex_;

View File

@ -21,7 +21,7 @@
namespace wsrep namespace wsrep
{ {
class transaction_context; class transaction;
class client_state; class client_state;
class client_service class client_service
{ {
@ -60,15 +60,15 @@ namespace wsrep
/** /**
* Set up a data for replication. * 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 // Streaming
// //
virtual size_t bytes_generated() const = 0; virtual size_t bytes_generated() const = 0;
virtual int prepare_fragment_for_replication( virtual int prepare_fragment_for_replication(
wsrep::client_state&, const wsrep::transaction_context&, wsrep::mutable_buffer&) = 0; wsrep::client_state&, const wsrep::transaction&, wsrep::mutable_buffer&) = 0;
virtual void remove_fragments(const wsrep::transaction_context&) = 0; virtual void remove_fragments(const wsrep::transaction&) = 0;
// //
// Applying interface // Applying interface
@ -109,7 +109,7 @@ namespace wsrep
* @todo This should not be visible to DBMS level, should be * @todo This should not be visible to DBMS level, should be
* handled internally by wsrep-lib. * 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 * Replay the current transaction. The implementation must put
@ -121,7 +121,7 @@ namespace wsrep
*/ */
virtual enum wsrep::provider::status replay( virtual enum wsrep::provider::status replay(
wsrep::client_state&, wsrep::client_state&,
wsrep::transaction_context&) = 0; wsrep::transaction&) = 0;
/** /**
* Wait until all replaying transactions have been finished * Wait until all replaying transactions have been finished
@ -136,7 +136,7 @@ namespace wsrep
/** /**
* Append a write set fragment into fragment storage. * 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 // Debug interface

View File

@ -40,7 +40,7 @@
#include "server_context.hpp" #include "server_context.hpp"
#include "provider.hpp" #include "provider.hpp"
#include "transaction_context.hpp" #include "transaction.hpp"
#include "client_id.hpp" #include "client_id.hpp"
#include "client_service.hpp" #include "client_service.hpp"
#include "mutex.hpp" #include "mutex.hpp"
@ -249,7 +249,7 @@ namespace wsrep
return transaction_.append_data(data); 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); return client_service_.prepare_data_for_replication(*this, tc);
} }
@ -291,14 +291,14 @@ namespace wsrep
} }
int prepare_fragment_for_replication( int prepare_fragment_for_replication(
const wsrep::transaction_context& tc, const wsrep::transaction& tc,
wsrep::mutable_buffer& mb) wsrep::mutable_buffer& mb)
{ {
return client_service_.prepare_fragment_for_replication( return client_service_.prepare_fragment_for_replication(
*this, tc, mb); *this, tc, mb);
} }
int append_fragment(const wsrep::transaction_context& tc, int append_fragment(const wsrep::transaction& tc,
int flags, int flags,
const wsrep::const_buffer& buf) const wsrep::const_buffer& buf)
{ {
@ -415,7 +415,7 @@ namespace wsrep
return transaction_.start_replaying(ws_meta); return transaction_.start_replaying(ws_meta);
} }
void adopt_transaction(wsrep::transaction_context& transaction) void adopt_transaction(wsrep::transaction& transaction)
{ {
assert(mode_ == m_high_priority); assert(mode_ == m_high_priority);
transaction_.start_transaction(transaction.id()); transaction_.start_transaction(transaction.id());
@ -423,7 +423,7 @@ namespace wsrep
} }
enum wsrep::provider::status replay( enum wsrep::provider::status replay(
wsrep::transaction_context& tc) wsrep::transaction& tc)
{ {
return client_service_.replay(*this, 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); client_service_.will_replay(tc);
} }
@ -512,7 +512,7 @@ namespace wsrep
*/ */
enum state state() const { return state_; } enum state state() const { return state_; }
const wsrep::transaction_context& transaction() const const wsrep::transaction& transaction() const
{ {
return transaction_; return transaction_;
} }
@ -563,7 +563,7 @@ namespace wsrep
friend class client_state_switch; friend class client_state_switch;
friend class high_priority_context; friend class high_priority_context;
friend class client_toi_mode; friend class client_toi_mode;
friend class transaction_context; friend class transaction;
void debug_log_state(const char*) const; void debug_log_state(const char*) const;
/** /**
@ -581,7 +581,7 @@ namespace wsrep
enum mode mode_; enum mode mode_;
enum state state_; enum state state_;
protected: protected:
wsrep::transaction_context transaction_; wsrep::transaction transaction_;
private: private:
/** /**
* @todo This boolean should be converted to better read isolation * @todo This boolean should be converted to better read isolation

View File

@ -76,7 +76,7 @@ namespace wsrep
class provider; class provider;
class client_state; class client_state;
class transaction_id; class transaction_id;
class transaction_context; class transaction;
class id; class id;
class gtid; class gtid;
class view; class view;
@ -365,7 +365,7 @@ namespace wsrep
* @todo Make this private, allow calls for provider implementations * @todo Make this private, allow calls for provider implementations
* only. * only.
* @param client_state Applier client context. * @param client_state Applier client context.
* @param transaction_context Transaction context. * @param transaction Transaction context.
* @param data Write set data * @param data Write set data
* *
* @return Zero on success, non-zero on failure. * @return Zero on success, non-zero on failure.
@ -385,7 +385,7 @@ namespace wsrep
*/ */
virtual bool statement_allowed_for_streaming( virtual bool statement_allowed_for_streaming(
const wsrep::client_state& client_state, 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; } void debug_log_level(int level) { debug_log_level_ = level; }
int debug_log_level() const { return debug_log_level_; } int debug_log_level() const { return debug_log_level_; }

View File

@ -21,7 +21,7 @@ namespace wsrep
class const_buffer; class const_buffer;
class transaction_context class transaction
{ {
public: public:
enum state enum state
@ -43,8 +43,8 @@ namespace wsrep
enum state state() const enum state state() const
{ return state_; } { return state_; }
transaction_context(wsrep::client_state& client_state); transaction(wsrep::client_state& client_state);
~transaction_context(); ~transaction();
// Accessors // Accessors
wsrep::transaction_id id() const wsrep::transaction_id id() const
{ return id_; } { return id_; }
@ -124,8 +124,8 @@ namespace wsrep
const wsrep::ws_handle& ws_handle() const { return ws_handle_; } const wsrep::ws_handle& ws_handle() const { return ws_handle_; }
const wsrep::ws_meta& ws_meta() const { return ws_meta_; } const wsrep::ws_meta& ws_meta() const { return ws_meta_; }
private: private:
transaction_context(const transaction_context&); transaction(const transaction&);
transaction_context operator=(const transaction_context&); transaction operator=(const transaction&);
void flags(int flags) { flags_ = flags; } void flags(int flags) { flags_ = flags; }
int certify_fragment(wsrep::unique_lock<wsrep::mutex>&); int certify_fragment(wsrep::unique_lock<wsrep::mutex>&);
@ -151,22 +151,22 @@ namespace wsrep
wsrep::streaming_context streaming_context_; 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) switch (state)
{ {
case wsrep::transaction_context::s_executing: return "executing"; case wsrep::transaction::s_executing: return "executing";
case wsrep::transaction_context::s_preparing: return "preparing"; case wsrep::transaction::s_preparing: return "preparing";
case wsrep::transaction_context::s_certifying: return "certifying"; case wsrep::transaction::s_certifying: return "certifying";
case wsrep::transaction_context::s_committing: return "committing"; case wsrep::transaction::s_committing: return "committing";
case wsrep::transaction_context::s_ordered_commit: return "ordered_commit"; case wsrep::transaction::s_ordered_commit: return "ordered_commit";
case wsrep::transaction_context::s_committed: return "committed"; case wsrep::transaction::s_committed: return "committed";
case wsrep::transaction_context::s_cert_failed: return "cert_failed"; case wsrep::transaction::s_cert_failed: return "cert_failed";
case wsrep::transaction_context::s_must_abort: return "must_abort"; case wsrep::transaction::s_must_abort: return "must_abort";
case wsrep::transaction_context::s_aborting: return "aborting"; case wsrep::transaction::s_aborting: return "aborting";
case wsrep::transaction_context::s_aborted: return "aborted"; case wsrep::transaction::s_aborted: return "aborted";
case wsrep::transaction_context::s_must_replay: return "must_replay"; case wsrep::transaction::s_must_replay: return "must_replay";
case wsrep::transaction_context::s_replaying: return "replaying"; case wsrep::transaction::s_replaying: return "replaying";
} }
return "unknown"; return "unknown";
} }

View File

@ -8,6 +8,6 @@ add_library(wsrep-lib
logger.cpp logger.cpp
provider.cpp provider.cpp
server_context.cpp server_context.cpp
transaction_context.cpp transaction.cpp
wsrep_provider_v26.cpp) wsrep_provider_v26.cpp)
target_link_libraries(wsrep-lib wsrep_api_v26 pthread dl) target_link_libraries(wsrep-lib wsrep_api_v26 pthread dl)

View File

@ -38,21 +38,21 @@ int wsrep::client_state::before_command()
* @todo Wait until the possible synchronous rollback * @todo Wait until the possible synchronous rollback
* has been finished. * has been finished.
*/ */
while (transaction_.state() == wsrep::transaction_context::s_aborting) while (transaction_.state() == wsrep::transaction::s_aborting)
{ {
// cond_.wait(lock); // cond_.wait(lock);
} }
} }
state(lock, s_exec); state(lock, s_exec);
assert(transaction_.active() == false || assert(transaction_.active() == false ||
(transaction_.state() == wsrep::transaction_context::s_executing || (transaction_.state() == wsrep::transaction::s_executing ||
transaction_.state() == wsrep::transaction_context::s_aborted || transaction_.state() == wsrep::transaction::s_aborted ||
(transaction_.state() == wsrep::transaction_context::s_must_abort && (transaction_.state() == wsrep::transaction::s_must_abort &&
server_context_.rollback_mode() == wsrep::server_context::rm_async))); server_context_.rollback_mode() == wsrep::server_context::rm_async)));
if (transaction_.active()) 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() == assert(server_context_.rollback_mode() ==
wsrep::server_context::rm_async); wsrep::server_context::rm_async);
@ -62,13 +62,13 @@ int wsrep::client_state::before_command()
(void)transaction_.after_statement(); (void)transaction_.after_statement();
lock.lock(); lock.lock();
assert(transaction_.state() == assert(transaction_.state() ==
wsrep::transaction_context::s_aborted); wsrep::transaction::s_aborted);
assert(transaction_.active() == false); assert(transaction_.active() == false);
assert(current_error() != wsrep::e_success); assert(current_error() != wsrep::e_success);
debug_log_state("before_command: error"); debug_log_state("before_command: error");
return 1; 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 // Transaction was rolled back either just before sending result
// to the client, or after client_state become idle. // 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"); debug_log_state("after_command_before_result: enter");
assert(state() == s_exec); assert(state() == s_exec);
if (transaction_.active() && if (transaction_.active() &&
transaction_.state() == wsrep::transaction_context::s_must_abort) transaction_.state() == wsrep::transaction::s_must_abort)
{ {
override_error(wsrep::e_deadlock_error); override_error(wsrep::e_deadlock_error);
lock.unlock(); lock.unlock();
client_service_.rollback(*this); client_service_.rollback(*this);
(void)transaction_.after_statement(); (void)transaction_.after_statement();
lock.lock(); lock.lock();
assert(transaction_.state() == wsrep::transaction_context::s_aborted); assert(transaction_.state() == wsrep::transaction::s_aborted);
assert(current_error() != wsrep::e_success); assert(current_error() != wsrep::e_success);
} }
state(lock, s_result); state(lock, s_result);
@ -111,14 +111,14 @@ void wsrep::client_state::after_command_after_result()
wsrep::unique_lock<wsrep::mutex> lock(mutex_); wsrep::unique_lock<wsrep::mutex> lock(mutex_);
debug_log_state("after_command_after_result_enter"); debug_log_state("after_command_after_result_enter");
assert(state() == s_result); assert(state() == s_result);
assert(transaction_.state() != wsrep::transaction_context::s_aborting); assert(transaction_.state() != wsrep::transaction::s_aborting);
if (transaction_.active() && if (transaction_.active() &&
transaction_.state() == wsrep::transaction_context::s_must_abort) transaction_.state() == wsrep::transaction::s_must_abort)
{ {
lock.unlock(); lock.unlock();
client_service_.rollback(*this); client_service_.rollback(*this);
lock.lock(); lock.lock();
assert(transaction_.state() == wsrep::transaction_context::s_aborted); assert(transaction_.state() == wsrep::transaction::s_aborted);
override_error(wsrep::e_deadlock_error); override_error(wsrep::e_deadlock_error);
} }
else if (transaction_.active() == false) else if (transaction_.active() == false)
@ -146,7 +146,7 @@ int wsrep::client_state::before_statement()
#endif // 0 #endif // 0
if (transaction_.active() && 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() // Rollback and cleanup will happen in after_command_before_result()
debug_log_state("before_statement_error"); debug_log_state("before_statement_error");

View File

@ -4,7 +4,7 @@
#include "wsrep/server_context.hpp" #include "wsrep/server_context.hpp"
#include "wsrep/client_state.hpp" #include "wsrep/client_state.hpp"
#include "wsrep/transaction_context.hpp" #include "wsrep/transaction.hpp"
#include "wsrep/view.hpp" #include "wsrep/view.hpp"
#include "wsrep/logger.hpp" #include "wsrep/logger.hpp"
#include "wsrep/compiler.hpp" #include "wsrep/compiler.hpp"
@ -124,11 +124,11 @@ int wsrep::server_context::on_apply(
const wsrep::const_buffer& data) const wsrep::const_buffer& data)
{ {
int ret(0); 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); assert(client_state.mode() == wsrep::client_state::m_high_priority);
bool not_replaying(txc.state() != bool not_replaying(txc.state() !=
wsrep::transaction_context::s_replaying); wsrep::transaction::s_replaying);
if (starts_transaction(ws_meta.flags()) && if (starts_transaction(ws_meta.flags()) &&
commits_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(); client_state.after_command_after_result();
} }
assert(ret || assert(ret ||
txc.state() == wsrep::transaction_context::s_committed); txc.state() == wsrep::transaction::s_committed);
} }
else if (starts_transaction(ws_meta.flags())) 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( bool wsrep::server_context::statement_allowed_for_streaming(
const wsrep::client_state&, const wsrep::client_state&,
const wsrep::transaction_context&) const const wsrep::transaction&) const
{ {
/* Streaming not implemented yet. */ /* Streaming not implemented yet. */
return false; return false;

View File

@ -40,10 +40,10 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_1pc,
char buf[1] = { 1 }; char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 0); wsrep::const_buffer(buf, 1)) == 0);
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction& txc(cc.transaction());
// ::abort(); // ::abort();
BOOST_REQUIRE_MESSAGE( BOOST_REQUIRE_MESSAGE(
txc.state() == wsrep::transaction_context::s_committed, txc.state() == wsrep::transaction::s_committed,
"Transaction state " << txc.state() << " not committed"); "Transaction state " << txc.state() << " not committed");
} }
@ -54,8 +54,8 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_2pc,
char buf[1] = { 1 }; char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 0); wsrep::const_buffer(buf, 1)) == 0);
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_committed); BOOST_REQUIRE(txc.state() == wsrep::transaction::s_committed);
} }
// Test on_apply() method for 1pc transaction which // 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 }; char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 1); wsrep::const_buffer(buf, 1)) == 1);
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); BOOST_REQUIRE(txc.state() == wsrep::transaction::s_aborted);
} }
// Test on_apply() method for 2pc transaction which // 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 }; char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 1); wsrep::const_buffer(buf, 1)) == 1);
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); BOOST_REQUIRE(txc.state() == wsrep::transaction::s_aborted);
} }

View File

@ -2,7 +2,7 @@
// Copyright (C) 2018 Codership Oy <info@codership.com> // Copyright (C) 2018 Codership Oy <info@codership.com>
// //
#include "wsrep/transaction_context.hpp" #include "wsrep/transaction.hpp"
#include "wsrep/client_state.hpp" #include "wsrep/client_state.hpp"
#include "wsrep/server_context.hpp" #include "wsrep/server_context.hpp"
#include "wsrep/key.hpp" #include "wsrep/key.hpp"
@ -21,7 +21,7 @@
// Public // Public
wsrep::transaction_context::transaction_context( wsrep::transaction::transaction(
wsrep::client_state& client_state) wsrep::client_state& client_state)
: provider_(client_state.provider()) : provider_(client_state.provider())
, client_state_(client_state) , 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) const wsrep::transaction_id& id)
{ {
assert(active() == false); 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_handle& ws_handle,
const wsrep::ws_meta& ws_meta) const wsrep::ws_meta& ws_meta)
{ {
@ -81,7 +81,7 @@ int wsrep::transaction_context::start_transaction(
return 0; 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; ws_meta_ = ws_meta;
assert(ws_meta_.flags() & wsrep::provider::flag::commit); 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; 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 */ /** @todo Collect table level keys for SR commit */
return provider_.append_key(ws_handle_, key); 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); return provider_.append_data(ws_handle_, data);
} }
int wsrep::transaction_context::after_row() int wsrep::transaction::after_row()
{ {
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex()); wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
if (streaming_context_.fragment_size() > 0) if (streaming_context_.fragment_size() > 0)
@ -137,7 +137,7 @@ int wsrep::transaction_context::after_row()
return 0; return 0;
} }
int wsrep::transaction_context::before_prepare( int wsrep::transaction::before_prepare(
wsrep::unique_lock<wsrep::mutex>& lock) wsrep::unique_lock<wsrep::mutex>& lock)
{ {
assert(lock.owns_lock()); assert(lock.owns_lock());
@ -195,7 +195,7 @@ int wsrep::transaction_context::before_prepare(
return ret; return ret;
} }
int wsrep::transaction_context::after_prepare( int wsrep::transaction::after_prepare(
wsrep::unique_lock<wsrep::mutex>& lock) wsrep::unique_lock<wsrep::mutex>& lock)
{ {
assert(lock.owns_lock()); assert(lock.owns_lock());
@ -232,7 +232,7 @@ int wsrep::transaction_context::after_prepare(
return ret; return ret;
} }
int wsrep::transaction_context::before_commit() int wsrep::transaction::before_commit()
{ {
int ret(1); int ret(1);
@ -334,7 +334,7 @@ int wsrep::transaction_context::before_commit()
return ret; return ret;
} }
int wsrep::transaction_context::ordered_commit() int wsrep::transaction::ordered_commit()
{ {
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex()); wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
debug_log_state("ordered_commit_enter"); debug_log_state("ordered_commit_enter");
@ -348,7 +348,7 @@ int wsrep::transaction_context::ordered_commit()
return ret; return ret;
} }
int wsrep::transaction_context::after_commit() int wsrep::transaction::after_commit()
{ {
int ret(0); int ret(0);
@ -383,7 +383,7 @@ int wsrep::transaction_context::after_commit()
return ret; return ret;
} }
int wsrep::transaction_context::before_rollback() int wsrep::transaction::before_rollback()
{ {
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex()); wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
debug_log_state("before_rollback_enter"); debug_log_state("before_rollback_enter");
@ -440,7 +440,7 @@ int wsrep::transaction_context::before_rollback()
return 0; return 0;
} }
int wsrep::transaction_context::after_rollback() int wsrep::transaction::after_rollback()
{ {
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex()); wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
debug_log_state("after_rollback_enter"); debug_log_state("after_rollback_enter");
@ -462,7 +462,7 @@ int wsrep::transaction_context::after_rollback()
return 0; return 0;
} }
int wsrep::transaction_context::after_statement() int wsrep::transaction::after_statement()
{ {
int ret(0); int ret(0);
wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex()); wsrep::unique_lock<wsrep::mutex> lock(client_state_.mutex());
@ -565,7 +565,7 @@ int wsrep::transaction_context::after_statement()
return ret; return ret;
} }
bool wsrep::transaction_context::bf_abort( bool wsrep::transaction::bf_abort(
wsrep::unique_lock<wsrep::mutex>& lock WSREP_UNUSED, wsrep::unique_lock<wsrep::mutex>& lock WSREP_UNUSED,
wsrep::seqno bf_seqno) wsrep::seqno bf_seqno)
{ {
@ -634,7 +634,7 @@ bool wsrep::transaction_context::bf_abort(
// otherwise it could happend that the client gains control // otherwise it could happend that the client gains control
// between releasing the lock and before background // between releasing the lock and before background
// rollbacker gets control. // rollbacker gets control.
state(lock, wsrep::transaction_context::s_aborting); state(lock, wsrep::transaction::s_aborting);
lock.unlock(); lock.unlock();
client_state_.server_context().background_rollback(client_state_); client_state_.server_context().background_rollback(client_state_);
} }
@ -646,9 +646,9 @@ bool wsrep::transaction_context::bf_abort(
// Private // // Private //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void wsrep::transaction_context::state( void wsrep::transaction::state(
wsrep::unique_lock<wsrep::mutex>& lock __attribute__((unused)), wsrep::unique_lock<wsrep::mutex>& lock __attribute__((unused)),
enum wsrep::transaction_context::state next_state) enum wsrep::transaction::state next_state)
{ {
if (client_state_.debug_log_level() >= 1) 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<wsrep::mutex>& lock) wsrep::unique_lock<wsrep::mutex>& lock)
{ {
assert(lock.owns_lock()); assert(lock.owns_lock());
@ -717,7 +717,7 @@ int wsrep::transaction_context::certify_fragment(
} }
// Client context to store fragment in separate transaction // 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 // to original when this goes out of scope
// std::auto_ptr<wsrep::client_state> sr_client_state( // std::auto_ptr<wsrep::client_state> sr_client_state(
// client_state_.server_context().local_client_state()); // client_state_.server_context().local_client_state());
@ -731,12 +731,12 @@ int wsrep::transaction_context::certify_fragment(
sr_client_state); sr_client_state);
wsrep::unique_lock<wsrep::mutex> sr_lock(sr_client_state.mutex()); wsrep::unique_lock<wsrep::mutex> sr_lock(sr_client_state.mutex());
wsrep::transaction_context& sr_transaction_context( wsrep::transaction& sr_transaction(
sr_client_state.transaction_); sr_client_state.transaction_);
sr_transaction_context.state(sr_lock, s_certifying); sr_transaction.state(sr_lock, s_certifying);
sr_lock.unlock(); sr_lock.unlock();
if (sr_client_state.append_fragment( if (sr_client_state.append_fragment(
sr_transaction_context, flags_, sr_transaction, flags_,
wsrep::const_buffer(data.data(), data.size()))) wsrep::const_buffer(data.data(), data.size())))
{ {
lock.lock(); lock.lock();
@ -747,18 +747,18 @@ int wsrep::transaction_context::certify_fragment(
enum wsrep::provider::status enum wsrep::provider::status
cert_ret(provider_.certify(client_state_.id().get(), cert_ret(provider_.certify(client_state_.id().get(),
sr_transaction_context.ws_handle_, sr_transaction.ws_handle_,
flags_, flags_,
sr_transaction_context.ws_meta_)); sr_transaction.ws_meta_));
int ret(0); int ret(0);
switch (cert_ret) switch (cert_ret)
{ {
case wsrep::provider::success: 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_lock.lock();
sr_transaction_context.certified_ = true; sr_transaction.certified_ = true;
sr_transaction_context.state(sr_lock, s_committing); sr_transaction.state(sr_lock, s_committing);
sr_lock.unlock(); sr_lock.unlock();
if (sr_client_state.commit()) if (sr_client_state.commit())
{ {
@ -767,7 +767,7 @@ int wsrep::transaction_context::certify_fragment(
break; break;
default: default:
sr_lock.lock(); sr_lock.lock();
sr_transaction_context.state(sr_lock, s_must_abort); sr_transaction.state(sr_lock, s_must_abort);
sr_lock.unlock(); sr_lock.unlock();
sr_client_state.rollback(); sr_client_state.rollback();
ret = 1; ret = 1;
@ -786,7 +786,7 @@ int wsrep::transaction_context::certify_fragment(
return ret; return ret;
} }
int wsrep::transaction_context::certify_commit( int wsrep::transaction::certify_commit(
wsrep::unique_lock<wsrep::mutex>& lock) wsrep::unique_lock<wsrep::mutex>& lock)
{ {
assert(lock.owns_lock()); assert(lock.owns_lock());
@ -925,7 +925,7 @@ int wsrep::transaction_context::certify_commit(
return ret; return ret;
} }
void wsrep::transaction_context::streaming_rollback() void wsrep::transaction::streaming_rollback()
{ {
assert(streaming_context_.rolled_back() == false); assert(streaming_context_.rolled_back() == false);
wsrep::client_state* sac( wsrep::client_state* sac(
@ -938,12 +938,12 @@ void wsrep::transaction_context::streaming_rollback()
provider_.rollback(id_.get()); provider_.rollback(id_.get());
} }
void wsrep::transaction_context::clear_fragments() void wsrep::transaction::clear_fragments()
{ {
streaming_context_.cleanup(); streaming_context_.cleanup();
} }
void wsrep::transaction_context::cleanup() void wsrep::transaction::cleanup()
{ {
assert(is_streaming() == false); assert(is_streaming() == false);
assert(state() == s_committed || state() == s_aborted); assert(state() == s_committed || state() == s_aborted);
@ -958,7 +958,7 @@ void wsrep::transaction_context::cleanup()
debug_log_state("cleanup_leave"); debug_log_state("cleanup_leave");
} }
void wsrep::transaction_context::debug_log_state( void wsrep::transaction::debug_log_state(
const char* context) const const char* context) const
{ {
WSREP_TC_LOG_DEBUG( WSREP_TC_LOG_DEBUG(

View File

@ -7,8 +7,8 @@ add_executable(wsrep-lib_test
test_utils.cpp test_utils.cpp
id_test.cpp id_test.cpp
server_context_test.cpp server_context_test.cpp
transaction_context_test.cpp transaction_test.cpp
transaction_context_test_2pc.cpp transaction_test_2pc.cpp
wsrep-lib_test.cpp wsrep-lib_test.cpp
) )
target_link_libraries(wsrep-lib_test wsrep-lib) target_link_libraries(wsrep-lib_test wsrep-lib)

View File

@ -25,11 +25,11 @@ namespace
BOOST_REQUIRE(cc.before_statement() == 0); BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state // Verify initial state
BOOST_REQUIRE(tc.active() == false); 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_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
struct replicating_client_fixture_async_rm struct replicating_client_fixture_async_rm
@ -44,11 +44,11 @@ namespace
BOOST_REQUIRE(cc.before_statement() == 0); BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state // Verify initial state
BOOST_REQUIRE(tc.active() == false); 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_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
struct replicating_client_fixture_2pc struct replicating_client_fixture_2pc
@ -64,11 +64,11 @@ namespace
BOOST_REQUIRE(cc.before_statement() == 0); BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state // Verify initial state
BOOST_REQUIRE(tc.active() == false); 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_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
struct replicating_client_fixture_autocommit struct replicating_client_fixture_autocommit
@ -84,11 +84,11 @@ namespace
BOOST_REQUIRE(cc.before_statement() == 0); BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state // Verify initial state
BOOST_REQUIRE(tc.active() == false); 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_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
struct applying_client_fixture struct applying_client_fixture
@ -116,7 +116,7 @@ namespace
} }
wsrep::mock_server_context sc; wsrep::mock_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
struct applying_client_fixture_2pc struct applying_client_fixture_2pc
@ -145,7 +145,7 @@ namespace
} }
wsrep::mock_server_context sc; wsrep::mock_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
struct streaming_client_fixture_row struct streaming_client_fixture_row
@ -160,12 +160,12 @@ namespace
BOOST_REQUIRE(cc.before_statement() == 0); BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state // Verify initial state
BOOST_REQUIRE(tc.active() == false); 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); cc.enable_streaming(wsrep::streaming_context::row, 1);
} }
wsrep::mock_server_context sc; wsrep::mock_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
struct streaming_client_fixture_byte struct streaming_client_fixture_byte
@ -180,12 +180,12 @@ namespace
BOOST_REQUIRE(cc.before_statement() == 0); BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state // Verify initial state
BOOST_REQUIRE(tc.active() == false); 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); cc.enable_streaming(wsrep::streaming_context::bytes, 1);
} }
wsrep::mock_server_context sc; wsrep::mock_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
struct streaming_client_fixture_statement struct streaming_client_fixture_statement
@ -200,13 +200,13 @@ namespace
BOOST_REQUIRE(cc.before_statement() == 0); BOOST_REQUIRE(cc.before_statement() == 0);
// Verify initial state // Verify initial state
BOOST_REQUIRE(tc.active() == false); 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); cc.enable_streaming(wsrep::streaming_context::row, 1);
} }
wsrep::mock_server_context sc; wsrep::mock_server_context sc;
wsrep::mock_client_state cc; wsrep::mock_client_state cc;
const wsrep::transaction_context& tc; const wsrep::transaction& tc;
}; };
} }
#endif // WSREP_TEST_CLIENT_CONTEXT_FIXTURE_HPP #endif // WSREP_TEST_CLIENT_CONTEXT_FIXTURE_HPP

View File

@ -2,7 +2,7 @@
// Copyright (C) 2018 Codership Oy <info@codership.com> // Copyright (C) 2018 Codership Oy <info@codership.com>
// //
#include "wsrep/transaction_context.hpp" #include "wsrep/transaction.hpp"
#include "mock_client_state.hpp" #include "mock_client_state.hpp"
@ -11,8 +11,8 @@ int wsrep::mock_client_service::apply(
const wsrep::const_buffer&) const wsrep::const_buffer&)
{ {
assert(client_state.transaction().state() == wsrep::transaction_context::s_executing || assert(client_state.transaction().state() == wsrep::transaction::s_executing ||
client_state.transaction().state() == wsrep::transaction_context::s_replaying); client_state.transaction().state() == wsrep::transaction::s_replaying);
return (fail_next_applying_ ? 1 : 0); return (fail_next_applying_ ? 1 : 0);
} }

View File

@ -76,17 +76,17 @@ namespace wsrep
void reset_globals() WSREP_OVERRIDE { } void reset_globals() WSREP_OVERRIDE { }
void emergency_shutdown() WSREP_OVERRIDE { ++aborts_; } 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 int, const wsrep::const_buffer&) WSREP_OVERRIDE
{ return 0; } { return 0; }
void remove_fragments(const wsrep::transaction_context& ) void remove_fragments(const wsrep::transaction& )
WSREP_OVERRIDE { } WSREP_OVERRIDE { }
void will_replay(const wsrep::transaction_context&) void will_replay(const wsrep::transaction&)
WSREP_OVERRIDE { } WSREP_OVERRIDE { }
enum wsrep::provider::status enum wsrep::provider::status
replay(wsrep::client_state& client_state, replay(wsrep::client_state& client_state,
wsrep::transaction_context& tc) WSREP_OVERRIDE wsrep::transaction& tc) WSREP_OVERRIDE
{ {
enum wsrep::provider::status ret( enum wsrep::provider::status ret(
provider_.replay(tc.ws_handle(), &client_state)); provider_.replay(tc.ws_handle(), &client_state));
@ -109,7 +109,7 @@ namespace wsrep
int prepare_data_for_replication( int prepare_data_for_replication(
wsrep::client_state& client_state, wsrep::client_state& client_state,
const wsrep::transaction_context&) WSREP_OVERRIDE const wsrep::transaction&) WSREP_OVERRIDE
{ {
if (error_during_prepare_data_) if (error_during_prepare_data_)
{ {
@ -127,7 +127,7 @@ namespace wsrep
int prepare_fragment_for_replication( int prepare_fragment_for_replication(
wsrep::client_state& client_state, wsrep::client_state& client_state,
const wsrep::transaction_context&, const wsrep::transaction&,
wsrep::mutable_buffer& buffer) wsrep::mutable_buffer& buffer)
WSREP_OVERRIDE WSREP_OVERRIDE
{ {

View File

@ -157,7 +157,7 @@ namespace wsrep
wsrep::client_state& cc( wsrep::client_state& cc(
*static_cast<wsrep::client_state*>(ctx)); *static_cast<wsrep::client_state*>(ctx));
wsrep::high_priority_context high_priority_context(cc); 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; wsrep::ws_meta ws_meta;
if (replay_result_ == wsrep::provider::success) if (replay_result_ == wsrep::provider::success)
{ {

View File

@ -67,8 +67,8 @@ namespace wsrep
client_state.after_rollback(); client_state.after_rollback();
} }
// void sst_received(const wsrep_gtid_t&, int) WSREP_OVERRIDE { } // void sst_received(const wsrep_gtid_t&, int) WSREP_OVERRIDE { }
// void on_apply(wsrep::transaction_context&) { } // void on_apply(wsrep::transaction&) { }
// void on_commit(wsrep::transaction_context&) { } // void on_commit(wsrep::transaction&) { }
wsrep::mock_client_service& client_service() wsrep::mock_client_service& client_service()
{ {
return client_service_; return client_service_;

View File

@ -38,10 +38,10 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_1pc,
char buf[1] = { 1 }; char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 0); wsrep::const_buffer(buf, 1)) == 0);
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction& txc(cc.transaction());
// ::abort(); // ::abort();
BOOST_REQUIRE_MESSAGE( BOOST_REQUIRE_MESSAGE(
txc.state() == wsrep::transaction_context::s_committed, txc.state() == wsrep::transaction::s_committed,
"Transaction state " << txc.state() << " not committed"); "Transaction state " << txc.state() << " not committed");
} }
@ -52,8 +52,8 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_2pc,
char buf[1] = { 1 }; char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 0); wsrep::const_buffer(buf, 1)) == 0);
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_committed); BOOST_REQUIRE(txc.state() == wsrep::transaction::s_committed);
} }
// Test on_apply() method for 1pc transaction which // 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 }; char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 1); wsrep::const_buffer(buf, 1)) == 1);
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); BOOST_REQUIRE(txc.state() == wsrep::transaction::s_aborted);
} }
// Test on_apply() method for 2pc transaction which // 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 }; char buf[1] = { 1 };
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta, BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 1); wsrep::const_buffer(buf, 1)) == 1);
const wsrep::transaction_context& txc(cc.transaction()); const wsrep::transaction& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted); BOOST_REQUIRE(txc.state() == wsrep::transaction::s_aborted);
} }
BOOST_AUTO_TEST_CASE(server_context_streaming) BOOST_AUTO_TEST_CASE(server_context_streaming)

View File

@ -21,7 +21,7 @@ void wsrep_test::bf_abort_ordered(wsrep::client_state& cc)
} }
// BF abort method to abort transactions via provider // BF abort method to abort transactions via provider
void wsrep_test::bf_abort_provider(wsrep::mock_server_context& sc, 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 bf_seqno)
{ {
wsrep::seqno victim_seqno; wsrep::seqno victim_seqno;

View File

@ -9,7 +9,7 @@ namespace wsrep
class mock_server_context; class mock_server_context;
} }
#include "wsrep/transaction_context.hpp" #include "wsrep/transaction.hpp"
#include "wsrep/provider.hpp" #include "wsrep/provider.hpp"
// //
@ -26,7 +26,7 @@ namespace wsrep_test
// BF abort method to abort transactions via provider // BF abort method to abort transactions via provider
void bf_abort_provider(wsrep::mock_server_context& sc, void bf_abort_provider(wsrep::mock_server_context& sc,
const wsrep::transaction_context& tc, const wsrep::transaction& tc,
wsrep::seqno bf_seqno); wsrep::seqno bf_seqno);
} }

View File

@ -7,23 +7,23 @@
// //
// Test a succesful 2PC transaction lifecycle // Test a succesful 2PC transaction lifecycle
// //
BOOST_FIXTURE_TEST_CASE(transaction_context_2pc, BOOST_FIXTURE_TEST_CASE(transaction_2pc,
replicating_client_fixture_2pc) replicating_client_fixture_2pc)
{ {
cc.start_transaction(1); cc.start_transaction(1);
BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); 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.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(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(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(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(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(cc.after_statement() == wsrep::client_state::asr_success);
BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(tc.ordered() == 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 // Test a 2PC transaction which gets BF aborted before before_prepare
// //
BOOST_FIXTURE_TEST_CASE( BOOST_FIXTURE_TEST_CASE(
transaction_context_2pc_bf_before_before_prepare, transaction_2pc_bf_before_before_prepare,
replicating_client_fixture_2pc) replicating_client_fixture_2pc)
{ {
cc.start_transaction(1); cc.start_transaction(1);
BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); 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); wsrep_test::bf_abort_unordered(cc);
BOOST_REQUIRE(cc.before_prepare()); 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.certified() == false);
BOOST_REQUIRE(tc.ordered() == false); BOOST_REQUIRE(tc.ordered() == false);
BOOST_REQUIRE(cc.before_rollback() == 0); 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(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(cc.after_statement() == wsrep::client_state::asr_error);
BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(tc.ordered() == 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 // Test a 2PC transaction which gets BF aborted before before_prepare
// //
BOOST_FIXTURE_TEST_CASE( BOOST_FIXTURE_TEST_CASE(
transaction_context_2pc_bf_before_after_prepare, transaction_2pc_bf_before_after_prepare,
replicating_client_fixture_2pc) replicating_client_fixture_2pc)
{ {
cc.start_transaction(1); cc.start_transaction(1);
BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); 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.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); wsrep_test::bf_abort_unordered(cc);
BOOST_REQUIRE(cc.after_prepare()); 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.certified() == false);
BOOST_REQUIRE(tc.ordered() == false); BOOST_REQUIRE(tc.ordered() == false);
BOOST_REQUIRE(cc.before_rollback() == 0); 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(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(cc.after_statement() == wsrep::client_state::asr_error);
BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(tc.ordered() == false); BOOST_REQUIRE(tc.ordered() == false);
@ -92,22 +92,22 @@ BOOST_FIXTURE_TEST_CASE(
// the rollback takes place before entering before_commit(). // the rollback takes place before entering before_commit().
// //
BOOST_FIXTURE_TEST_CASE( BOOST_FIXTURE_TEST_CASE(
transaction_context_2pc_bf_after_after_prepare, transaction_2pc_bf_after_after_prepare,
replicating_client_fixture_2pc) replicating_client_fixture_2pc)
{ {
cc.start_transaction(1); cc.start_transaction(1);
BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); 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.before_prepare() == 0);
BOOST_REQUIRE(cc.after_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); 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.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(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(cc.after_statement() == wsrep::client_state::asr_success);
BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(tc.ordered() == false); BOOST_REQUIRE(tc.ordered() == false);
@ -120,26 +120,26 @@ BOOST_FIXTURE_TEST_CASE(
// and before_commit() // and before_commit()
// //
BOOST_FIXTURE_TEST_CASE( BOOST_FIXTURE_TEST_CASE(
transaction_context_2pc_bf_before_before_commit, transaction_2pc_bf_before_before_commit,
replicating_client_fixture_2pc) replicating_client_fixture_2pc)
{ {
cc.start_transaction(1); cc.start_transaction(1);
BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); 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.before_prepare() == 0);
BOOST_REQUIRE(cc.after_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); 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(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.certified() == true);
BOOST_REQUIRE(tc.ordered() == true); BOOST_REQUIRE(tc.ordered() == true);
BOOST_REQUIRE(cc.before_rollback() == 0); 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(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(cc.after_statement() == wsrep::client_state::asr_success);
BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(tc.ordered() == false); BOOST_REQUIRE(tc.ordered() == false);
@ -153,25 +153,25 @@ BOOST_FIXTURE_TEST_CASE(
// commit order. // commit order.
// //
BOOST_FIXTURE_TEST_CASE( BOOST_FIXTURE_TEST_CASE(
transaction_context_2pc_bf_during_commit_order_enter, transaction_2pc_bf_during_commit_order_enter,
replicating_client_fixture_2pc) replicating_client_fixture_2pc)
{ {
cc.start_transaction(1); cc.start_transaction(1);
BOOST_REQUIRE(tc.active()); BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1)); 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.before_prepare() == 0);
BOOST_REQUIRE(cc.after_prepare() == 0); BOOST_REQUIRE(cc.after_prepare() == 0);
sc.provider().commit_order_enter_result_ = wsrep::provider::error_bf_abort; sc.provider().commit_order_enter_result_ = wsrep::provider::error_bf_abort;
BOOST_REQUIRE(cc.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.certified() == true);
BOOST_REQUIRE(tc.ordered() == true); BOOST_REQUIRE(tc.ordered() == true);
sc.provider().commit_order_enter_result_ = wsrep::provider::success; sc.provider().commit_order_enter_result_ = wsrep::provider::success;
BOOST_REQUIRE(cc.before_rollback() == 0); 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(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(cc.after_statement() == wsrep::client_state::asr_success);
BOOST_REQUIRE(tc.active() == false); BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(tc.ordered() == 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) streaming_client_fixture_row)
{ {
BOOST_REQUIRE(cc.start_transaction(1) == 0); 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_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) streaming_client_fixture_row)
{ {
BOOST_REQUIRE(cc.start_transaction(1) == 0); BOOST_REQUIRE(cc.start_transaction(1) == 0);
@ -226,21 +226,21 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_streaming_2pc_commit_two_statements,
// APPLYING // // APPLYING //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
BOOST_FIXTURE_TEST_CASE(transaction_context_2pc_applying, BOOST_FIXTURE_TEST_CASE(transaction_2pc_applying,
applying_client_fixture_2pc) applying_client_fixture_2pc)
{ {
BOOST_REQUIRE(cc.before_prepare() == 0); 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(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(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(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(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(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(tc.active() == false);
BOOST_REQUIRE(cc.current_error() == wsrep::e_success); BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
} }