mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-21 12:22:06 +03:00
Add provider position field to ws_meta and view
Provider position is needed in coordinated recovery between application and provider. Pass the position info from provider to application to allow making it durable.
This commit is contained in:
@ -39,7 +39,8 @@ namespace
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(0),
|
||||
wsrep::provider::flag::start_transaction |
|
||||
wsrep::provider::flag::commit)
|
||||
wsrep::provider::flag::commit,
|
||||
0)
|
||||
, cluster_id("1")
|
||||
, bootstrap_view()
|
||||
, second_view()
|
||||
@ -55,7 +56,8 @@ namespace
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members);
|
||||
members,
|
||||
0);
|
||||
|
||||
members.push_back(wsrep::view::member(
|
||||
wsrep::id("s2"), "s2", ""));
|
||||
@ -65,7 +67,8 @@ namespace
|
||||
0, // capabilities
|
||||
1, // own index
|
||||
1, // protocol version
|
||||
members);
|
||||
members,
|
||||
0);
|
||||
|
||||
members.push_back(wsrep::view::member(
|
||||
wsrep::id("s3"), "s3", ""));
|
||||
@ -76,7 +79,8 @@ namespace
|
||||
0, // capabilities
|
||||
1, // own index
|
||||
1, // protocol version
|
||||
members);
|
||||
members,
|
||||
0);
|
||||
|
||||
cc.open(cc.id());
|
||||
BOOST_REQUIRE(cc.before_command() == 0);
|
||||
@ -114,7 +118,8 @@ namespace
|
||||
0, // capabilities
|
||||
-1, // own_index
|
||||
0, // protocol ver
|
||||
std::vector<wsrep::view::member>() // members
|
||||
std::vector<wsrep::view::member>(),// members
|
||||
0
|
||||
);
|
||||
ss.on_view(view, &hps);
|
||||
}
|
||||
@ -272,7 +277,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_streaming, applying_server_fixture)
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(0),
|
||||
wsrep::provider::flag::start_transaction);
|
||||
wsrep::provider::flag::start_transaction,
|
||||
0);
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
BOOST_REQUIRE(ss.find_streaming_applier(
|
||||
@ -282,6 +288,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_streaming, applying_server_fixture)
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(1),
|
||||
0,
|
||||
0);
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
@ -290,7 +297,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_streaming, applying_server_fixture)
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(1),
|
||||
wsrep::provider::flag::commit);
|
||||
wsrep::provider::flag::commit,
|
||||
0);
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
BOOST_REQUIRE(ss.find_streaming_applier(
|
||||
@ -395,7 +403,8 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members);
|
||||
members,
|
||||
0);
|
||||
ss.on_connect(view);
|
||||
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_connected);
|
||||
// As storage engines have been initialized, there should not be
|
||||
@ -556,7 +565,8 @@ BOOST_FIXTURE_TEST_CASE(
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members);
|
||||
members,
|
||||
0);
|
||||
ss.on_connect(view);
|
||||
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_connected);
|
||||
// As storage engines have been initialized, there should not be
|
||||
@ -688,7 +698,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(1),
|
||||
wsrep::provider::flag::start_transaction);
|
||||
wsrep::provider::flag::start_transaction,
|
||||
0);
|
||||
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s2,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
@ -701,7 +712,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(2),
|
||||
wsrep::provider::flag::start_transaction);
|
||||
wsrep::provider::flag::start_transaction,
|
||||
0);
|
||||
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s3,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
@ -717,7 +729,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members), &hps);
|
||||
members,
|
||||
0), &hps);
|
||||
|
||||
// transaction from s2 is still present
|
||||
BOOST_REQUIRE(ss.find_streaming_applier(
|
||||
@ -735,7 +748,7 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members), &hps);
|
||||
members, 0), &hps);
|
||||
|
||||
// no streaming appliers are closed on non-primary view,
|
||||
// so transaction from s2 is still present
|
||||
@ -750,7 +763,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members), &hps);
|
||||
members,
|
||||
0), &hps);
|
||||
|
||||
// transaction s2 is still present after non-primary view
|
||||
BOOST_REQUIRE(ss.find_streaming_applier(
|
||||
@ -764,7 +778,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members), &hps);
|
||||
members,
|
||||
0), &hps);
|
||||
|
||||
// finally, transaction from s2 is still present (part of primary view)
|
||||
// and transaction from s3 is gone
|
||||
@ -779,7 +794,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_close_orphaned_transactions,
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(3),
|
||||
wsrep::provider::flag::commit);
|
||||
wsrep::provider::flag::commit,
|
||||
0);
|
||||
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_commit_s2,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
@ -806,7 +822,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_equal_consecutive_views,
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(1),
|
||||
wsrep::provider::flag::start_transaction);
|
||||
wsrep::provider::flag::start_transaction,
|
||||
0);
|
||||
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s2,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
@ -819,7 +836,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_equal_consecutive_views,
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(2),
|
||||
wsrep::provider::flag::start_transaction);
|
||||
wsrep::provider::flag::start_transaction,
|
||||
0);
|
||||
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s3,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
@ -833,7 +851,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_equal_consecutive_views,
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
ss.current_view().members()), &hps);
|
||||
ss.current_view().members(),
|
||||
0), &hps);
|
||||
|
||||
// transaction from s2 and s3 are gone
|
||||
BOOST_REQUIRE(not ss.find_streaming_applier(
|
||||
@ -862,7 +881,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_xa_not_orphaned,
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(1),
|
||||
wsrep::provider::flag::start_transaction |
|
||||
wsrep::provider::flag::prepare);
|
||||
wsrep::provider::flag::prepare,
|
||||
0);
|
||||
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_s3,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
@ -879,7 +899,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_xa_not_orphaned,
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members), &hps);
|
||||
members,
|
||||
0), &hps);
|
||||
|
||||
// transaction from s3 is still present
|
||||
BOOST_REQUIRE(ss.find_streaming_applier(
|
||||
@ -893,7 +914,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_xa_not_orphaned,
|
||||
0, // capabilities
|
||||
0, // own index
|
||||
1, // protocol version
|
||||
members), &hps);
|
||||
members,
|
||||
0), &hps);
|
||||
|
||||
// transaction from s3 is still present
|
||||
BOOST_REQUIRE(ss.find_streaming_applier(
|
||||
@ -905,7 +927,8 @@ BOOST_FIXTURE_TEST_CASE(server_state_xa_not_orphaned,
|
||||
wsrep::transaction_id(1),
|
||||
wsrep::client_id(1)),
|
||||
wsrep::seqno(3),
|
||||
wsrep::provider::flag::commit);
|
||||
wsrep::provider::flag::commit,
|
||||
0);
|
||||
|
||||
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, meta_commit_s3,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
|
Reference in New Issue
Block a user