mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
SR applying implementation, unit tests.
This commit is contained in:
@ -108,8 +108,6 @@ namespace
|
||||
wsrep::provider::flag::start_transaction |
|
||||
wsrep::provider::flag::commit);
|
||||
BOOST_REQUIRE(cc.start_transaction(ws_handle, ws_meta) == 0);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(cc.start_transaction() == 0);
|
||||
BOOST_REQUIRE(tc.active() == true);
|
||||
BOOST_REQUIRE(tc.certified() == true);
|
||||
BOOST_REQUIRE(tc.ordered() == true);
|
||||
@ -138,8 +136,6 @@ namespace
|
||||
wsrep::provider::flag::start_transaction |
|
||||
wsrep::provider::flag::commit);
|
||||
BOOST_REQUIRE(cc.start_transaction(ws_handle, ws_meta) == 0);
|
||||
BOOST_REQUIRE(tc.active() == false);
|
||||
BOOST_REQUIRE(cc.start_transaction() == 0);
|
||||
BOOST_REQUIRE(tc.active() == true);
|
||||
BOOST_REQUIRE(tc.certified() == true);
|
||||
BOOST_REQUIRE(tc.ordered() == true);
|
||||
|
@ -33,13 +33,15 @@ namespace wsrep
|
||||
return new wsrep::fake_client_context(*this, ++last_client_id_,
|
||||
wsrep::client_context::m_local);
|
||||
}
|
||||
wsrep::client_context& streaming_applier_client_context(
|
||||
const wsrep::id& server_id,
|
||||
const wsrep::transaction_id& transaction_id)
|
||||
wsrep::client_context* streaming_applier_client_context()
|
||||
{
|
||||
wsrep::client_context* sac(new wsrep::fake_client_context(*this, ++last_client_id_, wsrep::client_context::m_applier));
|
||||
insert_streaming_applier(server_id, transaction_id, sac);
|
||||
return *sac;
|
||||
return new wsrep::fake_client_context(
|
||||
*this, ++last_client_id_, wsrep::client_context::m_applier);
|
||||
}
|
||||
void log_dummy_write_set(wsrep::client_context&, const wsrep::ws_meta&)
|
||||
WSREP_OVERRIDE
|
||||
{
|
||||
//
|
||||
}
|
||||
void on_connect() WSREP_OVERRIDE { }
|
||||
void wait_until_connected() WSREP_OVERRIDE { }
|
||||
|
@ -24,7 +24,6 @@ namespace
|
||||
wsrep::provider::flag::start_transaction |
|
||||
wsrep::provider::flag::commit)
|
||||
{
|
||||
cc.start_transaction(ws_handle, ws_meta);
|
||||
}
|
||||
wsrep::fake_server_context sc;
|
||||
wsrep::fake_client_context cc;
|
||||
@ -84,6 +83,40 @@ BOOST_FIXTURE_TEST_CASE(server_context_applying_2pc_rollback,
|
||||
BOOST_REQUIRE(txc.state() == wsrep::transaction_context::s_aborted);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(server_context_streaming)
|
||||
{
|
||||
wsrep::fake_server_context sc("s1", "s1",
|
||||
wsrep::server_context::rm_sync);
|
||||
wsrep::fake_client_context cc(sc,
|
||||
wsrep::client_id(1),
|
||||
wsrep::client_context::m_applier,
|
||||
false);
|
||||
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),
|
||||
wsrep::seqno(0),
|
||||
wsrep::provider::flag::start_transaction);
|
||||
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
BOOST_REQUIRE(sc.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::seqno(1),
|
||||
0);
|
||||
BOOST_REQUIRE(sc.on_apply(cc, 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::seqno(1),
|
||||
wsrep::provider::flag::commit);
|
||||
BOOST_REQUIRE(sc.on_apply(cc, ws_handle, ws_meta,
|
||||
wsrep::const_buffer("1", 1)) == 0);
|
||||
BOOST_REQUIRE(sc.find_streaming_applier(
|
||||
ws_meta.server_id(), ws_meta.transaction_id()) == 0);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(server_context_state_strings)
|
||||
{
|
||||
BOOST_REQUIRE(wsrep::to_string(
|
||||
|
Reference in New Issue
Block a user