From cd95d082b82a5045f90fb5eaa3117eb3da86ac8f Mon Sep 17 00:00:00 2001 From: laura-ding <48548375+laura-ding@users.noreply.github.com> Date: Fri, 23 Jul 2021 16:25:24 +0800 Subject: [PATCH] Modify the return value of partId function (#591) --- src/common/clients/meta/MetaClient.cpp | 2 +- src/common/clients/meta/MetaClient.h | 2 +- src/common/clients/storage/InternalStorageClient.cpp | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/common/clients/meta/MetaClient.cpp b/src/common/clients/meta/MetaClient.cpp index 4c47f6b5c..d03cc0f5e 100644 --- a/src/common/clients/meta/MetaClient.cpp +++ b/src/common/clients/meta/MetaClient.cpp @@ -1030,7 +1030,7 @@ void MetaClient::loadRemoteListeners() { /// ================================== public methods ================================= -StatusOr MetaClient::partId(int32_t numParts, const VertexID id) const { +PartitionID MetaClient::partId(int32_t numParts, const VertexID id) const { // If the length of the id is 8, we will treat it as int64_t to be compatible // with the version 1.0 uint64_t vid = 0; diff --git a/src/common/clients/meta/MetaClient.h b/src/common/clients/meta/MetaClient.h index 2b8373c29..e52e670b1 100644 --- a/src/common/clients/meta/MetaClient.h +++ b/src/common/clients/meta/MetaClient.h @@ -511,7 +511,7 @@ class MetaClient { StatusOr partsNum(GraphSpaceID spaceId) const; - StatusOr partId(int32_t numParts, VertexID id) const; + PartitionID partId(int32_t numParts, VertexID id) const; StatusOr> getTagSchemaFromCache(GraphSpaceID spaceId, TagID tagID, SchemaVer ver = -1); diff --git a/src/common/clients/storage/InternalStorageClient.cpp b/src/common/clients/storage/InternalStorageClient.cpp index 493599004..bf5f2aae2 100644 --- a/src/common/clients/storage/InternalStorageClient.cpp +++ b/src/common/clients/storage/InternalStorageClient.cpp @@ -99,13 +99,10 @@ folly::SemiFuture InternalStorageClient::getValue(size_t vIdLen, folly::StringPiece key, folly::EventBase* evb) { auto srcVid = key.subpiece(sizeof(PartitionID), vIdLen); - auto stPartId = metaClient_->partId(spaceId, srcVid.str()); - if (!stPartId.ok()) { - return nebula::cpp2::ErrorCode::E_SPACE_NOT_FOUND; - } + auto partId = metaClient_->partId(spaceId, srcVid.str()); auto c = folly::makePromiseContract(); - getValueImpl(spaceId, stPartId.value(), key.str(), std::move(c.first), evb); + getValueImpl(spaceId, partId, key.str(), std::move(c.first), evb); return std::move(c.second); }