From 51ec801eb35144b75fee9de4dd7a643fd355ba11 Mon Sep 17 00:00:00 2001 From: liwenhui-soul <38217397+liwenhui-soul@users.noreply.github.com> Date: Thu, 13 Jan 2022 12:21:26 +0800 Subject: [PATCH] refactor LOG and add comment for meta/processors/zone --- .../zone/AddHostsIntoZoneProcessor.cpp | 12 ++++---- .../processors/zone/DivideZoneProcessor.cpp | 22 +++++++-------- .../processors/zone/DivideZoneProcessor.h | 7 +++++ .../processors/zone/DropHostsProcessor.cpp | 22 +++++++-------- src/meta/processors/zone/DropHostsProcessor.h | 6 ++++ .../processors/zone/DropZoneProcessor.cpp | 16 +++++------ src/meta/processors/zone/DropZoneProcessor.h | 10 ++++++- src/meta/processors/zone/GetZoneProcessor.cpp | 4 +-- .../processors/zone/ListZonesProcessor.cpp | 2 +- .../processors/zone/MergeZoneProcessor.cpp | 28 +++++++++---------- src/meta/processors/zone/MergeZoneProcessor.h | 7 +++-- .../processors/zone/RenameZoneProcessor.cpp | 6 ++-- 12 files changed, 83 insertions(+), 59 deletions(-) diff --git a/src/meta/processors/zone/AddHostsIntoZoneProcessor.cpp b/src/meta/processors/zone/AddHostsIntoZoneProcessor.cpp index 93480117cad..b5274dd332f 100644 --- a/src/meta/processors/zone/AddHostsIntoZoneProcessor.cpp +++ b/src/meta/processors/zone/AddHostsIntoZoneProcessor.cpp @@ -15,7 +15,7 @@ void AddHostsIntoZoneProcessor::process(const cpp2::AddHostsIntoZoneReq& req) { // Confirm that there are no duplicates in the parameters. if (std::unique(hosts.begin(), hosts.end()) != hosts.end()) { - LOG(ERROR) << "Hosts have duplicated element"; + LOG(INFO) << "Hosts have duplicated element"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; @@ -23,7 +23,7 @@ void AddHostsIntoZoneProcessor::process(const cpp2::AddHostsIntoZoneReq& req) { // Confirm that the parameter is not empty. if (hosts.empty()) { - LOG(ERROR) << "Hosts is empty"; + LOG(INFO) << "Hosts is empty"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; @@ -37,7 +37,7 @@ void AddHostsIntoZoneProcessor::process(const cpp2::AddHostsIntoZoneReq& req) { // Ensure that the node is not registered. auto machineKey = MetaKeyUtils::machineKey(host.host, host.port); if (machineExist(machineKey) == nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "The host " << host << " have existed!"; + LOG(INFO) << "The host " << host << " have existed!"; code = nebula::cpp2::ErrorCode::E_EXISTED; break; } @@ -56,7 +56,7 @@ void AddHostsIntoZoneProcessor::process(const cpp2::AddHostsIntoZoneReq& req) { if (isNew) { // If you are creating a new zone, should make sure the zone not existed. if (nebula::ok(zoneValueRet)) { - LOG(ERROR) << "Zone " << zoneName << " have existed"; + LOG(INFO) << "Zone " << zoneName << " have existed"; handleErrorCode(nebula::cpp2::ErrorCode::E_EXISTED); onFinished(); return; @@ -68,8 +68,8 @@ void AddHostsIntoZoneProcessor::process(const cpp2::AddHostsIntoZoneReq& req) { if (code == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { code = nebula::cpp2::ErrorCode::E_ZONE_NOT_FOUND; } - LOG(ERROR) << "Get zone " << zoneName << " failed, error " - << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "Get zone " << zoneName << " failed, error " + << apache::thrift::util::enumNameSafe(code); handleErrorCode(code); onFinished(); return; diff --git a/src/meta/processors/zone/DivideZoneProcessor.cpp b/src/meta/processors/zone/DivideZoneProcessor.cpp index 6b43915a5ad..401a6ac0f9d 100644 --- a/src/meta/processors/zone/DivideZoneProcessor.cpp +++ b/src/meta/processors/zone/DivideZoneProcessor.cpp @@ -15,8 +15,8 @@ void DivideZoneProcessor::process(const cpp2::DivideZoneReq& req) { auto zoneKey = MetaKeyUtils::zoneKey(zoneName); auto zoneValueRet = doGet(zoneKey); if (!nebula::ok(zoneValueRet)) { - LOG(ERROR) << "Zone " << zoneName << " not existed error: " - << apache::thrift::util::enumNameSafe(nebula::cpp2::ErrorCode::E_ZONE_NOT_FOUND); + LOG(INFO) << "Zone " << zoneName << " not existed error: " + << apache::thrift::util::enumNameSafe(nebula::cpp2::ErrorCode::E_ZONE_NOT_FOUND); handleErrorCode(nebula::cpp2::ErrorCode::E_ZONE_NOT_FOUND); onFinished(); return; @@ -25,7 +25,7 @@ void DivideZoneProcessor::process(const cpp2::DivideZoneReq& req) { auto& zoneItems = req.get_zone_items(); auto zoneHosts = MetaKeyUtils::parseZoneHosts(std::move(nebula::value(zoneValueRet))); if (zoneItems.size() > zoneHosts.size()) { - LOG(ERROR) << "Zone Item should not greater than hosts size"; + LOG(INFO) << "Zone Item should not greater than hosts size"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; @@ -41,14 +41,14 @@ void DivideZoneProcessor::process(const cpp2::DivideZoneReq& req) { auto hosts = iter->second; auto valueRet = doGet(MetaKeyUtils::zoneKey(zone)); if (nebula::ok(valueRet)) { - LOG(ERROR) << "Zone " << zone << " have existed"; + LOG(INFO) << "Zone " << zone << " have existed"; code = nebula::cpp2::ErrorCode::E_EXISTED; break; } auto it = std::find(zoneNames.begin(), zoneNames.end(), zone); if (it == zoneNames.end()) { - LOG(ERROR) << "Zone have duplicated name"; + LOG(INFO) << "Zone have duplicated name"; zoneNames.emplace_back(zone); } else { code = nebula::cpp2::ErrorCode::E_INVALID_PARM; @@ -56,12 +56,12 @@ void DivideZoneProcessor::process(const cpp2::DivideZoneReq& req) { } if (hosts.empty()) { - LOG(ERROR) << "Hosts should not be empty"; + LOG(INFO) << "Hosts should not be empty"; code = nebula::cpp2::ErrorCode::E_INVALID_PARM; } if (std::unique(hosts.begin(), hosts.end()) != hosts.end()) { - LOG(ERROR) << "Zone have duplicated host"; + LOG(INFO) << "Zone have duplicated host"; code = nebula::cpp2::ErrorCode::E_INVALID_PARM; break; } @@ -81,14 +81,14 @@ void DivideZoneProcessor::process(const cpp2::DivideZoneReq& req) { } if (totalHosts.size() != zoneHosts.size()) { - LOG(ERROR) << "The total host is not all hosts"; + LOG(INFO) << "The total host is not all hosts"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; } if (totalHostsSize != totalHosts.size()) { - LOG(ERROR) << "The host in zone list have duplicate element"; + LOG(INFO) << "The host in zone list have duplicate element"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; @@ -97,7 +97,7 @@ void DivideZoneProcessor::process(const cpp2::DivideZoneReq& req) { for (auto& host : totalHosts) { auto iter = std::find(zoneHosts.begin(), zoneHosts.end(), host); if (iter == zoneHosts.end()) { - LOG(ERROR) << "Host " << host << " not exist in original zone"; + LOG(INFO) << "Host " << host << " not exist in original zone"; code = nebula::cpp2::ErrorCode::E_INVALID_PARM; break; } @@ -130,7 +130,7 @@ nebula::cpp2::ErrorCode DivideZoneProcessor::updateSpacesZone( auto ret = doPrefix(prefix); if (!nebula::ok(ret)) { - LOG(ERROR) << "List spaces failed"; + LOG(INFO) << "List spaces failed"; return nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND; } diff --git a/src/meta/processors/zone/DivideZoneProcessor.h b/src/meta/processors/zone/DivideZoneProcessor.h index d6df91685c6..5a4ba5be367 100644 --- a/src/meta/processors/zone/DivideZoneProcessor.h +++ b/src/meta/processors/zone/DivideZoneProcessor.h @@ -24,6 +24,13 @@ class DivideZoneProcessor : public BaseProcessor { explicit DivideZoneProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} + /** + * @brief remove the originalZoneName and add the zoneNames in batchHolder + * @param batchHolder + * @param originalZoneName + * @param zoneNames + * @return + */ nebula::cpp2::ErrorCode updateSpacesZone(kvstore::BatchHolder* batchHolder, const std::string& originalZoneName, const std::vector& zoneNames); diff --git a/src/meta/processors/zone/DropHostsProcessor.cpp b/src/meta/processors/zone/DropHostsProcessor.cpp index f9138b7061e..b7b3c582b7f 100644 --- a/src/meta/processors/zone/DropHostsProcessor.cpp +++ b/src/meta/processors/zone/DropHostsProcessor.cpp @@ -15,14 +15,14 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { folly::SharedMutex::WriteHolder mHolder(LockUtils::machineLock()); auto hosts = req.get_hosts(); if (std::unique(hosts.begin(), hosts.end()) != hosts.end()) { - LOG(ERROR) << "Hosts have duplicated element"; + LOG(INFO) << "Hosts have duplicated element"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; } if (hosts.empty()) { - LOG(ERROR) << "Hosts is empty"; + LOG(INFO) << "Hosts is empty"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; @@ -43,8 +43,8 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { auto ret = doGet(spaceKey); if (!nebula::ok(ret)) { code = nebula::error(ret); - LOG(ERROR) << "Get Space " << spaceId - << " error: " << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "Get Space " << spaceId + << " error: " << apache::thrift::util::enumNameSafe(code); break; } @@ -55,7 +55,7 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { auto partHosts = MetaKeyUtils::parsePartVal(partIter->val()); for (auto& h : partHosts) { if (std::find(hosts.begin(), hosts.end(), h) != hosts.end()) { - LOG(ERROR) << h << " is related with partition"; + LOG(INFO) << h << " is related with partition"; code = nebula::cpp2::ErrorCode::E_CONFLICT; break; } @@ -76,7 +76,7 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { auto iterRet = doPrefix(prefix); if (!nebula::ok(iterRet)) { auto retCode = nebula::error(iterRet); - LOG(ERROR) << "List zones failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List zones failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -94,7 +94,7 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { LOG(INFO) << "Drop zone " << zoneName; code = checkRelatedSpaceAndCollect(zoneName, holder.get()); if (code != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Check related space failed"; + LOG(INFO) << "Check related space failed"; break; } @@ -127,7 +127,7 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { auto machineKey = MetaKeyUtils::machineKey(host.host, host.port); auto ret = machineExist(machineKey); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "The machine " << host << " not existed!"; + LOG(INFO) << "The machine " << host << " not existed!"; code = nebula::cpp2::ErrorCode::E_NO_HOSTS; break; } @@ -136,7 +136,7 @@ void DropHostsProcessor::process(const cpp2::DropHostsReq& req) { auto hostKey = MetaKeyUtils::hostKey(host.host, host.port); ret = hostExist(hostKey); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "The host " << host << " not existed!"; + LOG(INFO) << "The host " << host << " not existed!"; code = nebula::cpp2::ErrorCode::E_NO_HOSTS; break; } @@ -160,7 +160,7 @@ nebula::cpp2::ErrorCode DropHostsProcessor::checkRelatedSpaceAndCollect( auto ret = doPrefix(prefix); if (!nebula::ok(ret)) { auto retCode = nebula::error(ret); - LOG(ERROR) << "List spaces failed, error " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List spaces failed, error " << apache::thrift::util::enumNameSafe(retCode); return nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND; } @@ -173,7 +173,7 @@ nebula::cpp2::ErrorCode DropHostsProcessor::checkRelatedSpaceAndCollect( auto it = std::find(zones.begin(), zones.end(), zoneName); if (it != zones.end()) { if (zones.size() == replicaFactor) { - LOG(ERROR) << "Zone size is same with replica factor"; + LOG(INFO) << "Zone size is same with replica factor"; return nebula::cpp2::ErrorCode::E_CONFLICT; } else { zones.erase(it); diff --git a/src/meta/processors/zone/DropHostsProcessor.h b/src/meta/processors/zone/DropHostsProcessor.h index 8d3f8cd8806..5878de5fe21 100644 --- a/src/meta/processors/zone/DropHostsProcessor.h +++ b/src/meta/processors/zone/DropHostsProcessor.h @@ -23,6 +23,12 @@ class DropHostsProcessor : public BaseProcessor { private: explicit DropHostsProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} + /** + * @brief check all spaces to find the zone, and remove it from the space + * @param zoneName + * @param holder + * @return + */ nebula::cpp2::ErrorCode checkRelatedSpaceAndCollect(const std::string& zoneName, kvstore::BatchHolder* holder); }; diff --git a/src/meta/processors/zone/DropZoneProcessor.cpp b/src/meta/processors/zone/DropZoneProcessor.cpp index 8b9284b20e4..aee55e19e19 100644 --- a/src/meta/processors/zone/DropZoneProcessor.cpp +++ b/src/meta/processors/zone/DropZoneProcessor.cpp @@ -15,7 +15,7 @@ void DropZoneProcessor::process(const cpp2::DropZoneReq& req) { auto zoneValueRet = doGet(std::move(zoneKey)); if (!nebula::ok(zoneValueRet)) { auto code = nebula::error(zoneValueRet); - LOG(ERROR) << "Drop Zone Failed, error: " << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "Drop Zone Failed, error: " << apache::thrift::util::enumNameSafe(code); handleErrorCode(nebula::cpp2::ErrorCode::E_ZONE_NOT_FOUND); onFinished(); return; @@ -51,7 +51,7 @@ void DropZoneProcessor::process(const cpp2::DropZoneReq& req) { auto machineKey = MetaKeyUtils::machineKey(host.host, host.port); auto ret = machineExist(machineKey); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "The host " << host << " not existed!"; + LOG(INFO) << "The host " << host << " not existed!"; code = nebula::cpp2::ErrorCode::E_NO_HOSTS; break; } @@ -66,7 +66,7 @@ nebula::cpp2::ErrorCode DropZoneProcessor::checkSpaceReplicaZone() { nebula::cpp2::ErrorCode code = nebula::cpp2::ErrorCode::SUCCEEDED; if (!nebula::ok(ret)) { code = nebula::error(ret); - LOG(ERROR) << "List spaces failed, error " << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "List spaces failed, error " << apache::thrift::util::enumNameSafe(code); return code; } @@ -78,7 +78,7 @@ nebula::cpp2::ErrorCode DropZoneProcessor::checkSpaceReplicaZone() { auto spaceZones = properties.get_zone_names(); size_t replicaFactor = properties.get_replica_factor(); if (replicaFactor == spaceZones.size()) { - LOG(ERROR) << "Space " << spaceId << " replica factor and zone size are the same"; + LOG(INFO) << "Space " << spaceId << " replica factor and zone size are the same"; code = nebula::cpp2::ErrorCode::E_CONFLICT; break; } @@ -92,7 +92,7 @@ nebula::cpp2::ErrorCode DropZoneProcessor::checkHostPartition(const HostAddr& ad auto spaceIterRet = doPrefix(spacePrefix); if (!nebula::ok(spaceIterRet)) { auto result = nebula::error(spaceIterRet); - LOG(ERROR) << "Get Spaces Failed, error " << apache::thrift::util::enumNameSafe(result); + LOG(INFO) << "Get Spaces Failed, error " << apache::thrift::util::enumNameSafe(result); return result; } @@ -104,8 +104,8 @@ nebula::cpp2::ErrorCode DropZoneProcessor::checkHostPartition(const HostAddr& ad auto partIterRet = doPrefix(partPrefix); if (!nebula::ok(partIterRet)) { code = nebula::error(partIterRet); - LOG(ERROR) << "List part failed in list hosts, error: " - << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "List part failed in list hosts, error: " + << apache::thrift::util::enumNameSafe(code); return code; } auto& partIter = nebula::value(partIterRet); @@ -113,7 +113,7 @@ nebula::cpp2::ErrorCode DropZoneProcessor::checkHostPartition(const HostAddr& ad auto hosts = MetaKeyUtils::parsePartVal(partIter->val()); for (auto& host : hosts) { if (host == address) { - LOG(ERROR) << "Host " << address << " have partition on it"; + LOG(INFO) << "Host " << address << " have partition on it"; code = nebula::cpp2::ErrorCode::E_CONFLICT; break; } diff --git a/src/meta/processors/zone/DropZoneProcessor.h b/src/meta/processors/zone/DropZoneProcessor.h index 25752a35294..055ec37eeb8 100644 --- a/src/meta/processors/zone/DropZoneProcessor.h +++ b/src/meta/processors/zone/DropZoneProcessor.h @@ -22,9 +22,17 @@ class DropZoneProcessor : public BaseProcessor { private: explicit DropZoneProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} + /** + * @brief check all spaces if they have enough zones to hold replica when dropping one zone + * @return + */ nebula::cpp2::ErrorCode checkSpaceReplicaZone(); - // Check whether the node holds zones on each space + /** + * @brief Check whether the node holds zones on each space + * @param address + * @return + */ nebula::cpp2::ErrorCode checkHostPartition(const HostAddr& address); }; diff --git a/src/meta/processors/zone/GetZoneProcessor.cpp b/src/meta/processors/zone/GetZoneProcessor.cpp index f5445b456b4..7de7965de53 100644 --- a/src/meta/processors/zone/GetZoneProcessor.cpp +++ b/src/meta/processors/zone/GetZoneProcessor.cpp @@ -18,8 +18,8 @@ void GetZoneProcessor::process(const cpp2::GetZoneReq& req) { if (retCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { retCode = nebula::cpp2::ErrorCode::E_ZONE_NOT_FOUND; } - LOG(ERROR) << "Get zone " << zoneName - << " failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Get zone " << zoneName + << " failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; diff --git a/src/meta/processors/zone/ListZonesProcessor.cpp b/src/meta/processors/zone/ListZonesProcessor.cpp index 282468ecf13..3bc2efab614 100644 --- a/src/meta/processors/zone/ListZonesProcessor.cpp +++ b/src/meta/processors/zone/ListZonesProcessor.cpp @@ -14,7 +14,7 @@ void ListZonesProcessor::process(const cpp2::ListZonesReq&) { auto iterRet = doPrefix(prefix); if (!nebula::ok(iterRet)) { auto retCode = nebula::error(iterRet); - LOG(ERROR) << "List zones failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List zones failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; diff --git a/src/meta/processors/zone/MergeZoneProcessor.cpp b/src/meta/processors/zone/MergeZoneProcessor.cpp index 98c6b4b4379..9d4117a4e4e 100644 --- a/src/meta/processors/zone/MergeZoneProcessor.cpp +++ b/src/meta/processors/zone/MergeZoneProcessor.cpp @@ -18,14 +18,14 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { // Confirm that the parameter is not empty. if (zones.empty()) { - LOG(ERROR) << "Zones is empty"; + LOG(INFO) << "Zones is empty"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; } if (zones.size() == 1) { - LOG(ERROR) << "Only one zone is no need to merge"; + LOG(INFO) << "Only one zone is no need to merge"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; @@ -33,7 +33,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { // Confirm that there are no duplicates in the parameters. if (std::unique(zones.begin(), zones.end()) != zones.end()) { - LOG(ERROR) << "Zones have duplicated element"; + LOG(INFO) << "Zones have duplicated element"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; @@ -47,7 +47,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { auto zoneValueRet = doGet(std::move(zoneKey)); if (!nebula::ok(zoneValueRet)) { code = nebula::cpp2::ErrorCode::E_ZONE_NOT_FOUND; - LOG(ERROR) << "Zone " << zone << " not existed"; + LOG(INFO) << "Zone " << zone << " not existed"; break; } } @@ -63,7 +63,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { auto ret = doPrefix(spacePrefix); if (!nebula::ok(ret)) { code = nebula::error(ret); - LOG(ERROR) << "List spaces failed, error " << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "List spaces failed, error " << apache::thrift::util::enumNameSafe(code); handleErrorCode(code); onFinished(); return; @@ -87,7 +87,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { std::back_inserter(intersectionZones)); if (spaceZones.size() - intersectionZones.size() + 1 < replicaFactor) { - LOG(ERROR) << "Merge Zone will cause replica number not enough"; + LOG(INFO) << "Merge Zone will cause replica number not enough"; code = nebula::cpp2::ErrorCode::E_INVALID_PARM; break; } @@ -95,7 +95,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { auto hostPartsRet = assembleHostParts(spaceId); if (!nebula::ok(hostPartsRet)) { code = nebula::error(hostPartsRet); - LOG(ERROR) << "Assemble host parts failed: " << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "Assemble host parts failed: " << apache::thrift::util::enumNameSafe(code); break; } @@ -108,7 +108,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { for (auto& host : hosts) { auto hp = hostParts.find(host); if (hp == hostParts.end()) { - LOG(ERROR) << "Host " << host << " not found"; + LOG(INFO) << "Host " << host << " not found"; code = nebula::cpp2::ErrorCode::E_NO_HOSTS; break; } @@ -117,7 +117,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { for (auto part : parts) { auto it = std::find(totalParts.begin(), totalParts.end(), part); if (it != totalParts.end()) { - LOG(ERROR) << "Part " << part << " have exist"; + LOG(INFO) << "Part " << part << " have exist"; code = nebula::cpp2::ErrorCode::E_CONFLICT; break; } @@ -133,7 +133,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { } // space if (code != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Check parts failed, error " << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "Check parts failed, error " << apache::thrift::util::enumNameSafe(code); handleErrorCode(code); onFinished(); return; @@ -173,7 +173,7 @@ void MergeZoneProcessor::process(const cpp2::MergeZoneReq& req) { if (nebula::ok(valueRet)) { auto it = std::find(zones.begin(), zones.end(), zoneName); if (it == zones.end()) { - LOG(ERROR) << "The target zone should exist in merge zone list"; + LOG(INFO) << "The target zone should exist in merge zone list"; handleErrorCode(nebula::cpp2::ErrorCode::E_INVALID_PARM); onFinished(); return; @@ -205,7 +205,7 @@ ErrorOr MergeZoneProcessor::assembleHostPart std::unordered_map> hostParts; auto activeHostsRet = ActiveHostsMan::getActiveHosts(kvstore_); if (!nebula::ok(activeHostsRet)) { - LOG(ERROR) << "Get active hosts failed"; + LOG(INFO) << "Get active hosts failed"; return nebula::error(activeHostsRet); } @@ -218,8 +218,8 @@ ErrorOr MergeZoneProcessor::assembleHostPart const auto& prefix = MetaKeyUtils::partPrefix(spaceId); auto code = kvstore_->prefix(kDefaultSpaceId, kDefaultPartId, prefix, &iter); if (code != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Access kvstore failed, spaceId " << spaceId << " " - << apache::thrift::util::enumNameSafe(code); + LOG(INFO) << "Access kvstore failed, spaceId " << spaceId << " " + << apache::thrift::util::enumNameSafe(code); return code; } diff --git a/src/meta/processors/zone/MergeZoneProcessor.h b/src/meta/processors/zone/MergeZoneProcessor.h index 1b5074ca9db..c9518d1e765 100644 --- a/src/meta/processors/zone/MergeZoneProcessor.h +++ b/src/meta/processors/zone/MergeZoneProcessor.h @@ -24,9 +24,12 @@ class MergeZoneProcessor : public BaseProcessor { private: explicit MergeZoneProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} + /** + * @brief get all parts of a space in each host + * @param spaceId which space's parts to get + * @return ErrorCode or parts of each host + */ ErrorOr assembleHostParts(GraphSpaceID spaceId); - - nebula::cpp2::ErrorCode updateSpaceProperties(); }; } // namespace meta diff --git a/src/meta/processors/zone/RenameZoneProcessor.cpp b/src/meta/processors/zone/RenameZoneProcessor.cpp index 11176c2fc6f..0d785e0b4bc 100644 --- a/src/meta/processors/zone/RenameZoneProcessor.cpp +++ b/src/meta/processors/zone/RenameZoneProcessor.cpp @@ -18,7 +18,7 @@ void RenameZoneProcessor::process(const cpp2::RenameZoneReq& req) { auto originalZoneKey = MetaKeyUtils::zoneKey(originalZoneName); auto originalZoneValueRet = doGet(std::move(originalZoneKey)); if (!nebula::ok(originalZoneValueRet)) { - LOG(ERROR) << "Zone " << originalZoneName << " not existed"; + LOG(INFO) << "Zone " << originalZoneName << " not existed"; handleErrorCode(nebula::cpp2::ErrorCode::E_ZONE_NOT_FOUND); onFinished(); return; @@ -29,7 +29,7 @@ void RenameZoneProcessor::process(const cpp2::RenameZoneReq& req) { auto zoneKey = MetaKeyUtils::zoneKey(zoneName); auto zoneValueRet = doGet(std::move(zoneKey)); if (nebula::ok(zoneValueRet)) { - LOG(ERROR) << "Zone " << zoneName << " have existed"; + LOG(INFO) << "Zone " << zoneName << " have existed"; handleErrorCode(nebula::cpp2::ErrorCode::E_EXISTED); onFinished(); return; @@ -38,7 +38,7 @@ void RenameZoneProcessor::process(const cpp2::RenameZoneReq& req) { const auto& prefix = MetaKeyUtils::spacePrefix(); auto ret = doPrefix(prefix); if (!nebula::ok(ret)) { - LOG(ERROR) << "List spaces failed"; + LOG(INFO) << "List spaces failed"; handleErrorCode(nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND); onFinished(); return;