diff --git a/include/wsrep/transaction.hpp b/include/wsrep/transaction.hpp index 26fff7b..c5e65df 100644 --- a/include/wsrep/transaction.hpp +++ b/include/wsrep/transaction.hpp @@ -267,7 +267,6 @@ namespace wsrep enum state state_; std::vector state_hist_; enum state bf_abort_state_; - enum wsrep::provider::status bf_abort_provider_status_; int bf_abort_client_state_; bool bf_aborted_in_total_order_; wsrep::ws_handle ws_handle_; diff --git a/src/transaction.cpp b/src/transaction.cpp index c864a0f..a195e8e 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -98,7 +98,6 @@ wsrep::transaction::transaction( , state_(s_executing) , state_hist_() , bf_abort_state_(s_executing) - , bf_abort_provider_status_() , bf_abort_client_state_() , bf_aborted_in_total_order_() , ws_handle_() @@ -1799,6 +1798,8 @@ int wsrep::transaction::certify_commit( lock.lock(); + wsrep::log_info() << "Certify commit ret: " << cert_ret; + assert(state() == s_certifying || state() == s_must_abort); int ret(1); @@ -2084,7 +2085,6 @@ void wsrep::transaction::cleanup() client_state_.update_last_written_gtid(ws_meta_.gtid()); } bf_abort_state_ = s_executing; - bf_abort_provider_status_ = wsrep::provider::success; bf_abort_client_state_ = 0; bf_aborted_in_total_order_ = false; ws_meta_ = wsrep::ws_meta(); diff --git a/test/mock_server_state.hpp b/test/mock_server_state.hpp index fabdf6b..4ddf46c 100644 --- a/test/mock_server_state.hpp +++ b/test/mock_server_state.hpp @@ -106,6 +106,7 @@ namespace wsrep static_cast(high_priority_service)); wsrep::mock_client* cs(&static_cast( mhps->client_state())); + cs->after_applying(); cs->after_command_before_result(); cs->after_command_after_result(); cs->close(); diff --git a/test/transaction_test.cpp b/test/transaction_test.cpp index a6f54e5..5762ff0 100644 --- a/test/transaction_test.cpp +++ b/test/transaction_test.cpp @@ -1488,6 +1488,27 @@ BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_cert_fail_commit, server_service.release_high_priority_service(hps); } +// +// Test streaming BF abort on commit fragment which fails certification +// +BOOST_FIXTURE_TEST_CASE(transaction_row_streaming_bf_abort_commit_cert_fail, + streaming_client_fixture_row) +{ + BOOST_REQUIRE(cc.start_transaction(wsrep::transaction_id(1)) == 0); + BOOST_REQUIRE(cc.after_row() == 0); + BOOST_REQUIRE(tc.streaming_context().fragments_certified() == 1); + sc.provider().certify_result_ = wsrep::provider::error_bf_abort; + BOOST_REQUIRE(cc.before_commit() == 1); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_must_replay); + sc.provider().replay_result_ = wsrep::provider::error_certification_failed; + BOOST_REQUIRE(cc.before_rollback() == 0); + BOOST_REQUIRE(cc.after_rollback() == 0); + BOOST_REQUIRE(cc.after_statement() ); + BOOST_REQUIRE(tc.state() == wsrep::transaction::s_aborted); + BOOST_REQUIRE(sc.provider().fragments() == 1); + BOOST_REQUIRE(sc.provider().start_fragments() == 1); +} + // // Test streaming BF abort after succesful certification //