Skip to content

Commit

Permalink
Fix the json exception when the rdma_endpoint is null.
Browse files Browse the repository at this point in the history
Signed-off-by: Ye Cao <[email protected]>
  • Loading branch information
dashanji committed Aug 9, 2024
1 parent 6682a5a commit 9ef29dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/server/server/vineyard_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,12 @@ Status VineyardServer::MigrateObject(const ObjectID object_id,

std::string remote_endpoint =
(*instance)["rpc_endpoint"].get_ref<std::string const&>();
std::string rdma_endpoint =
(*instance)["rdma_endpoint"].get_ref<std::string const&>();
std::string rdma_endpoint = "";
if ((*instance).contains("rdma_endpoint") &&
!(*instance)["rdma_endpoint"].is_null()) {
std::string rdma_endpoint =
(*instance)["rdma_endpoint"].get_ref<std::string const&>();
}

auto test_task = [self, object_id](const json& meta) -> bool {
std::lock_guard<std::mutex> lock(
Expand Down
7 changes: 5 additions & 2 deletions src/server/services/meta_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,10 @@ void IMetaService::registerToEtcd() {
op_t::Put(key + "/ipc_socket", self->server_ptr_->IPCSocket()));
ops.emplace_back(op_t::Put(key + "/timestamp", timestamp));
ops.emplace_back(op_t::Put("/next_instance_id", rank + 1));
ops.emplace_back(op_t::Put(key + "/rdma_endpoint",
self->server_ptr_->RDMAEndpoint()));
if (self->server_ptr_->RDMAEndpoint() != "") {
ops.emplace_back(op_t::Put(key + "/rdma_endpoint",
self->server_ptr_->RDMAEndpoint()));
}
LOG(INFO) << "Decide to set rank as " << rank;
return status;
} else {
Expand Down Expand Up @@ -664,6 +666,7 @@ void IMetaService::checkInstanceStatus(
ops.emplace_back(op_t::Del(key + "/hostname"));
ops.emplace_back(op_t::Del(key + "/nodename"));
ops.emplace_back(op_t::Del(key + "/rpc_endpoint"));
ops.emplace_back(op_t::Del(key + "/rdma_endpoint"));
ops.emplace_back(op_t::Del(key + "/ipc_socket"));
} else {
LOG(ERROR) << status.ToString();
Expand Down

0 comments on commit 9ef29dd

Please sign in to comment.