mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
Refactored client_service interface out of client_context
This commit is contained in:
@ -198,6 +198,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_bf_during_commit_wait_for_replayers, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
@ -207,7 +208,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
|
||||
cc.bf_abort_during_wait_ = true;
|
||||
sc.client_service().bf_abort_during_wait_ = true;
|
||||
|
||||
// Run before commit
|
||||
BOOST_REQUIRE(cc.before_commit());
|
||||
@ -236,6 +237,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_error_during_prepare_data, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
@ -245,7 +247,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
|
||||
cc.error_during_prepare_data_ = true;
|
||||
sc.client_service().error_during_prepare_data_ = true;
|
||||
|
||||
// Run before commit
|
||||
BOOST_REQUIRE(cc.before_commit());
|
||||
@ -275,6 +277,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_killed_before_certify, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
@ -284,7 +287,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
|
||||
cc.killed_before_certify_ = true;
|
||||
sc.client_service().killed_before_certify_ = true;
|
||||
|
||||
// Run before commit
|
||||
BOOST_REQUIRE(cc.before_commit());
|
||||
@ -386,7 +389,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
|
||||
BOOST_REQUIRE(cc.replays() == 1);
|
||||
BOOST_REQUIRE(sc.client_service().replays() == 1);
|
||||
}
|
||||
|
||||
//
|
||||
@ -407,8 +410,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
BOOST_REQUIRE(tc.active());
|
||||
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
cc.sync_point_enabled_ = "wsrep_before_certification";
|
||||
cc.sync_point_action_ = wsrep::mock_client_context::spa_bf_abort_unordered;
|
||||
sc.client_service().sync_point_enabled_ = "wsrep_before_certification";
|
||||
sc.client_service().sync_point_action_ = wsrep::mock_client_service::spa_bf_abort_unordered;
|
||||
sc.provider().certify_result_ = wsrep::provider::error_certification_failed;
|
||||
BOOST_REQUIRE(cc.before_commit());
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_cert_failed);
|
||||
@ -669,7 +672,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
BOOST_REQUIRE(cc.current_error() == wsrep::e_error_during_commit);
|
||||
BOOST_REQUIRE(cc.aborts() == 1);
|
||||
BOOST_REQUIRE(sc.client_service().aborts() == 1);
|
||||
}
|
||||
|
||||
//
|
||||
@ -721,7 +724,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
transaction_context_1pc_bf_abort_before_certify_regain_lock, T,
|
||||
replicating_fixtures, T)
|
||||
{
|
||||
// wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_server_context& sc(T::sc);
|
||||
wsrep::mock_client_context& cc(T::cc);
|
||||
const wsrep::transaction_context& tc(T::tc);
|
||||
|
||||
@ -731,8 +734,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
BOOST_REQUIRE(tc.id() == wsrep::transaction_id(1));
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_executing);
|
||||
|
||||
cc.sync_point_enabled_ = "wsrep_after_certification";
|
||||
cc.sync_point_action_ = wsrep::mock_client_context::spa_bf_abort_ordered;
|
||||
sc.client_service().sync_point_enabled_ = "wsrep_after_certification";
|
||||
sc.client_service().sync_point_action_ = wsrep::mock_client_service::spa_bf_abort_ordered;
|
||||
// Run before commit
|
||||
BOOST_REQUIRE(cc.before_commit());
|
||||
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_must_replay);
|
||||
@ -747,7 +750,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(
|
||||
|
||||
// Cleanup after statement
|
||||
cc.after_statement();
|
||||
BOOST_REQUIRE(cc.replays() == 1);
|
||||
BOOST_REQUIRE(sc.client_service().replays() == 1);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(tc.ordered() == false);
|
||||
BOOST_REQUIRE(tc.certified() == false);
|
||||
@ -1126,7 +1129,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_byte_streaming_1pc_commit,
|
||||
streaming_client_fixture_byte)
|
||||
{
|
||||
BOOST_REQUIRE(cc.start_transaction(1) == 0);
|
||||
cc.bytes_generated_ = 1;
|
||||
sc.client_service().bytes_generated_ = 1;
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1);
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
@ -1145,10 +1148,10 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_byte_batch_streaming_1pc_commit,
|
||||
cc.enable_streaming(
|
||||
wsrep::streaming_context::bytes, 2) == 0);
|
||||
BOOST_REQUIRE(cc.start_transaction(1) == 0);
|
||||
cc.bytes_generated_ = 1;
|
||||
sc.client_service().bytes_generated_ = 1;
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 0);
|
||||
cc.bytes_generated_ = 2;
|
||||
sc.client_service().bytes_generated_ = 2;
|
||||
BOOST_REQUIRE(cc.after_row() == 0);
|
||||
BOOST_REQUIRE(tc.streaming_context_.fragments_certified() == 1);
|
||||
BOOST_REQUIRE(cc.before_commit() == 0);
|
||||
|
Reference in New Issue
Block a user