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:
parent
523639d0d6
commit
3df590a842
@ -46,7 +46,7 @@ class Client {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VLOG_IS_ON(12)) {
|
if (VLOG_IS_ON(12) && response) {
|
||||||
auto res_type = utils::Demangle(response->type_index().name());
|
auto res_type = utils::Demangle(response->type_index().name());
|
||||||
LOG(INFO) << "[RpcClient] received "
|
LOG(INFO) << "[RpcClient] received "
|
||||||
<< (res_type ? res_type.value() : "");
|
<< (res_type ? res_type.value() : "");
|
||||||
|
@ -160,13 +160,6 @@ class Master : public PrivateBase {
|
|||||||
return index_rpc_clients_;
|
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_{
|
communication::rpc::Server server_{
|
||||||
config_.master_endpoint, static_cast<size_t>(config_.rpc_num_workers)};
|
config_.master_endpoint, static_cast<size_t>(config_.rpc_num_workers)};
|
||||||
tx::MasterEngine tx_engine_{server_, &wal_};
|
tx::MasterEngine tx_engine_{server_, &wal_};
|
||||||
|
@ -47,6 +47,9 @@ MasterCoordination::~MasterCoordination() {
|
|||||||
auto result = client.Call<StopWorkerRpc>();
|
auto result = client.Call<StopWorkerRpc>();
|
||||||
CHECK(result) << "StopWorkerRpc failed work worker: " << kv.first;
|
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) {
|
Endpoint MasterCoordination::GetEndpoint(int worker_id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user