Fix distributed master shutdown

Summary:
Master shouldn't stop processing rpc calls immediately on shutdown. It
should wait for all workers to stop, and then destroy itself.

Reviewers: dgleich, mferencevic

Reviewed By: dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1330
This commit is contained in:
Matija Santl 2018-03-29 15:24:15 +02:00
parent 523639d0d6
commit 3df590a842
3 changed files with 4 additions and 8 deletions

View File

@ -46,7 +46,7 @@ class Client {
return nullptr;
}
if (VLOG_IS_ON(12)) {
if (VLOG_IS_ON(12) && response) {
auto res_type = utils::Demangle(response->type_index().name());
LOG(INFO) << "[RpcClient] received "
<< (res_type ? res_type.value() : "");

View File

@ -160,13 +160,6 @@ class Master : public PrivateBase {
return index_rpc_clients_;
}
~Master() {
// The server is stopped explicitly here to disable RPC calls during the
// destruction of this object. This works because this destructor is called
// before the destructors of all objects.
server_.StopProcessingCalls();
}
communication::rpc::Server server_{
config_.master_endpoint, static_cast<size_t>(config_.rpc_num_workers)};
tx::MasterEngine tx_engine_{server_, &wal_};

View File

@ -47,6 +47,9 @@ MasterCoordination::~MasterCoordination() {
auto result = client.Call<StopWorkerRpc>();
CHECK(result) << "StopWorkerRpc failed work worker: " << kv.first;
}
// Make sure all StopWorkerRpc request/response are exchanged.
std::this_thread::sleep_for(2s);
}
Endpoint MasterCoordination::GetEndpoint(int worker_id) {