diff --git a/dbsim/db_client_service.hpp b/dbsim/db_client_service.hpp index 08e848d..ecf174a 100644 --- a/dbsim/db_client_service.hpp +++ b/dbsim/db_client_service.hpp @@ -50,6 +50,8 @@ namespace db return 0; } + void cleanup_transaction() override { } + size_t bytes_generated() const override { return 0; diff --git a/dbsim/db_server_service.cpp b/dbsim/db_server_service.cpp index a5e2070..9073366 100644 --- a/dbsim/db_server_service.cpp +++ b/dbsim/db_server_service.cpp @@ -29,7 +29,7 @@ void db::server_service::release_client_state( bool db::server_service::sst_before_init() const { - return false; + return true; } std::string db::server_service::sst_request() diff --git a/dbsim/db_simulator.cpp b/dbsim/db_simulator.cpp index f98ad2c..262ba23 100644 --- a/dbsim/db_simulator.cpp +++ b/dbsim/db_simulator.cpp @@ -36,7 +36,9 @@ void db::simulator::sst(db::server& server, { wsrep::log_info() << "SST " << server.server_state().id() << " -> " << id; } - i->second->server_state().sst_received(gtid, 0); + i->second->server_state().sst_transferred(gtid); + i->second->server_state().initialized(); + // i->second->server_state().sst_received(gtid, 0); server.server_state().sst_sent(gtid, 0); } @@ -116,6 +118,8 @@ void db::simulator::start() throw wsrep::runtime_error("Failed to connect"); } server.start_applier(); + server.server_state().wait_until_state(wsrep::server_state::s_initializing); + server.server_state().initialized(); server.server_state().wait_until_state( wsrep::server_state::s_synced); } diff --git a/include/wsrep/client_service.hpp b/include/wsrep/client_service.hpp index e284564..f97f791 100644 --- a/include/wsrep/client_service.hpp +++ b/include/wsrep/client_service.hpp @@ -63,6 +63,11 @@ namespace wsrep */ virtual int prepare_data_for_replication() = 0; + /** + * Clean up after transcation has been terminated. + */ + virtual void cleanup_transaction() = 0; + // // Streaming // diff --git a/src/exception.cpp b/src/exception.cpp index 2a7a3b6..e7ae9f8 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -4,4 +4,4 @@ #include "wsrep/exception.hpp" -bool wsrep::abort_on_exception(true); +bool wsrep::abort_on_exception(false); diff --git a/src/server_state.cpp b/src/server_state.cpp index 387cec3..3bc8345 100644 --- a/src/server_state.cpp +++ b/src/server_state.cpp @@ -175,8 +175,9 @@ namespace return ret; } - int apply_toi(wsrep::server_service&, + int apply_toi(wsrep::provider& provider, wsrep::client_state& client_state, + const wsrep::ws_handle& ws_handle, const wsrep::ws_meta& ws_meta, const wsrep::const_buffer& data) { @@ -184,9 +185,11 @@ namespace wsrep::commits_transaction(ws_meta.flags())) { // Regular toi + provider.commit_order_enter(ws_handle, ws_meta); client_state.enter_toi(ws_meta); int ret(client_state.client_service().apply_toi(data)); client_state.leave_toi(); + provider.commit_order_leave(ws_handle, ws_meta); return ret; } else if (wsrep::starts_transaction(ws_meta.flags())) @@ -507,7 +510,7 @@ int wsrep::server_state::on_apply( { if (is_toi(ws_meta.flags())) { - return apply_toi(server_service_, client_state, ws_meta, data); + return apply_toi(provider(), client_state, ws_handle, ws_meta, data); } else if (is_commutative(ws_meta.flags()) || is_native(ws_meta.flags())) { diff --git a/src/transaction.cpp b/src/transaction.cpp index 828662d..da69ee8 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -959,6 +959,7 @@ void wsrep::transaction::cleanup() ws_meta_ = wsrep::ws_meta(); certified_ = false; pa_unsafe_ = false; + client_service_.cleanup_transaction(); debug_log_state("cleanup_leave"); } diff --git a/test/mock_client_state.hpp b/test/mock_client_state.hpp index bbd57e4..d939ab4 100644 --- a/test/mock_client_state.hpp +++ b/test/mock_client_state.hpp @@ -122,6 +122,7 @@ namespace wsrep return client_state_.append_data(data); } + void cleanup_transaction() WSREP_OVERRIDE { } size_t bytes_generated() const { return bytes_generated_;