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

Made client_id, transaction_id constructors explicit.

This commit is contained in:
Teemu Ollakka
2018-07-11 15:00:31 +03:00
parent d564a6f154
commit ddc6c6495b
13 changed files with 102 additions and 84 deletions

View File

@ -79,7 +79,7 @@ void db::client::run_one_transaction()
{
// wsrep::log_debug() << "Start transaction";
err = client_state_.start_transaction(
server_.next_transaction_id());
wsrep::transaction_id(server_.next_transaction_id()));
assert(err == 0);
se_trx_.start(this);
return err;

View File

@ -95,7 +95,7 @@ void db::server::client_thread(const std::shared_ptr<db::client>& client)
void db::server::start_client(size_t id)
{
auto client(std::make_shared<db::client>(
*this, id,
*this, wsrep::client_id(id),
wsrep::client_state::m_local,
simulator_.params()));
clients_.push_back(client);

View File

@ -38,7 +38,7 @@ namespace db
db::server_state& server_state() { return server_state_; }
wsrep::transaction_id next_transaction_id()
{
return (last_transaction_id_.fetch_add(1) + 1);
return wsrep::transaction_id(last_transaction_id_.fetch_add(1) + 1);
}
void donate_sst(const std::string&, const wsrep::gtid&, bool);
wsrep::client_state* local_client_state();

View File

@ -15,7 +15,7 @@ namespace wsrep
: id_(-1)
{ }
template <typename I>
client_id(I id)
explicit client_id(I id)
: id_(static_cast<type>(id))
{ }
type get() const { return id_; }

View File

@ -421,7 +421,7 @@ namespace wsrep
int bf_abort(wsrep::seqno bf_seqno)
{
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
assert(mode_ == m_local);
assert(mode_ == m_local || transaction_.is_streaming());
return transaction_.bf_abort(lock, bf_seqno);
}

View File

@ -5,7 +5,7 @@
#ifndef WSREP_TRANSACTION_ID_HPP
#define WSREP_TRANSACTION_ID_HPP
#include <iosfwd>
#include <iostream>
namespace wsrep
{
@ -20,11 +20,11 @@ namespace wsrep
{ }
template <typename I>
transaction_id(I id)
explicit transaction_id(I id)
: id_(static_cast<type>(id))
{ }
type get() const { return id_; }
static unsigned long long undefined() { return type(-1); }
static transaction_id undefined() { return transaction_id(-1); }
bool is_undefined() const { return (id_ == type(-1)); }
bool operator<(const transaction_id& other) const
{

View File

@ -554,7 +554,7 @@ int wsrep::transaction::before_rollback()
case s_aborting:
if (is_streaming())
{
provider().rollback(id_.get());
provider().rollback(id_);
}
break;
case s_must_replay:
@ -782,12 +782,12 @@ bool wsrep::transaction::bf_abort(
wsrep::seqno victim_seqno;
enum wsrep::provider::status
status(client_state_.provider().bf_abort(
bf_seqno, id_.get(), victim_seqno));
bf_seqno, id_, victim_seqno));
switch (status)
{
case wsrep::provider::success:
WSREP_TC_LOG_DEBUG(1, "Seqno " << bf_seqno
<< " succesfully BF aborted " << id_.get()
<< " succesfully BF aborted " << id_
<< " victim_seqno " << victim_seqno);
bf_abort_state_ = state();
state(lock, s_must_abort);
@ -796,7 +796,7 @@ bool wsrep::transaction::bf_abort(
default:
WSREP_TC_LOG_DEBUG(1,
"Seqno " << bf_seqno
<< " failed to BF abort " << id_.get()
<< " failed to BF abort " << id_
<< " with status " << status
<< " victim_seqno " << victim_seqno);
break;
@ -882,7 +882,7 @@ void wsrep::transaction::state(
{
std::ostringstream os;
os << "unallowed state transition for transaction "
<< id_.get() << ": " << wsrep::to_string(state_)
<< id_ << ": " << wsrep::to_string(state_)
<< " -> " << wsrep::to_string(next_state);
wsrep::log_error() << os.str();
throw wsrep::runtime_error(os.str());
@ -963,7 +963,7 @@ int wsrep::transaction::certify_fragment(
wsrep::ws_meta sr_ws_meta;
enum wsrep::provider::status
cert_ret(provider().certify(client_state_.id().get(),
cert_ret(provider().certify(client_state_.id(),
ws_handle_,
flags(),
sr_ws_meta));
@ -1062,7 +1062,7 @@ int wsrep::transaction::certify_commit(
client_service_.debug_sync("wsrep_before_certification");
enum wsrep::provider::status
cert_ret(provider().certify(client_state_.id().get(),
cert_ret(provider().certify(client_state_.id(),
ws_handle_,
flags(),
ws_meta_));
@ -1213,10 +1213,10 @@ void wsrep::transaction::streaming_rollback()
streaming_context_.cleanup();
streaming_context_.rolled_back(id_);
enum wsrep::provider::status ret;
if ((ret = provider().rollback(id_.get())))
if ((ret = provider().rollback(id_)))
{
wsrep::log_warning() << "Failed to replicate rollback fragment for "
<< id_.get() << ": " << ret;
<< id_ << ": " << ret;
}
debug_log_state("streaming_rollback leave");
}

View File

@ -135,7 +135,8 @@ namespace
~mutable_ws_handle()
{
ws_handle_ = wsrep::ws_handle(native_.trx_id, native_.opaque);
ws_handle_ = wsrep::ws_handle(
wsrep::transaction_id(native_.trx_id), native_.opaque);
}
wsrep_ws_handle_t* native()
@ -192,8 +193,8 @@ namespace
seqno_from_native(trx_meta_.gtid.seqno)),
wsrep::stid(wsrep::id(trx_meta_.stid.node.data,
sizeof(trx_meta_.stid.node.data)),
trx_meta_.stid.trx,
trx_meta_.stid.conn),
wsrep::transaction_id(trx_meta_.stid.trx),
wsrep::client_id(trx_meta_.stid.conn)),
seqno_from_native(trx_meta_.depends_on), flags_);
}
@ -368,15 +369,17 @@ namespace
assert(high_priority_service);
wsrep::const_buffer data(buf->ptr, buf->len);
wsrep::ws_handle ws_handle(wsh->trx_id, wsh->opaque);
wsrep::ws_handle ws_handle(wsrep::transaction_id(wsh->trx_id),
wsh->opaque);
wsrep::ws_meta ws_meta(
wsrep::gtid(wsrep::id(meta->gtid.uuid.data,
sizeof(meta->gtid.uuid.data)),
wsrep::seqno(meta->gtid.seqno)),
wsrep::stid(wsrep::id(meta->stid.node.data,
sizeof(meta->stid.node.data)),
meta->stid.trx,
meta->stid.conn), wsrep::seqno(seqno_from_native(meta->depends_on)),
wsrep::transaction_id(meta->stid.trx),
wsrep::client_id(meta->stid.conn)),
wsrep::seqno(seqno_from_native(meta->depends_on)),
map_flags_from_native(flags));
try
{

View File

@ -108,9 +108,11 @@ namespace
cc.open(cc.id());
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
wsrep::ws_handle ws_handle(1, (void*)1);
wsrep::ws_handle ws_handle(wsrep::transaction_id(1), (void*)1);
wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
wsrep::stid(sc.id(), 1, cc.id()),
wsrep::stid(sc.id(),
wsrep::transaction_id(1),
cc.id()),
wsrep::seqno(0),
wsrep::provider::flag::start_transaction |
wsrep::provider::flag::commit);
@ -138,9 +140,11 @@ namespace
cc.do_2pc_ = true;
BOOST_REQUIRE(cc.before_command() == 0);
BOOST_REQUIRE(cc.before_statement() == 0);
wsrep::ws_handle ws_handle(1, (void*)1);
wsrep::ws_handle ws_handle(wsrep::transaction_id(1), (void*)1);
wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
wsrep::stid(sc.id(), 1, cc.id()),
wsrep::stid(sc.id(),
wsrep::transaction_id(1),
cc.id()),
wsrep::seqno(0),
wsrep::provider::flag::start_transaction |
wsrep::provider::flag::commit);

View File

@ -41,7 +41,8 @@ namespace wsrep
wsrep::storage_service* storage_service(wsrep::client_service&)
{
return new wsrep::mock_storage_service(*this, ++last_client_id_);
return new wsrep::mock_storage_service(*this,
wsrep::client_id(++last_client_id_));
}
void release_storage_service(wsrep::storage_service* storage_service)
@ -52,7 +53,8 @@ namespace wsrep
wsrep::client_state* local_client_state()
{
wsrep::client_state* ret(new wsrep::mock_client(
*this, ++last_client_id_,
*this,
wsrep::client_id(++last_client_id_),
wsrep::client_state::m_local));
ret->open(ret->id());
return ret;
@ -67,7 +69,8 @@ namespace wsrep
wsrep::client_service&)
{
wsrep::mock_client* cs(new wsrep::mock_client(
*this, ++last_client_id_,
*this,
wsrep::client_id(++last_client_id_),
wsrep::client_state::m_high_priority));
wsrep::mock_high_priority_service* ret(
new wsrep::mock_high_priority_service(*this, cs, false));
@ -80,7 +83,8 @@ namespace wsrep
wsrep::high_priority_service&)
{
wsrep::mock_client* cs(new wsrep::mock_client(
*this, ++last_client_id_,
*this,
wsrep::client_id(++last_client_id_),
wsrep::client_state::m_high_priority));
wsrep::mock_high_priority_service* ret(
new wsrep::mock_high_priority_service(*this, cs, false));

View File

@ -17,9 +17,10 @@ namespace
wsrep::client_id(1),
wsrep::client_state::m_high_priority)
, hps(ss, &cc, false)
, ws_handle(1, (void*)1)
, ws_handle(wsrep::transaction_id(1), (void*)1)
, ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
wsrep::stid(wsrep::id("1"), 1, 1),
wsrep::stid(wsrep::id("1"), wsrep::transaction_id(1),
wsrep::client_id(1)),
wsrep::seqno(0),
wsrep::provider::flag::start_transaction |
wsrep::provider::flag::commit)
@ -114,9 +115,11 @@ BOOST_AUTO_TEST_CASE(server_state_streaming)
wsrep::client_state::m_high_priority);
cc.debug_log_level(1);
wsrep::mock_high_priority_service hps(ss, &cc, false);
wsrep::ws_handle ws_handle(1, (void*)1);
wsrep::ws_handle ws_handle(wsrep::transaction_id(1), (void*)1);
wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
wsrep::stid(wsrep::id("1"), 1, 1),
wsrep::stid(wsrep::id("1"),
wsrep::transaction_id(1),
wsrep::client_id(1)),
wsrep::seqno(0),
wsrep::provider::flag::start_transaction);
cc.open(cc.id());
@ -126,13 +129,17 @@ BOOST_AUTO_TEST_CASE(server_state_streaming)
BOOST_REQUIRE(ss.find_streaming_applier(
ws_meta.server_id(), ws_meta.transaction_id()));
ws_meta = wsrep::ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(2)),
wsrep::stid(wsrep::id("1"), 1, 1),
wsrep::stid(wsrep::id("1"),
wsrep::transaction_id(1),
wsrep::client_id(1)),
wsrep::seqno(1),
0);
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
wsrep::const_buffer("1", 1)) == 0);
ws_meta = wsrep::ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(2)),
wsrep::stid(wsrep::id("1"), 1, 1),
wsrep::stid(wsrep::id("1"),
wsrep::transaction_id(1),
wsrep::client_id(1)),
wsrep::seqno(1),
wsrep::provider::flag::commit);
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,

View File

@ -21,7 +21,7 @@ namespace
BOOST_FIXTURE_TEST_CASE(transaction_append_key_data,
replicating_client_fixture_sync_rm)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
int vals[3] = {1, 2, 3};
wsrep::key key(wsrep::key::exclusive);
@ -46,7 +46,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_1pc, T,
wsrep::mock_client& cc(T::cc);
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -89,7 +89,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_rollback, T,
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -121,7 +121,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -163,7 +163,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -202,7 +202,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -240,7 +240,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -279,7 +279,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -315,7 +315,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_bf_before_cert_result_replay_success,
replicating_client_fixture_sync_rm)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
sc.provider().certify_result_ = wsrep::provider::error_bf_abort;
sc.provider().replay_result_ = wsrep::provider::success;
@ -335,7 +335,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_bf_before_cert_result_replay_cert_fail,
replicating_client_fixture_sync_rm)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
sc.provider().certify_result_ = wsrep::provider::error_bf_abort;
sc.provider().replay_result_ = wsrep::provider::error_certification_failed;
@ -361,7 +361,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -403,7 +403,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
wsrep::mock_client& cc(T::cc);
const wsrep::transaction& tc(T::tc);
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -437,7 +437,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -478,7 +478,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -519,7 +519,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -560,7 +560,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -601,7 +601,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -642,7 +642,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -684,7 +684,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -725,7 +725,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -766,7 +766,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -798,7 +798,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
const wsrep::transaction& tc(T::tc);
// Start a new transaction with ID 1
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -819,7 +819,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
wsrep::client_state& cc(T::cc);
const wsrep::transaction& tc(T::tc);
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
cc.after_statement();
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
@ -842,7 +842,7 @@ BOOST_FIXTURE_TEST_CASE(
replicating_client_fixture_autocommit)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
wsrep_test::bf_abort_unordered(cc);
BOOST_REQUIRE(cc.before_commit());
@ -862,7 +862,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
wsrep::client_state& cc(T::cc);
const wsrep::transaction& tc(T::tc);
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
cc.after_statement();
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
@ -895,7 +895,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_1pc_bf_abort_after_after_command_after_result_sync_rm,
replicating_client_fixture_sync_rm)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
cc.after_statement();
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
@ -920,7 +920,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_1pc_bf_abort_after_after_command_after_result_async_rm,
replicating_client_fixture_async_rm)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
cc.after_statement();
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
@ -980,7 +980,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_applying_rollback,
BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_1pc_commit,
streaming_client_fixture_row)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
BOOST_REQUIRE(cc.before_commit() == 0);
@ -1000,7 +1000,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_batch_streaming_1pc_commit,
{
BOOST_REQUIRE(cc.enable_streaming(
wsrep::streaming_context::row, 2) == 0);
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
BOOST_REQUIRE(cc.after_row() == 0);
@ -1021,7 +1021,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_row_streaming_1pc_commit_two_statements,
streaming_client_fixture_row)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
BOOST_REQUIRE(cc.after_statement() == 0);
@ -1043,7 +1043,7 @@ BOOST_FIXTURE_TEST_CASE(
BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_rollback,
streaming_client_fixture_row)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
BOOST_REQUIRE(cc.before_rollback() == 0);
@ -1060,7 +1060,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_rollback,
BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_non_commit,
streaming_client_fixture_row)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
@ -1080,7 +1080,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_non_commit,
BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_commit,
streaming_client_fixture_row)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
@ -1102,7 +1102,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_commit,
BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_bf_abort_committing,
streaming_client_fixture_row)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
BOOST_REQUIRE(cc.before_commit() == 0);
@ -1124,7 +1124,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_bf_abort_committing,
BOOST_FIXTURE_TEST_CASE(transaction_byte_streaming_1pc_commit,
streaming_client_fixture_byte)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
cc.bytes_generated_ = 1;
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
@ -1143,7 +1143,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_byte_batch_streaming_1pc_commit,
BOOST_REQUIRE(
cc.enable_streaming(
wsrep::streaming_context::bytes, 2) == 0);
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
cc.bytes_generated_ = 1;
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
@ -1166,7 +1166,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_1pc_commit,
BOOST_REQUIRE(
cc.enable_streaming(
wsrep::streaming_context::statement, 1) == 0);
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
BOOST_REQUIRE(cc.after_statement() == 0);
@ -1187,7 +1187,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_batch_streaming_1pc_commit,
BOOST_REQUIRE(
cc.enable_streaming(
wsrep::streaming_context::statement, 2) == 0);
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
BOOST_REQUIRE(cc.after_statement() == 0);
@ -1213,7 +1213,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_statement_streaming_cert_fail,
BOOST_REQUIRE(
cc.enable_streaming(
wsrep::streaming_context::statement, 1) == 0);
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 0);
sc.provider().certify_result_ = wsrep::provider::error_certification_failed;

View File

@ -10,7 +10,7 @@
BOOST_FIXTURE_TEST_CASE(transaction_2pc,
replicating_client_fixture_2pc)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -38,7 +38,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_2pc_bf_before_before_prepare,
replicating_client_fixture_2pc)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -65,7 +65,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_2pc_bf_before_after_prepare,
replicating_client_fixture_2pc)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -95,7 +95,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_2pc_bf_after_after_prepare,
replicating_client_fixture_2pc)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -123,7 +123,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_2pc_bf_before_before_commit,
replicating_client_fixture_2pc)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -156,7 +156,7 @@ BOOST_FIXTURE_TEST_CASE(
transaction_2pc_bf_during_commit_order_enter,
replicating_client_fixture_2pc)
{
cc.start_transaction(1);
cc.start_transaction(wsrep::transaction_id(1));
BOOST_REQUIRE(tc.active());
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_executing);
@ -187,7 +187,7 @@ BOOST_FIXTURE_TEST_CASE(
BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit,
streaming_client_fixture_row)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
BOOST_REQUIRE(cc.before_prepare() == 0);
@ -204,7 +204,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit,
BOOST_FIXTURE_TEST_CASE(transaction_streaming_2pc_commit_two_statements,
streaming_client_fixture_row)
{
BOOST_REQUIRE(cc.start_transaction(1) == 0);
BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0);
BOOST_REQUIRE(cc.after_row() == 0);
BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1);
BOOST_REQUIRE(cc.after_statement() == 0);