mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-20 01:03:16 +03:00
Renamed client_context to client_state.
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
add_executable(wsrep-lib_test
|
||||
mock_client_context.cpp
|
||||
mock_client_state.cpp
|
||||
test_utils.cpp
|
||||
id_test.cpp
|
||||
server_context_test.cpp
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define WSREP_TEST_CLIENT_CONTEXT_FIXTURE_HPP
|
||||
|
||||
#include "mock_server_context.hpp"
|
||||
#include "mock_client_context.hpp"
|
||||
#include "mock_client_state.hpp"
|
||||
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@ -18,7 +18,7 @@ namespace
|
||||
replicating_client_fixture_sync_rm()
|
||||
: sc("s1", "s1", wsrep::server_context::rm_sync)
|
||||
, cc(sc, sc.client_service(), wsrep::client_id(1),
|
||||
wsrep::client_context::m_replicating)
|
||||
wsrep::client_state::m_replicating)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
BOOST_REQUIRE(cc.before_command() == 0);
|
||||
@ -28,7 +28,7 @@ namespace
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
|
||||
@ -37,7 +37,7 @@ namespace
|
||||
replicating_client_fixture_async_rm()
|
||||
: sc("s1", "s1", wsrep::server_context::rm_async)
|
||||
, cc(sc, sc.client_service(), wsrep::client_id(1),
|
||||
wsrep::client_context::m_replicating)
|
||||
wsrep::client_state::m_replicating)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
BOOST_REQUIRE(cc.before_command() == 0);
|
||||
@ -47,7 +47,7 @@ namespace
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
|
||||
@ -56,7 +56,7 @@ namespace
|
||||
replicating_client_fixture_2pc()
|
||||
: sc("s1", "s1", wsrep::server_context::rm_sync)
|
||||
, cc(sc, sc.client_service(), wsrep::client_id(1),
|
||||
wsrep::client_context::m_replicating)
|
||||
wsrep::client_state::m_replicating)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
sc.client_service().do_2pc_ = true;
|
||||
@ -67,7 +67,7 @@ namespace
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
|
||||
@ -76,7 +76,7 @@ namespace
|
||||
replicating_client_fixture_autocommit()
|
||||
: sc("s1", "s1", wsrep::server_context::rm_sync)
|
||||
, cc(sc, sc.client_service(), wsrep::client_id(1),
|
||||
wsrep::client_context::m_replicating)
|
||||
wsrep::client_state::m_replicating)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
sc.client_service().is_autocommit_ = true;
|
||||
@ -87,7 +87,7 @@ namespace
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
|
||||
@ -98,7 +98,7 @@ namespace
|
||||
wsrep::server_context::rm_async)
|
||||
, cc(sc, sc.client_service(),
|
||||
wsrep::client_id(1),
|
||||
wsrep::client_context::m_high_priority)
|
||||
wsrep::client_state::m_high_priority)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
BOOST_REQUIRE(cc.before_command() == 0);
|
||||
@ -115,7 +115,7 @@ namespace
|
||||
BOOST_REQUIRE(tc.ordered() == true);
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
|
||||
@ -126,7 +126,7 @@ namespace
|
||||
wsrep::server_context::rm_async)
|
||||
, cc(sc, sc.client_service(),
|
||||
wsrep::client_id(1),
|
||||
wsrep::client_context::m_high_priority)
|
||||
wsrep::client_state::m_high_priority)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
sc.client_service().do_2pc_ = true;
|
||||
@ -144,7 +144,7 @@ namespace
|
||||
BOOST_REQUIRE(tc.ordered() == true);
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
|
||||
@ -153,7 +153,7 @@ namespace
|
||||
streaming_client_fixture_row()
|
||||
: sc("s1", "s1", wsrep::server_context::rm_sync)
|
||||
, cc(sc, sc.client_service(), wsrep::client_id(1),
|
||||
wsrep::client_context::m_replicating)
|
||||
wsrep::client_state::m_replicating)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
BOOST_REQUIRE(cc.before_command() == 0);
|
||||
@ -164,7 +164,7 @@ namespace
|
||||
cc.enable_streaming(wsrep::streaming_context::row, 1);
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
|
||||
@ -173,7 +173,7 @@ namespace
|
||||
streaming_client_fixture_byte()
|
||||
: sc("s1", "s1", wsrep::server_context::rm_sync)
|
||||
, cc(sc, sc.client_service(), wsrep::client_id(1),
|
||||
wsrep::client_context::m_replicating)
|
||||
wsrep::client_state::m_replicating)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
BOOST_REQUIRE(cc.before_command() == 0);
|
||||
@ -184,7 +184,7 @@ namespace
|
||||
cc.enable_streaming(wsrep::streaming_context::bytes, 1);
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
|
||||
@ -193,7 +193,7 @@ namespace
|
||||
streaming_client_fixture_statement()
|
||||
: sc("s1", "s1", wsrep::server_context::rm_sync)
|
||||
, cc(sc, sc.client_service(), wsrep::client_id(1),
|
||||
wsrep::client_context::m_replicating)
|
||||
wsrep::client_state::m_replicating)
|
||||
, tc(cc.transaction())
|
||||
{
|
||||
BOOST_REQUIRE(cc.before_command() == 0);
|
||||
@ -205,7 +205,7 @@ namespace
|
||||
}
|
||||
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
const wsrep::transaction_context& tc;
|
||||
};
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#include "wsrep/transaction_context.hpp"
|
||||
#include "mock_client_context.hpp"
|
||||
|
||||
|
||||
int wsrep::mock_client_service::apply(
|
||||
wsrep::client_context& client_context WSREP_UNUSED,
|
||||
const wsrep::const_buffer&)
|
||||
|
||||
{
|
||||
assert(client_context.transaction().state() == wsrep::transaction_context::s_executing ||
|
||||
client_context.transaction().state() == wsrep::transaction_context::s_replaying);
|
||||
return (fail_next_applying_ ? 1 : 0);
|
||||
}
|
||||
|
||||
int wsrep::mock_client_service::commit(wsrep::client_context& client_context, const wsrep::ws_handle&, const wsrep::ws_meta&)
|
||||
{
|
||||
int ret(0);
|
||||
if (do_2pc())
|
||||
{
|
||||
if (client_context.before_prepare())
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else if (client_context.after_prepare())
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
if (ret == 0 &&
|
||||
(client_context.before_commit() ||
|
||||
client_context.ordered_commit() ||
|
||||
client_context.after_commit()))
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wsrep::mock_client_service::rollback(
|
||||
wsrep::client_context& client_context)
|
||||
{
|
||||
int ret(0);
|
||||
if (client_context.before_rollback())
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else if (client_context.after_rollback())
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
56
test/mock_client_state.cpp
Normal file
56
test/mock_client_state.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
//
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#include "wsrep/transaction_context.hpp"
|
||||
#include "mock_client_state.hpp"
|
||||
|
||||
|
||||
int wsrep::mock_client_service::apply(
|
||||
wsrep::client_state& client_state WSREP_UNUSED,
|
||||
const wsrep::const_buffer&)
|
||||
|
||||
{
|
||||
assert(client_state.transaction().state() == wsrep::transaction_context::s_executing ||
|
||||
client_state.transaction().state() == wsrep::transaction_context::s_replaying);
|
||||
return (fail_next_applying_ ? 1 : 0);
|
||||
}
|
||||
|
||||
int wsrep::mock_client_service::commit(wsrep::client_state& client_state, const wsrep::ws_handle&, const wsrep::ws_meta&)
|
||||
{
|
||||
int ret(0);
|
||||
if (do_2pc())
|
||||
{
|
||||
if (client_state.before_prepare())
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else if (client_state.after_prepare())
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
if (ret == 0 &&
|
||||
(client_state.before_commit() ||
|
||||
client_state.ordered_commit() ||
|
||||
client_state.after_commit()))
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wsrep::mock_client_service::rollback(
|
||||
wsrep::client_state& client_state)
|
||||
{
|
||||
int ret(0);
|
||||
if (client_state.before_rollback())
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else if (client_state.after_rollback())
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
#ifndef WSREP_MOCK_CLIENT_CONTEXT_HPP
|
||||
#define WSREP_MOCK_CLIENT_CONTEXT_HPP
|
||||
|
||||
#include "wsrep/client_context.hpp"
|
||||
#include "wsrep/client_state.hpp"
|
||||
#include "wsrep/mutex.hpp"
|
||||
#include "wsrep/compiler.hpp"
|
||||
|
||||
@ -13,19 +13,19 @@
|
||||
|
||||
namespace wsrep
|
||||
{
|
||||
class mock_client_context : public wsrep::client_context
|
||||
class mock_client_state : public wsrep::client_state
|
||||
{
|
||||
public:
|
||||
mock_client_context(wsrep::server_context& server_context,
|
||||
mock_client_state(wsrep::server_context& server_context,
|
||||
wsrep::client_service& client_service,
|
||||
const wsrep::client_id& id,
|
||||
enum wsrep::client_context::mode mode)
|
||||
: wsrep::client_context(mutex_, server_context, client_service, id, mode)
|
||||
enum wsrep::client_state::mode mode)
|
||||
: wsrep::client_state(mutex_, server_context, client_service, id, mode)
|
||||
// Note: Mutex is initialized only after passed
|
||||
// to client_context constructor.
|
||||
// to client_state constructor.
|
||||
, mutex_()
|
||||
{ }
|
||||
~mock_client_context()
|
||||
~mock_client_state()
|
||||
{
|
||||
if (transaction().active())
|
||||
{
|
||||
@ -57,12 +57,12 @@ namespace wsrep
|
||||
, aborts_()
|
||||
{ }
|
||||
|
||||
int apply(wsrep::client_context&, const wsrep::const_buffer&) WSREP_OVERRIDE;
|
||||
int apply(wsrep::client_state&, const wsrep::const_buffer&) WSREP_OVERRIDE;
|
||||
|
||||
int commit(wsrep::client_context&, const wsrep::ws_handle&, const wsrep::ws_meta&)
|
||||
int commit(wsrep::client_state&, const wsrep::ws_handle&, const wsrep::ws_meta&)
|
||||
WSREP_OVERRIDE;
|
||||
|
||||
int rollback(wsrep::client_context&) WSREP_OVERRIDE;
|
||||
int rollback(wsrep::client_state&) WSREP_OVERRIDE;
|
||||
|
||||
bool is_autocommit() const WSREP_OVERRIDE
|
||||
{ return is_autocommit_; }
|
||||
@ -85,30 +85,30 @@ namespace wsrep
|
||||
WSREP_OVERRIDE { }
|
||||
|
||||
enum wsrep::provider::status
|
||||
replay(wsrep::client_context& client_context,
|
||||
replay(wsrep::client_state& client_state,
|
||||
wsrep::transaction_context& tc) WSREP_OVERRIDE
|
||||
{
|
||||
enum wsrep::provider::status ret(
|
||||
provider_.replay(tc.ws_handle(), &client_context));
|
||||
provider_.replay(tc.ws_handle(), &client_state));
|
||||
++replays_;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void wait_for_replayers(
|
||||
wsrep::client_context& client_context,
|
||||
wsrep::client_state& client_state,
|
||||
wsrep::unique_lock<wsrep::mutex>& lock)
|
||||
WSREP_OVERRIDE
|
||||
{
|
||||
lock.unlock();
|
||||
if (bf_abort_during_wait_)
|
||||
{
|
||||
wsrep_test::bf_abort_unordered(client_context);
|
||||
wsrep_test::bf_abort_unordered(client_state);
|
||||
}
|
||||
lock.lock();
|
||||
}
|
||||
|
||||
int prepare_data_for_replication(
|
||||
wsrep::client_context& client_context,
|
||||
wsrep::client_state& client_state,
|
||||
const wsrep::transaction_context&) WSREP_OVERRIDE
|
||||
{
|
||||
if (error_during_prepare_data_)
|
||||
@ -117,7 +117,7 @@ namespace wsrep
|
||||
}
|
||||
static const char buf[1] = { 1 };
|
||||
wsrep::const_buffer data = wsrep::const_buffer(buf, 1);
|
||||
return client_context.append_data(data);
|
||||
return client_state.append_data(data);
|
||||
}
|
||||
|
||||
size_t bytes_generated() const
|
||||
@ -126,7 +126,7 @@ namespace wsrep
|
||||
}
|
||||
|
||||
int prepare_fragment_for_replication(
|
||||
wsrep::client_context& client_context,
|
||||
wsrep::client_state& client_state,
|
||||
const wsrep::transaction_context&,
|
||||
wsrep::mutable_buffer& buffer)
|
||||
WSREP_OVERRIDE
|
||||
@ -138,12 +138,12 @@ namespace wsrep
|
||||
static const char buf[1] = { 1 };
|
||||
buffer.push_back(&buf[0], &buf[1]);
|
||||
wsrep::const_buffer data(buffer.data(), buffer.size());
|
||||
return client_context.append_data(data);
|
||||
return client_state.append_data(data);
|
||||
}
|
||||
|
||||
void store_globals() WSREP_OVERRIDE { }
|
||||
|
||||
void debug_sync(wsrep::client_context& client_context,
|
||||
void debug_sync(wsrep::client_state& client_state,
|
||||
const char* sync_point) WSREP_OVERRIDE
|
||||
{
|
||||
if (sync_point_enabled_ == sync_point)
|
||||
@ -151,10 +151,10 @@ namespace wsrep
|
||||
switch (sync_point_action_)
|
||||
{
|
||||
case spa_bf_abort_unordered:
|
||||
wsrep_test::bf_abort_unordered(client_context);
|
||||
wsrep_test::bf_abort_unordered(client_state);
|
||||
break;
|
||||
case spa_bf_abort_ordered:
|
||||
wsrep_test::bf_abort_ordered(client_context);
|
||||
wsrep_test::bf_abort_ordered(client_state);
|
||||
break;
|
||||
}
|
||||
}
|
@ -154,8 +154,8 @@ namespace wsrep
|
||||
|
||||
enum wsrep::provider::status replay(wsrep::ws_handle&, void* ctx)
|
||||
{
|
||||
wsrep::client_context& cc(
|
||||
*static_cast<wsrep::client_context*>(ctx));
|
||||
wsrep::client_state& cc(
|
||||
*static_cast<wsrep::client_state*>(ctx));
|
||||
wsrep::high_priority_context high_priority_context(cc);
|
||||
const wsrep::transaction_context& tc(cc.transaction());
|
||||
wsrep::ws_meta ws_meta;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define WSREP_MOCK_SERVER_CONTEXT_HPP
|
||||
|
||||
#include "wsrep/server_context.hpp"
|
||||
#include "mock_client_context.hpp"
|
||||
#include "mock_client_state.hpp"
|
||||
#include "mock_provider.hpp"
|
||||
|
||||
#include "wsrep/compiler.hpp"
|
||||
@ -29,24 +29,24 @@ namespace wsrep
|
||||
{ }
|
||||
wsrep::mock_provider& provider() const
|
||||
{ return provider_; }
|
||||
wsrep::client_context* local_client_context()
|
||||
wsrep::client_state* local_client_state()
|
||||
{
|
||||
return new wsrep::mock_client_context(
|
||||
return new wsrep::mock_client_state(
|
||||
*this, client_service_, ++last_client_id_,
|
||||
wsrep::client_context::m_local);
|
||||
wsrep::client_state::m_local);
|
||||
}
|
||||
wsrep::client_context* streaming_applier_client_context()
|
||||
wsrep::client_state* streaming_applier_client_state()
|
||||
{
|
||||
return new wsrep::mock_client_context(
|
||||
return new wsrep::mock_client_state(
|
||||
*this, client_service_, ++last_client_id_,
|
||||
wsrep::client_context::m_high_priority);
|
||||
wsrep::client_state::m_high_priority);
|
||||
}
|
||||
void release_client_context(wsrep::client_context* client_context)
|
||||
void release_client_state(wsrep::client_state* client_state)
|
||||
{
|
||||
delete client_context;
|
||||
delete client_state;
|
||||
}
|
||||
|
||||
void log_dummy_write_set(wsrep::client_context&,
|
||||
void log_dummy_write_set(wsrep::client_state&,
|
||||
const wsrep::ws_meta&)
|
||||
WSREP_OVERRIDE
|
||||
{
|
||||
@ -60,11 +60,11 @@ namespace wsrep
|
||||
void on_sst_request(const std::string&,
|
||||
const wsrep::gtid&,
|
||||
bool) WSREP_OVERRIDE { }
|
||||
void background_rollback(wsrep::client_context& client_context)
|
||||
void background_rollback(wsrep::client_state& client_state)
|
||||
WSREP_OVERRIDE
|
||||
{
|
||||
client_context.before_rollback();
|
||||
client_context.after_rollback();
|
||||
client_state.before_rollback();
|
||||
client_state.after_rollback();
|
||||
}
|
||||
// void sst_received(const wsrep_gtid_t&, int) WSREP_OVERRIDE { }
|
||||
// void on_apply(wsrep::transaction_context&) { }
|
||||
|
@ -15,7 +15,7 @@ namespace
|
||||
wsrep::server_context::rm_sync)
|
||||
, cc(sc, sc.client_service(),
|
||||
wsrep::client_id(1),
|
||||
wsrep::client_context::m_high_priority)
|
||||
wsrep::client_state::m_high_priority)
|
||||
, ws_handle(1, (void*)1)
|
||||
, ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
|
||||
wsrep::stid(wsrep::id("1"), 1, 1),
|
||||
@ -25,7 +25,7 @@ namespace
|
||||
{
|
||||
}
|
||||
wsrep::mock_server_context sc;
|
||||
wsrep::mock_client_context cc;
|
||||
wsrep::mock_client_state cc;
|
||||
wsrep::ws_handle ws_handle;
|
||||
wsrep::ws_meta ws_meta;
|
||||
};
|
||||
@ -86,10 +86,10 @@ BOOST_AUTO_TEST_CASE(server_context_streaming)
|
||||
{
|
||||
wsrep::mock_server_context sc("s1", "s1",
|
||||
wsrep::server_context::rm_sync);
|
||||
wsrep::mock_client_context cc(sc,
|
||||
wsrep::mock_client_state cc(sc,
|
||||
sc.client_service(),
|
||||
wsrep::client_id(1),
|
||||
wsrep::client_context::m_high_priority);
|
||||
wsrep::client_state::m_high_priority);
|
||||
wsrep::ws_handle ws_handle(1, (void*)1);
|
||||
wsrep::ws_meta ws_meta(wsrep::gtid(wsrep::id("1"), wsrep::seqno(1)),
|
||||
wsrep::stid(wsrep::id("1"), 1, 1),
|
||||
|
@ -3,18 +3,18 @@
|
||||
//
|
||||
|
||||
#include "test_utils.hpp"
|
||||
#include "wsrep/client_context.hpp"
|
||||
#include "wsrep/client_state.hpp"
|
||||
#include "mock_server_context.hpp"
|
||||
|
||||
|
||||
// Simple BF abort method to BF abort unordered transasctions
|
||||
void wsrep_test::bf_abort_unordered(wsrep::client_context& cc)
|
||||
void wsrep_test::bf_abort_unordered(wsrep::client_state& cc)
|
||||
{
|
||||
assert(cc.transaction().ordered() == false);
|
||||
cc.bf_abort(wsrep::seqno(1));
|
||||
}
|
||||
|
||||
void wsrep_test::bf_abort_ordered(wsrep::client_context& cc)
|
||||
void wsrep_test::bf_abort_ordered(wsrep::client_state& cc)
|
||||
{
|
||||
assert(cc.transaction().ordered());
|
||||
cc.bf_abort(wsrep::seqno(0));
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Forward declarations
|
||||
namespace wsrep
|
||||
{
|
||||
class client_context;
|
||||
class client_state;
|
||||
class mock_server_context;
|
||||
}
|
||||
|
||||
@ -19,10 +19,10 @@ namespace wsrep_test
|
||||
{
|
||||
|
||||
// Simple BF abort method to BF abort unordered transasctions
|
||||
void bf_abort_unordered(wsrep::client_context& cc);
|
||||
void bf_abort_unordered(wsrep::client_state& cc);
|
||||
|
||||
// Simple BF abort method to BF abort unordered transasctions
|
||||
void bf_abort_ordered(wsrep::client_context& cc);
|
||||
void bf_abort_ordered(wsrep::client_state& cc);
|
||||
|
||||
// BF abort method to abort transactions via provider
|
||||
void bf_abort_provider(wsrep::mock_server_context& sc,
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "wsrep/provider.hpp"
|
||||
|
||||
#include "test_utils.hpp"
|
||||
#include "client_context_fixture.hpp"
|
||||
#include "client_state_fixture.hpp"
|
||||
|
||||
#include <boost/mpl/vector.hpp>
|
||||
|
||||
@ -43,7 +43,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_append_key_data,
|
||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_1pc, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
// Start a new transaction with ID 1
|
||||
cc.start_transaction(1);
|
||||
@ -52,7 +52,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_1pc, T,
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
|
||||
// Verify that the commit can be succesfully executed in separate command
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
cc.after_command_before_result();
|
||||
cc.after_command_after_result();
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
|
||||
@ -85,7 +85,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_1pc, T,
|
||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(transaction_context_rollback, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -117,7 +117,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_bf_before_before_commit, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -159,7 +159,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -199,7 +199,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
wsrep::mock_client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -238,7 +238,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
wsrep::mock_client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -278,7 +278,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
wsrep::mock_client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -344,7 +344,7 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
|
||||
BOOST_REQUIRE(cc.before_commit());
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_error);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted);
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
@ -360,7 +360,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
wsrep::mock_client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -403,7 +403,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
wsrep::mock_client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
cc.start_transaction(1);
|
||||
@ -421,7 +421,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_error);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
@ -436,7 +436,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -477,7 +477,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -518,7 +518,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -559,7 +559,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -600,7 +600,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -641,7 +641,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
wsrep::mock_client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -683,7 +683,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
wsrep::mock_client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -725,7 +725,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
wsrep::mock_client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -766,7 +766,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_bf_before_before_statement, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -798,7 +798,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_bf_before_after_statement, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
// Start a new transaction with ID 1
|
||||
@ -820,13 +820,13 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_bf_abort_after_after_statement, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
cc.start_transaction(1);
|
||||
BOOST_REQUIRE(tc.active());
|
||||
cc.after_statement();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_exec);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
|
||||
wsrep_test::bf_abort_unordered(cc);
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
|
||||
BOOST_REQUIRE(tc.active());
|
||||
@ -853,25 +853,25 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error);
|
||||
BOOST_REQUIRE(cc.before_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_may_retry);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_may_retry);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_exec);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_bf_abort_after_after_command_before_result, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::client_context& cc(T::cc);
|
||||
wsrep::client_state& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
cc.start_transaction(1);
|
||||
BOOST_REQUIRE(tc.active());
|
||||
cc.after_statement();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_exec);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
|
||||
cc.after_command_before_result();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_result);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_result);
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
|
||||
wsrep_test::bf_abort_unordered(cc);
|
||||
// The result is being sent to client. We need to mark transaction
|
||||
@ -882,7 +882,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
// After the result has been sent to the DBMS client, the after result
|
||||
// processing should roll back the transaction and set the error.
|
||||
cc.after_command_after_result();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_idle);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_idle);
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error);
|
||||
BOOST_REQUIRE(tc.active() == true);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted);
|
||||
@ -902,11 +902,11 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
cc.start_transaction(1);
|
||||
BOOST_REQUIRE(tc.active());
|
||||
cc.after_statement();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_exec);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
|
||||
cc.after_command_before_result();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_result);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_result);
|
||||
cc.after_command_after_result();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_idle);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_idle);
|
||||
wsrep_test::bf_abort_unordered(cc);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted);
|
||||
BOOST_REQUIRE(tc.active());
|
||||
@ -927,11 +927,11 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
cc.start_transaction(1);
|
||||
BOOST_REQUIRE(tc.active());
|
||||
cc.after_statement();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_exec);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_exec);
|
||||
cc.after_command_before_result();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_result);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_result);
|
||||
cc.after_command_after_result();
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_context::s_idle);
|
||||
BOOST_REQUIRE(cc.state() == wsrep::client_state::s_idle);
|
||||
wsrep_test::bf_abort_unordered(cc);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_abort);
|
||||
BOOST_REQUIRE(tc.active());
|
||||
@ -990,7 +990,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_1pc_commit,
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -1012,7 +1012,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_batch_streaming_1pc_commit,
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -1028,14 +1028,14 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
BOOST_REQUIRE(cc.start_transaction(1) == 0);
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(cc.before_statement() == 0);
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 2);
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 3);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -1052,7 +1052,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_rollback,
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1);
|
||||
BOOST_REQUIRE(cc.before_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
||||
@ -1072,7 +1072,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_cert_fail_non_commit,
|
||||
sc.provider().certify_result_ = wsrep::provider::success;
|
||||
BOOST_REQUIRE(cc.before_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
|
||||
@ -1093,7 +1093,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_cert_fail_commit,
|
||||
sc.provider().certify_result_ = wsrep::provider::success;
|
||||
BOOST_REQUIRE(cc.before_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_error);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
@ -1116,7 +1116,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_bf_abort_committing,
|
||||
BOOST_REQUIRE(cc.before_rollback() == 0);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
@ -1135,7 +1135,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_byte_streaming_1pc_commit,
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -1157,7 +1157,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_byte_batch_streaming_1pc_commit,
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -1173,13 +1173,13 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_statement_streaming_1pc_commit,
|
||||
BOOST_REQUIRE(cc.start_transaction(1) == 0);
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1);
|
||||
BOOST_REQUIRE(cc.before_statement() == 0);
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -1194,18 +1194,18 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_statement_batch_streaming_1pc_commit
|
||||
BOOST_REQUIRE(cc.start_transaction(1) == 0);
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 0);
|
||||
BOOST_REQUIRE(cc.before_statement() == 0);
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1);
|
||||
BOOST_REQUIRE(cc.before_statement() == 0);
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -1221,7 +1221,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_statement_streaming_cert_fail,
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 0);
|
||||
sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_error);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error);
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_deadlock_error);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 0);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 0);
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2018 Codership Oy <info@codership.com>
|
||||
//
|
||||
|
||||
#include "client_context_fixture.hpp"
|
||||
#include "client_state_fixture.hpp"
|
||||
|
||||
//
|
||||
// Test a succesful 2PC transaction lifecycle
|
||||
@ -24,7 +24,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_2pc,
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_ordered_commit);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
@ -51,7 +51,7 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_error);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
@ -80,7 +80,7 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborting);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_aborted);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_error);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_error);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
@ -108,7 +108,7 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
@ -140,7 +140,7 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
@ -172,7 +172,7 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
BOOST_REQUIRE(cc.after_rollback() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
@ -195,7 +195,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_streaming_2pc_commit,
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 2);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -207,7 +207,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_streaming_2pc_commit_two_statements,
|
||||
BOOST_REQUIRE(cc.start_transaction(1) == 0);
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(cc.before_statement() == 0);
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 2);
|
||||
@ -216,7 +216,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_streaming_2pc_commit_two_statements,
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
BOOST_REQUIRE(cc.ordered_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(sc.provider().fragments() == 3);
|
||||
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
|
||||
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
|
||||
@ -239,7 +239,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_2pc_applying,
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_ordered_commit);
|
||||
BOOST_REQUIRE(cc.after_commit() == 0);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_context::asr_success);
|
||||
BOOST_REQUIRE(cc.after_statement() == wsrep::client_state::asr_success);
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
|
||||
|
Reference in New Issue
Block a user