From c12fc8921b806518cdd2880fb26fbfddc753142f Mon Sep 17 00:00:00 2001 From: Doodle <13706157+critical27@users.noreply.github.com> Date: Wed, 1 Feb 2023 22:27:15 +0800 Subject: [PATCH] fix #5305 (#5304) --- src/meta/processors/zone/DropHostsProcessor.cpp | 12 ++++++++++++ src/meta/processors/zone/MergeZoneProcessor.cpp | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/meta/processors/zone/DropHostsProcessor.cpp b/src/meta/processors/zone/DropHostsProcessor.cpp index c91aaec1349..383db3c15fa 100644 --- a/src/meta/processors/zone/DropHostsProcessor.cpp +++ b/src/meta/processors/zone/DropHostsProcessor.cpp @@ -32,6 +32,12 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { // Check that partition is not held on the host const auto& spacePrefix = MetaKeyUtils::spacePrefix(); auto spaceIterRet = doPrefix(spacePrefix); + if (!nebula::ok(spaceIterRet)) { + LOG(INFO) << "List space failed"; + handleErrorCode(nebula::error(spaceIterRet)); + onFinished(); + return; + } auto spaceIter = nebula::value(spaceIterRet).get(); nebula::cpp2::ErrorCode code = nebula::cpp2::ErrorCode::SUCCEEDED; std::map spaceMap; @@ -48,6 +54,12 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { spaceMap.emplace(spaceId, MetaKeyUtils::parseSpace(spaceIter->val())); const auto& partPrefix = MetaKeyUtils::partPrefix(spaceId); auto partIterRet = doPrefix(partPrefix); + if (!nebula::ok(partIterRet)) { + LOG(INFO) << "List part failed"; + handleErrorCode(nebula::error(partIterRet)); + onFinished(); + return; + } auto partIter = nebula::value(partIterRet).get(); while (partIter->valid()) { auto partHosts = MetaKeyUtils::parsePartVal(partIter->val()); diff --git a/src/meta/processors/zone/MergeZoneProcessor.cpp b/src/meta/processors/zone/MergeZoneProcessor.cpp index 50a7a0e9472..c105c4ef96f 100644 --- a/src/meta/processors/zone/MergeZoneProcessor.cpp +++ b/src/meta/processors/zone/MergeZoneProcessor.cpp @@ -141,6 +141,12 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { auto batchHolder = std::make_unique(); // Rewrite space properties ret = doPrefix(spacePrefix); + if (!nebula::ok(ret)) { + LOG(INFO) << "List space failed"; + handleErrorCode(nebula::error(ret)); + onFinished(); + return; + } iter = nebula::value(ret).get(); while (iter->valid()) { auto id = MetaKeyUtils::spaceId(iter->key());