Heartbeat table uses gcs pub-sub instead of redis accessor (#8655)

This commit is contained in:
fangfengbin
2020-05-30 23:17:25 +08:00
committed by GitHub
parent 10c87063be
commit 016337d4eb
8 changed files with 55 additions and 76 deletions
@@ -704,8 +704,8 @@ Status ServiceBasedNodeInfoAccessor::AsyncSubscribeBatchHeartbeat(
heartbeat_batch_table_data.ParseFromString(data);
subscribe(heartbeat_batch_table_data);
};
auto status = client_impl_->GetGcsPubSub().Subscribe(
HEARTBEAT_BATCH_CHANNEL, ClientID::Nil().Hex(), on_subscribe, done);
auto status = client_impl_->GetGcsPubSub().Subscribe(HEARTBEAT_BATCH_CHANNEL, "",
on_subscribe, done);
RAY_LOG(DEBUG) << "Finished subscribing batch heartbeat.";
return status;
};
+4 -9
View File
@@ -80,11 +80,8 @@ void GcsNodeManager::NodeFailureDetector::SendBatchedHeartbeat() {
batch->add_batch()->CopyFrom(heartbeat.second);
}
auto done = [this, batch](Status status) {
RAY_CHECK_OK(gcs_pub_sub_->Publish(HEARTBEAT_BATCH_CHANNEL, ClientID::Nil().Hex(),
batch->SerializeAsString(), nullptr));
};
RAY_CHECK_OK(node_info_accessor_.AsyncReportBatchHeartbeat(batch, done));
RAY_CHECK_OK(gcs_pub_sub_->Publish(HEARTBEAT_BATCH_CHANNEL, "",
batch->SerializeAsString(), nullptr));
heartbeat_buffer_.clear();
}
}
@@ -194,10 +191,8 @@ void GcsNodeManager::HandleReportHeartbeat(const rpc::ReportHeartbeatRequest &re
heartbeat_data->CopyFrom(request.heartbeat());
node_failure_detector_->HandleHeartbeat(node_id, *heartbeat_data);
GCS_RPC_SEND_REPLY(send_reply_callback, reply, Status::OK());
// TODO(Shanly): Remove it later.
// The heartbeat data is reported here because some python unit tests rely on the
// heartbeat data in redis.
RAY_CHECK_OK(node_info_accessor_.AsyncReportHeartbeat(heartbeat_data, nullptr));
RAY_CHECK_OK(gcs_pub_sub_->Publish(HEARTBEAT_CHANNEL, node_id.Hex(),
heartbeat_data->SerializeAsString(), nullptr));
}
void GcsNodeManager::HandleGetResources(const rpc::GetResourcesRequest &request,
+1
View File
@@ -33,6 +33,7 @@ namespace gcs {
#define OBJECT_CHANNEL "OBJECT"
#define TASK_CHANNEL "TASK"
#define TASK_LEASE_CHANNEL "TASK_LEASE"
#define HEARTBEAT_CHANNEL "HEARTBEAT"
#define HEARTBEAT_BATCH_CHANNEL "HEARTBEAT_BATCH"
/// \class GcsPubSub