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

Fixes to local streaming replication processing.

This commit is contained in:
Teemu Ollakka
2018-07-08 15:27:49 +03:00
parent 2913aecebd
commit 7c424d8337
12 changed files with 122 additions and 75 deletions

View File

@ -64,5 +64,5 @@ int wsrep::mock_high_priority_service::apply_toi(const wsrep::ws_meta&,
void wsrep::mock_high_priority_service::after_apply()
{
client_state_->after_statement();
client_state_->after_applying();
}

View File

@ -28,29 +28,30 @@ wsrep::mock_storage_service::~mock_storage_service()
client_state_.cleanup();
}
int wsrep::mock_storage_service::start_transaction()
int wsrep::mock_storage_service::start_transaction(const wsrep::ws_handle& ws_handle)
{
return client_state_.start_transaction(
server_state_.next_transaction_id());
return client_state_.start_transaction(ws_handle.transaction_id());
}
int wsrep::mock_storage_service::commit(const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta)
{
return client_state_.prepare_for_fragment_ordering(
ws_handle, ws_meta, true) ||
client_state_.before_commit() ||
client_state_.ordered_commit() ||
client_state_.after_commit() ||
client_state_.after_statement();
int ret(client_state_.prepare_for_fragment_ordering(
ws_handle, ws_meta, true) ||
client_state_.before_commit() ||
client_state_.ordered_commit() ||
client_state_.after_commit());
client_state_.after_applying();
return ret;
}
int wsrep::mock_storage_service::rollback(const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta)
{
return client_state_.prepare_for_fragment_ordering(
ws_handle, ws_meta, false) ||
client_state_.before_rollback() ||
client_state_.after_rollback() ||
client_state_.after_statement();
int ret(client_state_.prepare_for_fragment_ordering(
ws_handle, ws_meta, false) ||
client_state_.before_rollback() ||
client_state_.after_rollback());
client_state_.after_applying();
return ret;
}

View File

@ -18,7 +18,7 @@ class mock_server_state;
wsrep::client_id);
~mock_storage_service();
int start_transaction() WSREP_OVERRIDE;
int start_transaction(const wsrep::ws_handle&) WSREP_OVERRIDE;
int append_fragment(const wsrep::id&,
wsrep::transaction_id,

View File

@ -172,7 +172,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_sst_first_boostrap,
wsrep::id cluster_id("1");
wsrep::gtid state_id(cluster_id, wsrep::seqno(0));
std::vector<wsrep::view::member> members;
members.push_back(wsrep::view::member(wsrep::id("1"), "name", ""));
members.push_back(wsrep::view::member(wsrep::id("s1"), "name", ""));
wsrep::view bootstrap_view(state_id,
wsrep::seqno(1),
wsrep::view::primary,
@ -198,7 +198,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_init_first_boostrap,
wsrep::id cluster_id("1");
wsrep::gtid state_id(cluster_id, wsrep::seqno(0));
std::vector<wsrep::view::member> members;
members.push_back(wsrep::view::member(wsrep::id("1"), "name", ""));
members.push_back(wsrep::view::member(wsrep::id("s1"), "name", ""));
wsrep::view bootstrap_view(state_id,
wsrep::seqno(1),
wsrep::view::primary,

View File

@ -950,7 +950,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_1pc_applying,
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_ordered_commit);
BOOST_REQUIRE(cc.after_commit() == 0);
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed);
cc.after_statement();
cc.after_applying();
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed);
BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(cc.current_error() == wsrep::e_success);
@ -964,7 +964,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_applying_rollback,
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborting);
BOOST_REQUIRE(cc.after_rollback() == 0);
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
cc.after_statement();
cc.after_applying();
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted);
BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(cc.current_error() == wsrep::e_success);

View File

@ -239,7 +239,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_2pc_applying,
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_ordered_commit);
BOOST_REQUIRE(cc.after_commit() == 0);
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed);
BOOST_REQUIRE(cc.after_statement() == 0);
cc.after_applying();
BOOST_REQUIRE(tc.state() == wsrep::transaction::s_committed);
BOOST_REQUIRE(tc.active() == false);
BOOST_REQUIRE(cc.current_error() == wsrep::e_success);