diff --git a/src/server_context.cpp b/src/server_context.cpp index 7e72bfa..1b28210 100644 --- a/src/server_context.cpp +++ b/src/server_context.cpp @@ -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) diff --git a/src/transaction_context.cpp b/src/transaction_context.cpp index e28b832..d99aabb 100644 --- a/src/transaction_context.cpp +++ b/src/transaction_context.cpp @@ -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: diff --git a/test/transaction_context_test.cpp b/test/transaction_context_test.cpp index 0c728cf..48d054f 100644 --- a/test/transaction_context_test.cpp +++ b/test/transaction_context_test.cpp @@ -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); }