1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-06-13 04:01:32 +03:00

Fixes required to 1PC streaming replay to pass.

This commit is contained in:
Teemu Ollakka
2018-06-13 14:33:58 +03:00
parent 6677e3cfd8
commit 4ccd1490d4
3 changed files with 28 additions and 6 deletions

View File

@ -164,9 +164,23 @@ int wsrep::server_context::on_apply(
assert(ret ||
txc.state() == wsrep::transaction_context::s_committed);
}
else if (commits_transaction(ws_meta.flags()))
{
if (not_replaying)
{
// SR commit not implemented yet
assert(0);
}
else
{
ret = client_context.start_replaying() ||
client_context.apply(wsrep::const_buffer()) ||
client_context.commit();
}
}
else
{
// SR not implemented yet
// SR fragment applying not implemented yet
assert(0);
}
if (not_replaying)

View File

@ -168,6 +168,7 @@ int wsrep::transaction_context::before_prepare(
break;
case wsrep::client_context::m_local:
case wsrep::client_context::m_applier:
client_context_.remove_fragments(*this);
break;
default:
assert(0);
@ -294,6 +295,10 @@ int wsrep::transaction_context::before_commit()
case wsrep::client_context::m_applier:
assert(certified());
assert(ordered());
if (client_context_.do_2pc() == false)
{
client_context_.remove_fragments(*this);
}
ret = provider_.commit_order_enter(ws_handle_, ws_meta_);
if (ret)
{
@ -343,16 +348,19 @@ int wsrep::transaction_context::after_commit()
debug_log_state("after_commit_enter");
assert(state() == s_ordered_commit);
if (is_streaming())
{
assert(client_context_.mode() == wsrep::client_context::m_replicating ||
client_context_.mode() == wsrep::client_context::m_applier);
clear_fragments();
}
switch (client_context_.mode())
{
case wsrep::client_context::m_local:
// Nothing to do
break;
case wsrep::client_context::m_replicating:
if (is_streaming())
{
clear_fragments();
}
ret = provider_.release(ws_handle_);
break;
case wsrep::client_context::m_applier:

View File

@ -1020,7 +1020,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_context_row_streaming_bf_abort_committing,
BOOST_REQUIRE(tc.state() == wsrep::transaction_context::s_committed);
BOOST_REQUIRE(sc.provider().fragments() == 2);
BOOST_REQUIRE(sc.provider().start_fragments() == 1);
BOOST_REQUIRE(sc.provider().rollback_fragments() == 1);
BOOST_REQUIRE(sc.provider().commit_fragments() == 1);
}