diff --git a/dbsim/db_simulator.cpp b/dbsim/db_simulator.cpp index 262ba23..2fe7562 100644 --- a/dbsim/db_simulator.cpp +++ b/dbsim/db_simulator.cpp @@ -19,9 +19,9 @@ void db::simulator::run() } void db::simulator::sst(db::server& server, - const std::string& request, - const wsrep::gtid& gtid, - bool bypass) + const std::string& request, + const wsrep::gtid& gtid, + bool bypass) { size_t id; std::istringstream is(request); @@ -37,7 +37,7 @@ void db::simulator::sst(db::server& server, wsrep::log_info() << "SST " << server.server_state().id() << " -> " << id; } i->second->server_state().sst_transferred(gtid); - i->second->server_state().initialized(); + // i->second->server_state().initialized(); // i->second->server_state().sst_received(gtid, 0); server.server_state().sst_sent(gtid, 0); } diff --git a/src/server_state.cpp b/src/server_state.cpp index 6b89562..c55168c 100644 --- a/src/server_state.cpp +++ b/src/server_state.cpp @@ -357,19 +357,13 @@ void wsrep::server_state::sst_transferred(const wsrep::gtid& gtid) if (server_service_.sst_before_init()) { state(lock, s_initializing); - // Incremental state transfer was received - // TODO: Sanity checks for gtid continuity - if (init_initialized_) + wait_until_state(lock, s_initialized); + assert(init_initialized_); + state(lock, s_joined); + lock.unlock(); + if (provider().sst_received(sst_gtid_, 0)) { - state(lock, s_initialized); - state(lock, s_joined); - lock.unlock(); - // TODO: This should not be here, sst_received() should be - // called instead - if (provider().sst_received(sst_gtid_, 0)) - { - throw wsrep::runtime_error("SST received failed"); - } + throw wsrep::runtime_error("SST received failed"); } } else @@ -380,6 +374,7 @@ void wsrep::server_state::sst_transferred(const wsrep::gtid& gtid) void wsrep::server_state::sst_received(const wsrep::gtid& gtid, int error) { + assert(0); wsrep::log_info() << "SST received: " << gtid << ": " << error; wsrep::unique_lock lock(mutex_); state(lock, s_joined); @@ -398,16 +393,6 @@ void wsrep::server_state::initialized() if (server_service_.sst_before_init()) { state(lock, s_initialized); - if (sst_gtid_.is_undefined() == false) - { - lock.unlock(); - if (provider().sst_received(sst_gtid_, 0)) - { - throw wsrep::runtime_error("SST received failed"); - } - lock.lock(); - sst_gtid_ = wsrep::gtid::undefined(); - } } else {