1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-10-19 12:09:20 +03:00

SR applying implementation, unit tests.

This commit is contained in:
Teemu Ollakka
2018-06-14 11:14:40 +03:00
parent 39c9ef8a63
commit a8ab9c6dbd
9 changed files with 188 additions and 49 deletions

View File

@@ -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(