Skip to content

Commit

Permalink
fix drop host from a zone
Browse files Browse the repository at this point in the history
  • Loading branch information
darionyaphet committed Sep 16, 2021
1 parent 5905860 commit 5c39d87
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/meta/processors/zone/UpdateZoneProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,27 @@ void DropHostFromZoneProcessor::process(const cpp2::DropHostFromZoneReq& req) {
return;
}

const auto& spacePrefix = MetaServiceUtils::spacePrefix();
auto spaceIterRet = doPrefix(spacePrefix);
auto spaceIter = nebula::value(spaceIterRet).get();
while (spaceIter->valid()) {
auto spaceId = MetaServiceUtils::spaceId(spaceIter->key());
const auto& partPrefix = MetaServiceUtils::partPrefix(spaceId);
auto partIterRet = doPrefix(partPrefix);
auto partIter = nebula::value(partIterRet).get();
while (partIter->valid()) {
auto partHosts = MetaServiceUtils::parsePartVal(partIter->val());
for (auto& h : partHosts) {
if (h == req.get_node()) {
LOG(ERROR) << h << " is related with partition";
handleErrorCode(nebula::cpp2::ErrorCode::E_CONFLICT);
onFinished();
return;
}
}
}
}

auto hosts = MetaServiceUtils::parseZoneHosts(std::move(nebula::value(zoneValueRet)));
auto host = req.get_node();
auto iter = std::find(hosts.begin(), hosts.end(), host);
Expand Down

0 comments on commit 5c39d87

Please sign in to comment.