diff --git a/src/clients/meta/MetaClient.cpp b/src/clients/meta/MetaClient.cpp index 0e4fb05d239..17348fef4a7 100644 --- a/src/clients/meta/MetaClient.cpp +++ b/src/clients/meta/MetaClient.cpp @@ -865,8 +865,6 @@ Status MetaClient::handleResponse(const RESP& resp) { return Status::Error("Zone is empty!"); case nebula::cpp2::ErrorCode::E_STORE_FAILURE: return Status::Error("Store failure!"); - case nebula::cpp2::ErrorCode::E_STORE_SEGMENT_ILLEGAL: - return Status::Error("Store segment illegal!"); case nebula::cpp2::ErrorCode::E_BAD_BALANCE_PLAN: return Status::Error("Bad balance plan!"); case nebula::cpp2::ErrorCode::E_BALANCED: @@ -1420,134 +1418,6 @@ StatusOr> MetaClient::getAllEdgeFromCache(const GraphSp return it->second; } -folly::Future> MetaClient::multiPut( - std::string segment, std::vector> pairs) { - if (!nebula::meta::checkSegment(segment) || pairs.empty()) { - return Status::Error("arguments invalid!"); - } - - cpp2::MultiPutReq req; - std::vector data; - data.reserve(pairs.size()); - - for (auto& element : pairs) { - data.emplace_back(std::move(element)); - } - req.segment_ref() = std::move(segment); - req.pairs_ref() = std::move(data); - folly::Promise> promise; - auto future = promise.getFuture(); - getResponse( - std::move(req), - [](auto client, auto request) { return client->future_multiPut(request); }, - [](cpp2::ExecResp&& resp) -> bool { - return resp.get_code() == nebula::cpp2::ErrorCode::SUCCEEDED; - }, - std::move(promise)); - return future; -} - -folly::Future> MetaClient::get(std::string segment, std::string key) { - if (!nebula::meta::checkSegment(segment) || key.empty()) { - return Status::Error("arguments invalid!"); - } - - cpp2::GetReq req; - req.segment_ref() = std::move(segment); - req.key_ref() = std::move(key); - folly::Promise> promise; - auto future = promise.getFuture(); - getResponse( - std::move(req), - [](auto client, auto request) { return client->future_get(request); }, - [](cpp2::GetResp&& resp) -> std::string { return resp.get_value(); }, - std::move(promise)); - return future; -} - -folly::Future>> MetaClient::multiGet( - std::string segment, std::vector keys) { - if (!nebula::meta::checkSegment(segment) || keys.empty()) { - return Status::Error("arguments invalid!"); - } - - cpp2::MultiGetReq req; - req.segment_ref() = std::move(segment); - req.keys_ref() = std::move(keys); - folly::Promise>> promise; - auto future = promise.getFuture(); - getResponse( - std::move(req), - [](auto client, auto request) { return client->future_multiGet(request); }, - [](cpp2::MultiGetResp&& resp) -> std::vector { return resp.get_values(); }, - std::move(promise)); - return future; -} - -folly::Future>> MetaClient::scan(std::string segment, - std::string start, - std::string end) { - if (!nebula::meta::checkSegment(segment) || start.empty() || end.empty()) { - return Status::Error("arguments invalid!"); - } - - cpp2::ScanReq req; - req.segment_ref() = std::move(segment); - req.start_ref() = std::move(start); - req.end_ref() = std::move(end); - folly::Promise>> promise; - auto future = promise.getFuture(); - getResponse( - std::move(req), - [](auto client, auto request) { return client->future_scan(request); }, - [](cpp2::ScanResp&& resp) -> std::vector { return resp.get_values(); }, - std::move(promise)); - return future; -} - -folly::Future> MetaClient::remove(std::string segment, std::string key) { - if (!nebula::meta::checkSegment(segment) || key.empty()) { - return Status::Error("arguments invalid!"); - } - - cpp2::RemoveReq req; - req.segment_ref() = std::move(segment); - req.key_ref() = std::move(key); - folly::Promise> promise; - auto future = promise.getFuture(); - getResponse( - std::move(req), - [](auto client, auto request) { return client->future_remove(request); }, - [](cpp2::ExecResp&& resp) -> bool { - return resp.get_code() == nebula::cpp2::ErrorCode::SUCCEEDED; - }, - std::move(promise)); - return future; -} - -folly::Future> MetaClient::removeRange(std::string segment, - std::string start, - std::string end) { - if (!nebula::meta::checkSegment(segment) || start.empty() || end.empty()) { - return Status::Error("arguments invalid!"); - } - - cpp2::RemoveRangeReq req; - req.segment_ref() = std::move(segment); - req.start_ref() = std::move(start); - req.end_ref() = std::move(end); - folly::Promise> promise; - auto future = promise.getFuture(); - getResponse( - std::move(req), - [](auto client, auto request) { return client->future_removeRange(request); }, - [](cpp2::ExecResp&& resp) -> bool { - return resp.get_code() == nebula::cpp2::ErrorCode::SUCCEEDED; - }, - std::move(promise)); - return future; -} - PartsMap MetaClient::getPartsMapFromCache(const HostAddr& host) { folly::rcu_reader guard; const auto& metadata = *metadata_.load(); @@ -2791,50 +2661,6 @@ folly::Future>> MetaClient::getUserRoles(st return future; } -folly::Future> MetaClient::getTagDefaultValue(GraphSpaceID spaceId, - TagID tagId, - const std::string& field) { - cpp2::GetReq req; - static std::string defaultKey = "__default__"; - req.segment_ref() = defaultKey; - std::string key; - key.reserve(64); - key.append(reinterpret_cast(&spaceId), sizeof(GraphSpaceID)); - key.append(reinterpret_cast(&tagId), sizeof(TagID)); - key.append(field); - req.key_ref() = std::move(key); - folly::Promise> promise; - auto future = promise.getFuture(); - getResponse( - std::move(req), - [](auto client, auto request) { return client->future_get(request); }, - [](cpp2::GetResp&& resp) -> std::string { return resp.get_value(); }, - std::move(promise)); - return future; -} - -folly::Future> MetaClient::getEdgeDefaultValue(GraphSpaceID spaceId, - EdgeType edgeType, - const std::string& field) { - cpp2::GetReq req; - static std::string defaultKey = "__default__"; - req.segment_ref() = defaultKey; - std::string key; - key.reserve(64); - key.append(reinterpret_cast(&spaceId), sizeof(GraphSpaceID)); - key.append(reinterpret_cast(&edgeType), sizeof(EdgeType)); - key.append(field); - req.key_ref() = std::move(key); - folly::Promise> promise; - auto future = promise.getFuture(); - getResponse( - std::move(req), - [](auto client, auto request) { return client->future_get(request); }, - [](cpp2::GetResp&& resp) -> std::string { return resp.get_value(); }, - std::move(promise)); - return future; -} - folly::Future> MetaClient::regConfig(const std::vector& items) { cpp2::RegConfigReq req; req.items_ref() = items; diff --git a/src/clients/meta/MetaClient.h b/src/clients/meta/MetaClient.h index 8ac7e42ff02..0597dd1d5ee 100644 --- a/src/clients/meta/MetaClient.h +++ b/src/clients/meta/MetaClient.h @@ -373,25 +373,6 @@ class MetaClient { folly::Future>> listEdgeIndexStatus(GraphSpaceID spaceId); - // Operations for custom kv - folly::Future> multiPut(std::string segment, - std::vector> pairs); - - folly::Future> get(std::string segment, std::string key); - - folly::Future>> multiGet(std::string segment, - std::vector keys); - - folly::Future>> scan(std::string segment, - std::string start, - std::string end); - - folly::Future> remove(std::string segment, std::string key); - - folly::Future> removeRange(std::string segment, - std::string start, - std::string end); - // Operations for users. folly::Future> createUser(std::string account, std::string password, @@ -591,14 +572,6 @@ class MetaClient { const std::vector& getAddresses(); - folly::Future> getTagDefaultValue(GraphSpaceID spaceId, - TagID tagId, - const std::string& field); - - folly::Future> getEdgeDefaultValue(GraphSpaceID spaceId, - EdgeType edgeType, - const std::string& field); - std::vector getRolesByUserFromCache(const std::string& user); Status authCheckFromCache(const std::string& account, const std::string& password); diff --git a/src/common/meta/Common.h b/src/common/meta/Common.h index 625102c4d71..5b6f9c44e7d 100644 --- a/src/common/meta/Common.h +++ b/src/common/meta/Common.h @@ -62,13 +62,6 @@ using RemoteListeners = std::unordered_map>>; -inline bool checkSegment(const std::string& segment) { - static const std::regex pattern("^[0-9a-zA-Z]+$"); - if (!segment.empty() && std::regex_match(segment, pattern)) { - return true; - } - return false; -} } // namespace meta } // namespace nebula diff --git a/src/common/utils/MetaKeyUtils.cpp b/src/common/utils/MetaKeyUtils.cpp index a45ad90c002..821d2fda3af 100644 --- a/src/common/utils/MetaKeyUtils.cpp +++ b/src/common/utils/MetaKeyUtils.cpp @@ -760,13 +760,6 @@ std::string MetaKeyUtils::indexZoneKey(const std::string& name) { return key; } -std::string MetaKeyUtils::assembleSegmentKey(const std::string& segment, const std::string& key) { - std::string segmentKey; - segmentKey.reserve(64); - segmentKey.append(segment).append(key.data(), key.size()); - return segmentKey; -} - std::string MetaKeyUtils::userPrefix() { return kUsersTable; } diff --git a/src/common/utils/MetaKeyUtils.h b/src/common/utils/MetaKeyUtils.h index 5d463da6c53..777571f5f11 100644 --- a/src/common/utils/MetaKeyUtils.h +++ b/src/common/utils/MetaKeyUtils.h @@ -243,8 +243,6 @@ class MetaKeyUtils final { static std::string indexZoneKey(const std::string& name); - static std::string assembleSegmentKey(const std::string& segment, const std::string& key); - static std::string userPrefix(); static std::string userKey(const std::string& account); diff --git a/src/interface/meta.thrift b/src/interface/meta.thrift index b512c94ec11..b6bbe7fb6e0 100644 --- a/src/interface/meta.thrift +++ b/src/interface/meta.thrift @@ -518,58 +518,6 @@ struct GetWorkerIdResp { 3: i64 workerid, } -struct MultiPutReq { - // segment is used to avoid conflict with system data. - // it should be comprised of numbers and letters. - 1: binary segment, - 2: list pairs, -} - -struct GetReq { - 1: binary segment, - 2: binary key, -} - -struct GetResp { - 1: common.ErrorCode code, - 2: common.HostAddr leader, - 3: binary value, -} - -struct MultiGetReq { - 1: binary segment, - 2: list keys, -} - -struct MultiGetResp { - 1: common.ErrorCode code, - 2: common.HostAddr leader, - 3: list values, -} - -struct RemoveReq { - 1: binary segment, - 2: binary key, -} - -struct RemoveRangeReq { - 1: binary segment, - 2: binary start, - 3: binary end, -} - -struct ScanReq { - 1: binary segment, - 2: binary start, - 3: binary end, -} - -struct ScanResp { - 1: common.ErrorCode code, - 2: common.HostAddr leader, - 3: list values, -} - struct HBResp { 1: common.ErrorCode code, 2: common.HostAddr leader, @@ -1220,13 +1168,6 @@ service MetaService { GetWorkerIdResp getWorkerId(1: GetWorkerIdReq req); - ExecResp multiPut(1: MultiPutReq req); - GetResp get(1: GetReq req); - MultiGetResp multiGet(1: MultiGetReq req); - ExecResp remove(1: RemoveReq req); - ExecResp removeRange(1: RemoveRangeReq req); - ScanResp scan(1: ScanReq req); - ExecResp createTagIndex(1: CreateTagIndexReq req); ExecResp dropTagIndex(1: DropTagIndexReq req ); GetTagIndexResp getTagIndex(1: GetTagIndexReq req); diff --git a/src/meta/ActiveHostsMan.cpp b/src/meta/ActiveHostsMan.cpp index 0097634bfae..4ab0eaa581f 100644 --- a/src/meta/ActiveHostsMan.cpp +++ b/src/meta/ActiveHostsMan.cpp @@ -8,7 +8,6 @@ #include #include "common/utils/Utils.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" DECLARE_int32(heartbeat_interval_secs); diff --git a/src/meta/CMakeLists.txt b/src/meta/CMakeLists.txt index 2ff62fc1fe5..568d308fe35 100644 --- a/src/meta/CMakeLists.txt +++ b/src/meta/CMakeLists.txt @@ -38,12 +38,6 @@ nebula_add_library( processors/index/ListEdgeIndexesProcessor.cpp processors/service/ServiceProcessor.cpp processors/index/FTIndexProcessor.cpp - processors/kv/GetProcessor.cpp - processors/kv/MultiGetProcessor.cpp - processors/kv/MultiPutProcessor.cpp - processors/kv/RemoveProcessor.cpp - processors/kv/RemoveRangeProcessor.cpp - processors/kv/ScanProcessor.cpp processors/admin/HBProcessor.cpp processors/admin/AgentHBProcessor.cpp processors/user/AuthenticationProcessor.cpp diff --git a/src/meta/MetaServiceHandler.cpp b/src/meta/MetaServiceHandler.cpp index 1ab14cd1f29..8af918c38eb 100644 --- a/src/meta/MetaServiceHandler.cpp +++ b/src/meta/MetaServiceHandler.cpp @@ -35,12 +35,6 @@ #include "meta/processors/job/ListEdgeIndexStatusProcessor.h" #include "meta/processors/job/ListTagIndexStatusProcessor.h" #include "meta/processors/job/ReportTaskProcessor.h" -#include "meta/processors/kv/GetProcessor.h" -#include "meta/processors/kv/MultiGetProcessor.h" -#include "meta/processors/kv/MultiPutProcessor.h" -#include "meta/processors/kv/RemoveProcessor.h" -#include "meta/processors/kv/RemoveRangeProcessor.h" -#include "meta/processors/kv/ScanProcessor.h" #include "meta/processors/listener/ListenerProcessor.h" #include "meta/processors/parts/AlterSpaceProcessor.h" #include "meta/processors/parts/CreateSpaceAsProcessor.h" @@ -157,38 +151,6 @@ folly::Future MetaServiceHandler::future_getPartsAlloc( RETURN_FUTURE(processor); } -folly::Future MetaServiceHandler::future_multiPut(const cpp2::MultiPutReq& req) { - auto* processor = MultiPutProcessor::instance(kvstore_); - RETURN_FUTURE(processor); -} - -folly::Future MetaServiceHandler::future_get(const cpp2::GetReq& req) { - auto* processor = GetProcessor::instance(kvstore_); - RETURN_FUTURE(processor); -} - -folly::Future MetaServiceHandler::future_multiGet( - const cpp2::MultiGetReq& req) { - auto* processor = MultiGetProcessor::instance(kvstore_); - RETURN_FUTURE(processor); -} - -folly::Future MetaServiceHandler::future_scan(const cpp2::ScanReq& req) { - auto* processor = ScanProcessor::instance(kvstore_); - RETURN_FUTURE(processor); -} - -folly::Future MetaServiceHandler::future_remove(const cpp2::RemoveReq& req) { - auto* processor = RemoveProcessor::instance(kvstore_); - RETURN_FUTURE(processor); -} - -folly::Future MetaServiceHandler::future_removeRange( - const cpp2::RemoveRangeReq& req) { - auto* processor = RemoveRangeProcessor::instance(kvstore_); - RETURN_FUTURE(processor); -} - folly::Future MetaServiceHandler::future_createTag(const cpp2::CreateTagReq& req) { auto* processor = CreateTagProcessor::instance(kvstore_); RETURN_FUTURE(processor); diff --git a/src/meta/MetaServiceHandler.h b/src/meta/MetaServiceHandler.h index 3d9f7c7df20..a9c36b67d70 100644 --- a/src/meta/MetaServiceHandler.h +++ b/src/meta/MetaServiceHandler.h @@ -55,21 +55,6 @@ class MetaServiceHandler final : public cpp2::MetaServiceSvIf { folly::Future future_getPartsAlloc( const cpp2::GetPartsAllocReq& req) override; - /** - * Custom kv related operations. - * */ - folly::Future future_multiPut(const cpp2::MultiPutReq& req) override; - - folly::Future future_get(const cpp2::GetReq& req) override; - - folly::Future future_multiGet(const cpp2::MultiGetReq& req) override; - - folly::Future future_remove(const cpp2::RemoveReq& req) override; - - folly::Future future_removeRange(const cpp2::RemoveRangeReq& req) override; - - folly::Future future_scan(const cpp2::ScanReq& req) override; - /** * Schema related operations. * */ diff --git a/src/meta/common/MetaCommon.h b/src/meta/common/MetaCommon.h deleted file mode 100644 index 4d320577386..00000000000 --- a/src/meta/common/MetaCommon.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#ifndef META_COMMON_H_ -#define META_COMMON_H_ - -#include "common/base/Base.h" -#include "common/base/Status.h" -#include "common/utils/MetaKeyUtils.h" -#include "interface/gen-cpp2/meta_types.h" -#include "kvstore/KVStore.h" -#include "meta/processors/Common.h" - -namespace nebula { -namespace meta { - -class MetaCommon final { - public: - MetaCommon() = delete; - - static bool checkSegment(const std::string& segment) { - static const std::regex pattern("^[0-9a-zA-Z]+$"); - if (!segment.empty() && std::regex_match(segment, pattern)) { - return true; - } - return false; - } - - static bool saveRebuildStatus(kvstore::KVStore* kvstore, - std::string statusKey, - std::string&& statusValue) { - std::vector status{ - std::make_pair(std::move(statusKey), std::forward(statusValue))}; - folly::Baton baton; - auto ret = nebula::cpp2::ErrorCode::SUCCEEDED; - kvstore->asyncMultiPut(kDefaultSpaceId, - kDefaultPartId, - std::move(status), - [&ret, &baton](nebula::cpp2::ErrorCode code) { - if (nebula::cpp2::ErrorCode::SUCCEEDED != code) { - ret = code; - LOG(INFO) << "Put data error on meta server"; - } - baton.post(); - }); - baton.wait(); - if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Save Status Failed"; - return false; - } - return true; - } -}; - -} // namespace meta -} // namespace nebula - -#endif // META_COMMON_H_ diff --git a/src/meta/http/MetaHttpDownloadHandler.cpp b/src/meta/http/MetaHttpDownloadHandler.cpp index 03167f1b1cd..6c88e6927db 100644 --- a/src/meta/http/MetaHttpDownloadHandler.cpp +++ b/src/meta/http/MetaHttpDownloadHandler.cpp @@ -92,7 +92,7 @@ void MetaHttpDownloadHandler::onEOM() noexcept { .body("SSTFile dispatch successfully") .sendWithEOM(); } else { - LOG(ERROR) << "SSTFile dispatch failed"; + LOG(INFO) << "SSTFile dispatch failed"; ResponseBuilder(downstream_) .status(WebServiceUtils::to(HttpStatusCode::FORBIDDEN), WebServiceUtils::toString(HttpStatusCode::FORBIDDEN)) @@ -100,7 +100,7 @@ void MetaHttpDownloadHandler::onEOM() noexcept { .sendWithEOM(); } } else { - LOG(ERROR) << "Hadoop Home not exist"; + LOG(INFO) << "Hadoop Home not exist"; ResponseBuilder(downstream_) .status(WebServiceUtils::to(HttpStatusCode::NOT_FOUND), WebServiceUtils::toString(HttpStatusCode::NOT_FOUND)) @@ -117,8 +117,8 @@ void MetaHttpDownloadHandler::requestComplete() noexcept { } void MetaHttpDownloadHandler::onError(ProxygenError error) noexcept { - LOG(ERROR) << "Web Service MetaHttpDownloadHandler got error : " - << proxygen::getErrorString(error); + LOG(INFO) << "Web Service MetaHttpDownloadHandler got error : " + << proxygen::getErrorString(error); } bool MetaHttpDownloadHandler::dispatchSSTFiles(const std::string &hdfsHost, @@ -126,7 +126,7 @@ bool MetaHttpDownloadHandler::dispatchSSTFiles(const std::string &hdfsHost, const std::string &hdfsPath) { auto result = helper_->ls(hdfsHost, hdfsPort, hdfsPath); if (!result.ok()) { - LOG(ERROR) << "Dispatch SSTFile Failed"; + LOG(INFO) << "Dispatch SSTFile Failed"; return false; } std::vector files; @@ -136,7 +136,7 @@ bool MetaHttpDownloadHandler::dispatchSSTFiles(const std::string &hdfsHost, auto prefix = MetaKeyUtils::partPrefix(spaceID_); auto ret = kvstore_->prefix(0, 0, prefix, &iter); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Fetch Parts Failed"; + LOG(INFO) << "Fetch Parts Failed"; return false; } @@ -187,7 +187,7 @@ bool MetaHttpDownloadHandler::dispatchSSTFiles(const std::string &hdfsHost, auto tries = folly::collectAll(std::move(futures)).get(); for (const auto &t : tries) { if (t.hasException()) { - LOG(ERROR) << "Download Failed: " << t.exception(); + LOG(INFO) << "Download Failed: " << t.exception(); successfully = false; break; } diff --git a/src/meta/http/MetaHttpDownloadHandler.h b/src/meta/http/MetaHttpDownloadHandler.h index 18efb020ef8..fff54645ce6 100644 --- a/src/meta/http/MetaHttpDownloadHandler.h +++ b/src/meta/http/MetaHttpDownloadHandler.h @@ -19,6 +19,12 @@ namespace meta { using nebula::HttpCode; +/** + * @brief Download sst files from hdfs to every storaged download folder. + * It will send download http request to every storaged, letting them + * download the corressponding sst files. + * + */ class MetaHttpDownloadHandler : public proxygen::RequestHandler { public: MetaHttpDownloadHandler() = default; diff --git a/src/meta/http/MetaHttpIngestHandler.cpp b/src/meta/http/MetaHttpIngestHandler.cpp index a11f8675fc8..ff91c27166f 100644 --- a/src/meta/http/MetaHttpIngestHandler.cpp +++ b/src/meta/http/MetaHttpIngestHandler.cpp @@ -84,7 +84,7 @@ void MetaHttpIngestHandler::onEOM() noexcept { .body("SSTFile ingest successfully") .sendWithEOM(); } else { - LOG(ERROR) << "SSTFile ingest failed"; + LOG(INFO) << "SSTFile ingest failed"; ResponseBuilder(downstream_) .status(WebServiceUtils::to(HttpStatusCode::FORBIDDEN), WebServiceUtils::toString(HttpStatusCode::FORBIDDEN)) @@ -102,7 +102,7 @@ void MetaHttpIngestHandler::requestComplete() noexcept { } void MetaHttpIngestHandler::onError(ProxygenError error) noexcept { - LOG(ERROR) << "Web Service MetaHttpIngestHandler got error : " << proxygen::getErrorString(error); + LOG(INFO) << "Web Service MetaHttpIngestHandler got error : " << proxygen::getErrorString(error); } bool MetaHttpIngestHandler::ingestSSTFiles(GraphSpaceID space) { @@ -113,7 +113,7 @@ bool MetaHttpIngestHandler::ingestSSTFiles(GraphSpaceID space) { static const PartitionID metaPartId = 0; auto ret = kvstore_->prefix(metaSpaceId, metaPartId, prefix, &iter); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Fetch Parts Failed"; + LOG(INFO) << "Fetch Parts Failed"; return false; } @@ -144,7 +144,7 @@ bool MetaHttpIngestHandler::ingestSSTFiles(GraphSpaceID space) { auto tries = folly::collectAll(std::move(futures)).get(); for (const auto &t : tries) { if (t.hasException()) { - LOG(ERROR) << "Ingest Failed: " << t.exception(); + LOG(INFO) << "Ingest Failed: " << t.exception(); successfully = false; break; } diff --git a/src/meta/http/MetaHttpIngestHandler.h b/src/meta/http/MetaHttpIngestHandler.h index 9cfc1400430..70ff7ece64d 100644 --- a/src/meta/http/MetaHttpIngestHandler.h +++ b/src/meta/http/MetaHttpIngestHandler.h @@ -18,6 +18,13 @@ namespace meta { using nebula::HttpCode; +/** + * @brief Ingest should be called after download successfully. + * It will instruct relative storaged to ingest sst files + * from local download folder by sending http request. + * It will handle one space each time. + * + */ class MetaHttpIngestHandler : public proxygen::RequestHandler { public: MetaHttpIngestHandler() = default; diff --git a/src/meta/http/MetaHttpReplaceHostHandler.cpp b/src/meta/http/MetaHttpReplaceHostHandler.cpp index 23fa54fcf39..ad3cbc0f062 100644 --- a/src/meta/http/MetaHttpReplaceHostHandler.cpp +++ b/src/meta/http/MetaHttpReplaceHostHandler.cpp @@ -84,7 +84,7 @@ void MetaHttpReplaceHostHandler::onEOM() noexcept { .body("Replace Host successfully") .sendWithEOM(); } else { - LOG(ERROR) << "Replace Host failed"; + LOG(INFO) << "Replace Host failed"; ResponseBuilder(downstream_) .status(WebServiceUtils::to(HttpStatusCode::FORBIDDEN), WebServiceUtils::toString(HttpStatusCode::FORBIDDEN)) @@ -102,8 +102,8 @@ void MetaHttpReplaceHostHandler::requestComplete() noexcept { } void MetaHttpReplaceHostHandler::onError(ProxygenError error) noexcept { - LOG(ERROR) << "Web Service MetaHttpReplaceHostHandler got error : " - << proxygen::getErrorString(error); + LOG(INFO) << "Web Service MetaHttpReplaceHostHandler got error : " + << proxygen::getErrorString(error); } bool MetaHttpReplaceHostHandler::replaceHost(std::string ipv4From, std::string ipv4To) { @@ -113,7 +113,7 @@ bool MetaHttpReplaceHostHandler::replaceHost(std::string ipv4From, std::string i auto kvRet = kvstore_->prefix(kDefaultSpaceId, kDefaultPartId, spacePrefix, &iter); if (kvRet != nebula::cpp2::ErrorCode::SUCCEEDED) { errMsg_ = folly::stringPrintf("can't get space prefix=%s", spacePrefix.c_str()); - LOG(ERROR) << errMsg_; + LOG(INFO) << errMsg_; return false; } @@ -131,7 +131,7 @@ bool MetaHttpReplaceHostHandler::replaceHost(std::string ipv4From, std::string i kvRet = kvstore_->prefix(kDefaultSpaceId, kDefaultPartId, partPrefix, &iter); if (kvRet != nebula::cpp2::ErrorCode::SUCCEEDED) { errMsg_ = folly::stringPrintf("can't get partPrefix=%s", partPrefix.c_str()); - LOG(ERROR) << errMsg_; + LOG(INFO) << errMsg_; return false; } diff --git a/src/meta/http/MetaHttpReplaceHostHandler.h b/src/meta/http/MetaHttpReplaceHostHandler.h index 48cccaca157..b1211a0e798 100644 --- a/src/meta/http/MetaHttpReplaceHostHandler.h +++ b/src/meta/http/MetaHttpReplaceHostHandler.h @@ -17,6 +17,13 @@ namespace meta { using nebula::HttpCode; +/** + * @brief It will replace host info in meta partition table from + * backup host to current cluster host. + * It should be called after ingesting meta sst files when + * restore cluster. + * + */ class MetaHttpReplaceHostHandler : public proxygen::RequestHandler { FRIEND_TEST(MetaHttpReplaceHandlerTest, FooTest); diff --git a/src/meta/processors/BaseProcessor-inl.h b/src/meta/processors/BaseProcessor-inl.h index 03780043fd5..2115725a6cd 100644 --- a/src/meta/processors/BaseProcessor-inl.h +++ b/src/meta/processors/BaseProcessor-inl.h @@ -166,7 +166,7 @@ ErrorOr BaseProcessor::autoIncrementId() template ErrorOr BaseProcessor::getAvailableGlobalId() { // A read lock has been added before call - static const std::string kIdKey = "__id__"; + static const std::string kIdKey = MetaKeyUtils::idKey(); int32_t id; std::string val; auto ret = kvstore_->get(kDefaultSpaceId, kDefaultPartId, kIdKey, &val); @@ -279,7 +279,7 @@ nebula::cpp2::ErrorCode BaseProcessor::includeByZone(const std::vector::includeByZone(const std::vectorval()); for (const auto& host : hosts) { if (std::find(zoneHosts.begin(), zoneHosts.end(), host) != zoneHosts.end()) { - LOG(ERROR) << "Host overlap found in zone " << name; + LOG(INFO) << "Host overlap found in zone " << name; code = nebula::cpp2::ErrorCode::E_CONFLICT; break; } @@ -356,7 +356,7 @@ ErrorOr BaseProcessor::getLatestTag const auto& key = MetaKeyUtils::schemaTagPrefix(spaceId, tagId); auto ret = doPrefix(key); if (!nebula::ok(ret)) { - LOG(ERROR) << "Tag Prefix " << key << " failed"; + LOG(INFO) << "Tag Prefix " << key << " failed"; return nebula::error(ret); } @@ -364,7 +364,7 @@ ErrorOr BaseProcessor::getLatestTag if (iter->valid()) { return MetaKeyUtils::parseSchema(iter->val()); } else { - LOG(ERROR) << "Tag Prefix " << key << " not found"; + LOG(INFO) << "Tag Prefix " << key << " not found"; return nebula::cpp2::ErrorCode::E_TAG_NOT_FOUND; } } @@ -375,7 +375,7 @@ ErrorOr BaseProcessor::getLatestEdg const auto& key = MetaKeyUtils::schemaEdgePrefix(spaceId, edgeType); auto ret = doPrefix(key); if (!nebula::ok(ret)) { - LOG(ERROR) << "Edge Prefix " << key << " failed"; + LOG(INFO) << "Edge Prefix " << key << " failed"; return nebula::error(ret); } @@ -383,7 +383,7 @@ ErrorOr BaseProcessor::getLatestEdg if (iter->valid()) { return MetaKeyUtils::parseSchema(iter->val()); } else { - LOG(ERROR) << "Edge Prefix " << key << " not found"; + LOG(INFO) << "Edge Prefix " << key << " not found"; return nebula::cpp2::ErrorCode::E_EDGE_NOT_FOUND; } } @@ -490,8 +490,8 @@ ErrorOr> BaseProcessor> BaseProcessor ErrorOr BaseProcessor::getFTIndex( GraphSpaceID spaceId, int32_t tagOrEdge) { @@ -516,8 +517,8 @@ ErrorOr BaseProcessor::getFTIndex( auto iterRet = doPrefix(indexPrefix); if (!nebula::ok(iterRet)) { auto retCode = nebula::error(iterRet); - LOG(ERROR) << "Tag or edge fulltext index prefix failed, error :" - << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Tag or edge fulltext index prefix failed, error :" + << apache::thrift::util::enumNameSafe(retCode); return retCode; } auto indexIter = nebula::value(iterRet).get(); @@ -550,8 +551,8 @@ nebula::cpp2::ErrorCode BaseProcessor::indexCheck( return tCol.name == iCol.name; }); if (it != indexCols.end()) { - LOG(ERROR) << "Index conflict, index :" << index.get_index_name() - << ", column : " << tCol.name; + LOG(INFO) << "Index conflict, index :" << index.get_index_name() + << ", column : " << tCol.name; return nebula::cpp2::ErrorCode::E_CONFLICT; } } @@ -560,6 +561,7 @@ nebula::cpp2::ErrorCode BaseProcessor::indexCheck( } return nebula::cpp2::ErrorCode::SUCCEEDED; } + template nebula::cpp2::ErrorCode BaseProcessor::ftIndexCheck( const std::vector& cols, const std::vector& alterItems) { @@ -571,7 +573,7 @@ nebula::cpp2::ErrorCode BaseProcessor::ftIndexCheck( auto it = std::find_if(cols.begin(), cols.end(), [&](const auto& c) { return c == iCol.name; }); if (it != cols.end()) { - LOG(ERROR) << "fulltext index conflict"; + LOG(INFO) << "fulltext index conflict"; return nebula::cpp2::ErrorCode::E_CONFLICT; } } @@ -592,7 +594,7 @@ bool BaseProcessor::checkIndexExist(const std::vector return false; } } - LOG(ERROR) << "Index " << item.get_index_name() << " has existed"; + LOG(INFO) << "Index " << item.get_index_name() << " has existed"; return true; } diff --git a/src/meta/processors/BaseProcessor.h b/src/meta/processors/BaseProcessor.h index 76430930cf4..2984268524b 100644 --- a/src/meta/processors/BaseProcessor.h +++ b/src/meta/processors/BaseProcessor.h @@ -20,7 +20,6 @@ #include "kvstore/KVStore.h" #include "meta/ActiveHostsMan.h" #include "meta/MetaServiceUtils.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" namespace nebula { @@ -43,16 +42,6 @@ using SignType = storage::cpp2::EngineSignType; break; \ } -/** - * Check segment is consist of numbers and letters and should not empty. - * */ -#define CHECK_SEGMENT(segment) \ - if (!MetaCommon::checkSegment(segment)) { \ - handleErrorCode(nebula::cpp2::ErrorCode::E_STORE_SEGMENT_ILLEGAL); \ - onFinished(); \ - return; \ - } - template class BaseProcessor { public: @@ -66,13 +55,21 @@ class BaseProcessor { protected: /** - * Destroy current instance when finished. - * */ + * @brief Destroy current instance when finished. + * + */ virtual void onFinished() { promise_.setValue(std::move(resp_)); delete this; } + /** + * @brief Set error code and handle leader changed. + * + * @param code + * @param spaceId + * @param partId + */ void handleErrorCode(nebula::cpp2::ErrorCode code, GraphSpaceID spaceId = kDefaultSpaceId, PartitionID partId = kDefaultPartId) { @@ -82,6 +79,12 @@ class BaseProcessor { } } + /** + * @brief Set leader address to reponse. + * + * @param spaceId + * @param partId + */ void handleLeaderChanged(GraphSpaceID spaceId, PartitionID partId) { auto leaderRet = kvstore_->partLeader(spaceId, partId); if (ok(leaderRet)) { @@ -120,153 +123,379 @@ class BaseProcessor { } /** - * General put function. - * */ + * @brief Batch put data to meta kv store synchronously. + * Note that it has side effect: it will set the code to the resp_, + * and delete the processor instance. So, it could be only used + * in the Processor:process() end. + * + * @tparam RESP + * @param data kv pairs to put + */ void doPut(std::vector data); + /** + * @brief Get the iterator on given meta prefix. + * + * @tparam RESP + * @param key + * @param canReadFromFollower read from follower's local + * @return ErrorOr> + */ ErrorOr> doPrefix( const std::string& key, bool canReadFromFollower = false); /** - * General get function. - * */ + * @brief Get the given key's value + * + * @tparam RESP + * @param key + * @return ErrorOr + */ ErrorOr doGet(const std::string& key); /** - * General multi get function. - * */ + * @brief Multiple get for given keys. + * + * @tparam RESP + * @param keys + * @return ErrorOr> + */ ErrorOr> doMultiGet( const std::vector& keys); /** - * General remove function. - * */ + * @brief Remove given keys from kv store. + * Note that it has side effect: it will set the code to the resp_, + * and delete the processor instance. So, it could be only used + * in the Processor:process() end. + * + * @tparam RESP + * @param key + */ void doRemove(const std::string& key); /** - * Remove keys from start to end, doesn't contain end. - * */ + * @brief Range remove. + * Note that it has side effect: it will set the code to the resp_, + * and delete the processor instance. So, it could be only used + * in the Processor:process() end. + * + * @tparam RESP + * @param start + * @param end + */ void doRemoveRange(const std::string& start, const std::string& end); /** - * Scan keys from start to end, doesn't contain end. - * */ + * @brief Range scan. + * + * @tparam RESP + * @param start + * @param end + * @return ErrorOr> + */ ErrorOr> doScan(const std::string& start, const std::string& end); /** - * General multi remove function. - **/ + * @brief Batch remove. + * Note that it has side effect: it will set the code to the resp_, + * and delete the processor instance. So, it could be only used + * in the Processor:process() end. + * + * @tparam RESP + * @param keys + */ void doMultiRemove(std::vector keys); /** - * General batch function. - **/ + * @brief Batch general operation. + * Note that it has side effect: it will set the code to the resp_, + * and delete the processor instance. So, it could be only used + * in the Processor:process() end. + * + * @tparam RESP + * @param batchOp + */ void doBatchOperation(std::string batchOp); /** - * Get one auto-increment Id. - * */ + * @brief Increment global auto-incremental id and then return it. + * Note that it has side effect: it will set the code to the resp_. + * + * @tparam RESP + * @return ErrorOr + */ ErrorOr autoIncrementId(); /** - * Get the current available global id - **/ + * @brief Get global incremental id without incrementing it. + * + * @tparam RESP + * @return ErrorOr + */ ErrorOr getAvailableGlobalId(); /** - * Get one auto-increment Id in spaceId. - * */ + * @brief Increment space auto-incremental id and then return it. + * + * @tparam RESP + * @param spaceId + * @return ErrorOr + */ ErrorOr autoIncrementIdInSpace(GraphSpaceID spaceId); /** - * Check spaceId exist or not. - * */ + * @brief Check if given space exist or not. + * + * @tparam RESP + * @param spaceId + * @return SUCCEEDED means exist, E_SPACE_NOT_FOUND means not, others means error. + */ nebula::cpp2::ErrorCode spaceExist(GraphSpaceID spaceId); /** - * Check user exist or not. - **/ + * @brief Check if given user exist or not. + * + * @tparam RESP + * @param account + * @return SUCCEEDED means exist, E_USER_NOT_FOUND means not, others means error. + */ nebula::cpp2::ErrorCode userExist(const std::string& account); /** - * Check machine has been registered or not. - * */ + * @brief Check if given machine exist. + * + * @tparam RESP + * @param machineKey + * @return SUCCEEDED means exist, E_NOT_FOUND means not, others means error. + */ nebula::cpp2::ErrorCode machineExist(const std::string& machineKey); + /** + * @brief Check if given host exist. + * + * @tparam RESP + * @param hostKey + * @return SUCCEEDED means exist, E_NOT_FOUND means not, others means error. + */ nebula::cpp2::ErrorCode hostExist(const std::string& hostKey); /** - * Check hosts has been include by zone or not. - * */ + * @brief Check if any host in host list included by any zone. + * + * @tparam RESP + * @param hosts + * @return nebula::cpp1::ErrorCode + */ nebula::cpp2::ErrorCode includeByZone(const std::vector& hosts); /** - * Return the spaceId for name. - * */ + * @brief Get space id by space name + * + * @tparam RESP + * @param name + * @return ErrorOr + */ ErrorOr getSpaceId(const std::string& name); /** - * Return the tagId for name. + * @brief Get tag id by space id and tag name + * + * @tparam RESP + * @param spaceId + * @param name tag name + * @return ErrorOr */ ErrorOr getTagId(GraphSpaceID spaceId, const std::string& name); /** - * Fetch the latest version tag's schema. + * @brief Fetch the latest version tag's schema by space id and tag id + * + * @tparam RESP + * @param spaceId + * @param tagId + * @return ErrorOr */ ErrorOr getLatestTagSchema(GraphSpaceID spaceId, const TagID tagId); /** - * Return the edgeType for name. + * @brief Get edge type by space id and edge name + * + * @tparam RESP + * @param spaceId + * @param name edge name + * @return ErrorOr */ ErrorOr getEdgeType(GraphSpaceID spaceId, const std::string& name); /** - * Fetch the latest version edge's schema. + * @brief Retch the latest version edge's schema by space id and tag id + * + * @tparam RESP + * @param spaceId + * @param edgeType + * @return ErrorOr */ ErrorOr getLatestEdgeSchema(GraphSpaceID spaceId, const EdgeType edgeType); + /** + * @brief Get index id by space id and index name + * + * @tparam RESP + * @param spaceId + * @param indexName + * @return ErrorOr + */ ErrorOr getIndexID(GraphSpaceID spaceId, const std::string& indexName); + /** + * @brief Check if password identical or not. + * + * @tparam RESP + * @param account + * @param password + * @return ErrorOr + */ ErrorOr checkPassword(const std::string& account, const std::string& password); + /** + * @brief Put data to kvstore synchronously without side effect. + * + * @tparam RESP + * @param data + * @return nebula::cpp2::ErrorCode + */ nebula::cpp2::ErrorCode doSyncPut(std::vector data); + /** + * @brief Put data to the kvstore synchronously. If finished successfully, + * it will update the LastUpdateTime, indicating the metaclient should refresh + * its local schema cache. + * Note that it has side effect: it will set the code to the resp_, + * and delete the processor instance. So, it could be only used + * in the Processor:process() end. + * + * @tparam RESP + * @param data + */ void doSyncPutAndUpdate(std::vector data); + /** + * @brief Remove data from the kvstore synchronously. If finished successfully, + * it will update the LastUpdateTime, indicating the metaclient should refresh + * its local schema cache. + * Note that it has side effect: it will set the code to the resp_, + * and delete the processor instance. So, it could be only used + * in the Processor:process() end. + * + * @tparam RESP + * @param keys + */ void doSyncMultiRemoveAndUpdate(std::vector keys); /** - * Check the edge or tag contains indexes when alter it. - **/ + * @brief Check if tag/edge contains index when alter it. + * + * @tparam RESP + * @param items + * @param alterItems + * @return ErrorCode::E_CONFLICT if contains + */ nebula::cpp2::ErrorCode indexCheck(const std::vector& items, const std::vector& alterItems); + /** + * @brief Check if tag/edge containes full text index when alter it. + * + * @tparam RESP + * @param cols + * @param alterItems + * @return nebula::cpp2::ErrorCode + */ nebula::cpp2::ErrorCode ftIndexCheck(const std::vector& cols, const std::vector& alterItems); + /** + * @brief List all tag/edge index for given space and tag/edge id. + * + * @tparam RESP + * @param spaceId + * @param tagOrEdge tag id or edge id + * @return ErrorOr> + */ ErrorOr> getIndexes(GraphSpaceID spaceId, int32_t tagOrEdge); + /** + * @brief Get all full text indexes for given space and tag/edge id. + * + * @tparam RESP + * @param spaceId + * @param tagOrEdge + * @return ErrorOr + */ ErrorOr getFTIndex(GraphSpaceID spaceId, int32_t tagOrEdge); + /** + * @brief Check if index on given fields alredy exist. + * + * @tparam RESP + * @param fields + * @param item + * @return true + * @return false + */ bool checkIndexExist(const std::vector& fields, const cpp2::IndexItem& item); + /** + * @brief Get zone id by zone name + * + * @tparam RESP + * @param zoneName + * @return ErrorOr + */ ErrorOr getZoneId(const std::string& zoneName); + /** + * @brief Check if given space exist given type's listener. + * + * @tparam RESP + * @param space + * @param type + * @return nebula::cpp2::ErrorCode + */ nebula::cpp2::ErrorCode listenerExist(GraphSpaceID space, cpp2::ListenerType type); - // A direct value of true means that data will not be written to follow via - // the raft protocol, but will be written directly to local disk + /** + * @brief Used in BR, after restore meta data, it will replace partition info from + * current ip to backup ip. + * + * @param ipv4From + * @param ipv4To + * @param direct A direct value of true means that data will not be written to follow via + * the raft protocol, but will be written directly to local disk + * @return ErrorOr + */ ErrorOr replaceHostInPartition(const HostAddr& ipv4From, const HostAddr& ipv4To, bool direct = false); + /** + * @brief Used in BR, after restore meta data, it will replace Zone info from + * current ip to backup ip. + * + * @param ipv4From + * @param ipv4To + * @param direct A direct value of true means that data will not be written to follow via + * the raft protocol, but will be written directly to local disk + * @return ErrorOr + */ ErrorOr replaceHostInZone(const HostAddr& ipv4From, const HostAddr& ipv4To, bool direct = false); diff --git a/src/meta/processors/admin/AdminClient.cpp b/src/meta/processors/admin/AdminClient.cpp index 3decaf0b314..5dda012e652 100644 --- a/src/meta/processors/admin/AdminClient.cpp +++ b/src/meta/processors/admin/AdminClient.cpp @@ -11,7 +11,6 @@ #include "common/utils/Utils.h" #include "kvstore/Part.h" #include "meta/ActiveHostsMan.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" DEFINE_int32(max_retry_times_admin_op, 30, "max retry times for admin request!"); diff --git a/src/meta/processors/admin/RestoreProcessor.cpp b/src/meta/processors/admin/RestoreProcessor.cpp index 3f3c35e6cab..acf803b5f2d 100644 --- a/src/meta/processors/admin/RestoreProcessor.cpp +++ b/src/meta/processors/admin/RestoreProcessor.cpp @@ -6,7 +6,6 @@ #include "meta/processors/admin/RestoreProcessor.h" #include "common/fs/FileUtils.h" -#include "meta/common/MetaCommon.h" namespace nebula { namespace meta { diff --git a/src/meta/processors/admin/SnapShot.cpp b/src/meta/processors/admin/SnapShot.cpp index 49452bd83d5..2b29402d273 100644 --- a/src/meta/processors/admin/SnapShot.cpp +++ b/src/meta/processors/admin/SnapShot.cpp @@ -10,7 +10,6 @@ #include "common/network/NetworkUtils.h" #include "common/utils/MetaKeyUtils.h" #include "meta/ActiveHostsMan.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" namespace nebula { diff --git a/src/meta/processors/config/GetConfigProcessor.cpp b/src/meta/processors/config/GetConfigProcessor.cpp index 1b1d45fb0d9..47a37da6b6c 100644 --- a/src/meta/processors/config/GetConfigProcessor.cpp +++ b/src/meta/processors/config/GetConfigProcessor.cpp @@ -50,8 +50,8 @@ nebula::cpp2::ErrorCode GetConfigProcessor::getOneConfig(const cpp2::ConfigModul if (retCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { retCode = nebula::cpp2::ErrorCode::E_CONFIG_NOT_FOUND; } - LOG(ERROR) << "Get config " << name - << " failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Get config " << name + << " failed, error: " << apache::thrift::util::enumNameSafe(retCode); return retCode; } diff --git a/src/meta/processors/config/GetConfigProcessor.h b/src/meta/processors/config/GetConfigProcessor.h index 398c7f3027f..439ae9f8281 100644 --- a/src/meta/processors/config/GetConfigProcessor.h +++ b/src/meta/processors/config/GetConfigProcessor.h @@ -11,6 +11,10 @@ namespace nebula { namespace meta { +/** + * @brief Get dynamic configuration by given name in given module(all, meta, graph, storage) + * + */ class GetConfigProcessor : public BaseProcessor { public: static GetConfigProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/processors/config/ListConfigsProcessor.cpp b/src/meta/processors/config/ListConfigsProcessor.cpp index cc7056601c8..788efce778b 100644 --- a/src/meta/processors/config/ListConfigsProcessor.cpp +++ b/src/meta/processors/config/ListConfigsProcessor.cpp @@ -15,7 +15,7 @@ void ListConfigsProcessor::process(const cpp2::ListConfigsReq& req) { auto iterRet = doPrefix(prefix); if (!nebula::ok(iterRet)) { auto retCode = nebula::error(iterRet); - LOG(ERROR) << "List configs failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List configs failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; diff --git a/src/meta/processors/config/ListConfigsProcessor.h b/src/meta/processors/config/ListConfigsProcessor.h index 9995cfc06a5..0326d6e2817 100644 --- a/src/meta/processors/config/ListConfigsProcessor.h +++ b/src/meta/processors/config/ListConfigsProcessor.h @@ -11,6 +11,10 @@ namespace nebula { namespace meta { +/** + * @brief List all registered configs in given module + * + */ class ListConfigsProcessor : public BaseProcessor { public: static ListConfigsProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/processors/config/RegConfigProcessor.cpp b/src/meta/processors/config/RegConfigProcessor.cpp index 204b805c163..cf70c7321e9 100644 --- a/src/meta/processors/config/RegConfigProcessor.cpp +++ b/src/meta/processors/config/RegConfigProcessor.cpp @@ -28,7 +28,7 @@ void RegConfigProcessor::process(const cpp2::RegConfigReq& req) { } else { auto retCode = nebula::error(configRet); if (retCode != nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { - LOG(ERROR) << "Get config Failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Get config Failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; diff --git a/src/meta/processors/config/RegConfigProcessor.h b/src/meta/processors/config/RegConfigProcessor.h index 09fe8990f57..40f69ec238d 100644 --- a/src/meta/processors/config/RegConfigProcessor.h +++ b/src/meta/processors/config/RegConfigProcessor.h @@ -11,6 +11,11 @@ namespace nebula { namespace meta { +/** + * @brief Register configuration in meta service, configuration item could be + * set only after registered. + * + */ class RegConfigProcessor : public BaseProcessor { public: static RegConfigProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/processors/config/SetConfigProcessor.cpp b/src/meta/processors/config/SetConfigProcessor.cpp index 17b4c3ed971..53a92636d97 100644 --- a/src/meta/processors/config/SetConfigProcessor.cpp +++ b/src/meta/processors/config/SetConfigProcessor.cpp @@ -59,8 +59,8 @@ nebula::cpp2::ErrorCode SetConfigProcessor::setConfig(const cpp2::ConfigModule& if (retCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { retCode = nebula::cpp2::ErrorCode::E_CONFIG_NOT_FOUND; } - LOG(ERROR) << "Set config " << name << " failed, error " - << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Set config " << name << " failed, error " + << apache::thrift::util::enumNameSafe(retCode); return retCode; } diff --git a/src/meta/processors/config/SetConfigProcessor.h b/src/meta/processors/config/SetConfigProcessor.h index 7cd8d77e5aa..bd1a60439a8 100644 --- a/src/meta/processors/config/SetConfigProcessor.h +++ b/src/meta/processors/config/SetConfigProcessor.h @@ -11,6 +11,10 @@ namespace nebula { namespace meta { +/** + * @brief Set configuration of given module's given name, + * + */ class SetConfigProcessor : public BaseProcessor { public: static SetConfigProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/processors/id/GetWorkerIdProcessor.h b/src/meta/processors/id/GetWorkerIdProcessor.h index 1b1433d81a2..f2db79836f2 100644 --- a/src/meta/processors/id/GetWorkerIdProcessor.h +++ b/src/meta/processors/id/GetWorkerIdProcessor.h @@ -11,6 +11,11 @@ namespace nebula { namespace meta { +/** + * @brief Assign an incremental work id for each host in cluster, used to + * generate snowflake uuid + * + */ class GetWorkerIdProcessor : public BaseProcessor { public: static GetWorkerIdProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/processors/job/BalancePlan.cpp b/src/meta/processors/job/BalancePlan.cpp index 84ed777e57f..7750fb2945f 100644 --- a/src/meta/processors/job/BalancePlan.cpp +++ b/src/meta/processors/job/BalancePlan.cpp @@ -8,7 +8,6 @@ #include #include "meta/ActiveHostsMan.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" DEFINE_uint32(task_concurrency, 10, "The tasks number could be invoked simultaneously"); diff --git a/src/meta/processors/job/JobDescription.cpp b/src/meta/processors/job/JobDescription.cpp index 2586168dbfd..230da7e7f2e 100644 --- a/src/meta/processors/job/JobDescription.cpp +++ b/src/meta/processors/job/JobDescription.cpp @@ -10,8 +10,8 @@ #include #include +#include "common/utils/MetaKeyUtils.h" #include "kvstore/KVIterator.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" #include "meta/processors/job/JobUtils.h" diff --git a/src/meta/processors/job/JobExecutor.cpp b/src/meta/processors/job/JobExecutor.cpp index f8d01f143f6..ec20a1f6602 100644 --- a/src/meta/processors/job/JobExecutor.cpp +++ b/src/meta/processors/job/JobExecutor.cpp @@ -10,7 +10,6 @@ #include "common/utils/Utils.h" #include "interface/gen-cpp2/common_types.h" #include "meta/ActiveHostsMan.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" #include "meta/processors/admin/AdminClient.h" #include "meta/processors/job/CompactJobExecutor.h" diff --git a/src/meta/processors/job/JobManager.cpp b/src/meta/processors/job/JobManager.cpp index 795ade3c73c..fb55c652f5a 100644 --- a/src/meta/processors/job/JobManager.cpp +++ b/src/meta/processors/job/JobManager.cpp @@ -18,7 +18,6 @@ #include "interface/gen-cpp2/common_types.h" #include "kvstore/Common.h" #include "kvstore/KVIterator.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" #include "meta/processors/admin/AdminClient.h" #include "meta/processors/job/BalancePlan.h" diff --git a/src/meta/processors/job/RebuildJobExecutor.cpp b/src/meta/processors/job/RebuildJobExecutor.cpp index cd80e043633..8be68da16f9 100644 --- a/src/meta/processors/job/RebuildJobExecutor.cpp +++ b/src/meta/processors/job/RebuildJobExecutor.cpp @@ -9,7 +9,6 @@ #include "common/utils/MetaKeyUtils.h" #include "common/utils/Utils.h" #include "meta/ActiveHostsMan.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" DECLARE_int32(heartbeat_interval_secs); diff --git a/src/meta/processors/job/StatsJobExecutor.cpp b/src/meta/processors/job/StatsJobExecutor.cpp index ef45e303211..bb918c4f22a 100644 --- a/src/meta/processors/job/StatsJobExecutor.cpp +++ b/src/meta/processors/job/StatsJobExecutor.cpp @@ -7,7 +7,6 @@ #include "common/utils/MetaKeyUtils.h" #include "common/utils/Utils.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" namespace nebula { diff --git a/src/meta/processors/job/StorageJobExecutor.cpp b/src/meta/processors/job/StorageJobExecutor.cpp index 14ef50aa4bd..6432b25c423 100644 --- a/src/meta/processors/job/StorageJobExecutor.cpp +++ b/src/meta/processors/job/StorageJobExecutor.cpp @@ -10,7 +10,6 @@ #include "common/utils/Utils.h" #include "interface/gen-cpp2/common_types.h" #include "meta/ActiveHostsMan.h" -#include "meta/common/MetaCommon.h" #include "meta/processors/Common.h" #include "meta/processors/admin/AdminClient.h" #include "meta/processors/job/BalanceJobExecutor.h" diff --git a/src/meta/processors/kv/GetProcessor.cpp b/src/meta/processors/kv/GetProcessor.cpp deleted file mode 100644 index bed3a344cad..00000000000 --- a/src/meta/processors/kv/GetProcessor.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#include "meta/processors/kv/GetProcessor.h" - -namespace nebula { -namespace meta { - -void GetProcessor::process(const cpp2::GetReq& req) { - auto key = MetaKeyUtils::assembleSegmentKey(req.get_segment(), req.get_key()); - auto result = doGet(key); - if (!nebula::ok(result)) { - auto retCode = nebula::error(result); - LOG(ERROR) << "Get Failed: " << key - << " error: " << apache::thrift::util::enumNameSafe(retCode); - handleErrorCode(retCode); - onFinished(); - return; - } - - handleErrorCode(nebula::cpp2::ErrorCode::SUCCEEDED); - resp_.value_ref() = std::move(nebula::value(result)); - onFinished(); -} - -} // namespace meta -} // namespace nebula diff --git a/src/meta/processors/kv/GetProcessor.h b/src/meta/processors/kv/GetProcessor.h deleted file mode 100644 index f555044d09e..00000000000 --- a/src/meta/processors/kv/GetProcessor.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#ifndef META_GETPROCESSOR_H_ -#define META_GETPROCESSOR_H_ - -#include "meta/processors/BaseProcessor.h" - -namespace nebula { -namespace meta { - -class GetProcessor : public BaseProcessor { - public: - static GetProcessor* instance(kvstore::KVStore* kvstore) { - return new GetProcessor(kvstore); - } - - void process(const cpp2::GetReq& req); - - private: - explicit GetProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} -}; - -} // namespace meta -} // namespace nebula - -#endif // META_GETPROCESSOR_H_ diff --git a/src/meta/processors/kv/MultiGetProcessor.cpp b/src/meta/processors/kv/MultiGetProcessor.cpp deleted file mode 100644 index ef50ff56337..00000000000 --- a/src/meta/processors/kv/MultiGetProcessor.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#include "meta/processors/kv/MultiGetProcessor.h" - -namespace nebula { -namespace meta { - -void MultiGetProcessor::process(const cpp2::MultiGetReq& req) { - std::vector keys; - for (auto& key : req.get_keys()) { - keys.emplace_back(MetaKeyUtils::assembleSegmentKey(req.get_segment(), key)); - } - - auto result = doMultiGet(std::move(keys)); - if (!nebula::ok(result)) { - auto retCode = nebula::error(result); - LOG(ERROR) << "MultiGet Failed, error: " << apache::thrift::util::enumNameSafe(retCode); - handleErrorCode(retCode); - onFinished(); - return; - } - - handleErrorCode(nebula::cpp2::ErrorCode::SUCCEEDED); - resp_.values_ref() = std::move(nebula::value(result)); - onFinished(); -} - -} // namespace meta -} // namespace nebula diff --git a/src/meta/processors/kv/MultiGetProcessor.h b/src/meta/processors/kv/MultiGetProcessor.h deleted file mode 100644 index d7f06cfd738..00000000000 --- a/src/meta/processors/kv/MultiGetProcessor.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#ifndef META_MULTIGETPROCESSOR_H_ -#define META_MULTIGETPROCESSOR_H_ - -#include "meta/processors/BaseProcessor.h" - -namespace nebula { -namespace meta { - -class MultiGetProcessor : public BaseProcessor { - public: - static MultiGetProcessor* instance(kvstore::KVStore* kvstore) { - return new MultiGetProcessor(kvstore); - } - - void process(const cpp2::MultiGetReq& req); - - private: - explicit MultiGetProcessor(kvstore::KVStore* kvstore) - : BaseProcessor(kvstore) {} -}; - -} // namespace meta -} // namespace nebula - -#endif // META_MULTIGETPROCESSOR_H_ diff --git a/src/meta/processors/kv/MultiPutProcessor.cpp b/src/meta/processors/kv/MultiPutProcessor.cpp deleted file mode 100644 index 43a655f4d98..00000000000 --- a/src/meta/processors/kv/MultiPutProcessor.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#include "meta/processors/kv/MultiPutProcessor.h" - -namespace nebula { -namespace meta { - -void MultiPutProcessor::process(const cpp2::MultiPutReq& req) { - CHECK_SEGMENT(req.get_segment()); - std::vector data; - for (auto& pair : req.get_pairs()) { - data.emplace_back(MetaKeyUtils::assembleSegmentKey(req.get_segment(), pair.key), pair.value); - } - doPut(std::move(data)); -} - -} // namespace meta -} // namespace nebula diff --git a/src/meta/processors/kv/MultiPutProcessor.h b/src/meta/processors/kv/MultiPutProcessor.h deleted file mode 100644 index 676bcc4f050..00000000000 --- a/src/meta/processors/kv/MultiPutProcessor.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#ifndef META_MULTIPUTPROCESSOR_H_ -#define META_MULTIPUTPROCESSOR_H_ - -#include "meta/processors/BaseProcessor.h" - -namespace nebula { -namespace meta { - -class MultiPutProcessor : public BaseProcessor { - public: - static MultiPutProcessor* instance(kvstore::KVStore* kvstore) { - return new MultiPutProcessor(kvstore); - } - - void process(const cpp2::MultiPutReq& req); - - private: - explicit MultiPutProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} -}; - -} // namespace meta -} // namespace nebula - -#endif // META_MULTIPUTPROCESSOR_H_ diff --git a/src/meta/processors/kv/RemoveProcessor.cpp b/src/meta/processors/kv/RemoveProcessor.cpp deleted file mode 100644 index be3c36849d9..00000000000 --- a/src/meta/processors/kv/RemoveProcessor.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#include "meta/processors/kv/RemoveProcessor.h" - -namespace nebula { -namespace meta { - -void RemoveProcessor::process(const cpp2::RemoveReq& req) { - CHECK_SEGMENT(req.get_segment()); - auto key = MetaKeyUtils::assembleSegmentKey(req.get_segment(), req.get_key()); - doRemove(key); -} - -} // namespace meta -} // namespace nebula diff --git a/src/meta/processors/kv/RemoveProcessor.h b/src/meta/processors/kv/RemoveProcessor.h deleted file mode 100644 index 652f79c0dbb..00000000000 --- a/src/meta/processors/kv/RemoveProcessor.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#ifndef META_REMOVEPROCESSOR_H_ -#define META_REMOVEPROCESSOR_H_ - -#include "meta/processors/BaseProcessor.h" - -namespace nebula { -namespace meta { - -/** - * Remove some rows in custom kv operations. - * */ -class RemoveProcessor : public BaseProcessor { - public: - static RemoveProcessor* instance(kvstore::KVStore* kvstore) { - return new RemoveProcessor(kvstore); - } - - void process(const cpp2::RemoveReq& req); - - private: - explicit RemoveProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} -}; - -} // namespace meta -} // namespace nebula - -#endif // META_DELETEPROCESSOR_H_ diff --git a/src/meta/processors/kv/RemoveRangeProcessor.cpp b/src/meta/processors/kv/RemoveRangeProcessor.cpp deleted file mode 100644 index 99f6155cb4e..00000000000 --- a/src/meta/processors/kv/RemoveRangeProcessor.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#include "meta/processors/kv/RemoveRangeProcessor.h" - -namespace nebula { -namespace meta { - -void RemoveRangeProcessor::process(const cpp2::RemoveRangeReq& req) { - CHECK_SEGMENT(req.get_segment()); - auto start = MetaKeyUtils::assembleSegmentKey(req.get_segment(), req.get_start()); - auto end = MetaKeyUtils::assembleSegmentKey(req.get_segment(), req.get_end()); - doRemoveRange(start, end); -} - -} // namespace meta -} // namespace nebula diff --git a/src/meta/processors/kv/RemoveRangeProcessor.h b/src/meta/processors/kv/RemoveRangeProcessor.h deleted file mode 100644 index d6587aac9f6..00000000000 --- a/src/meta/processors/kv/RemoveRangeProcessor.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#ifndef META_REMOVERANGEPROCESSOR_H_ -#define META_REMOVERANGEPROCESSOR_H_ - -#include "meta/processors/BaseProcessor.h" - -namespace nebula { -namespace meta { - -class RemoveRangeProcessor : public BaseProcessor { - public: - static RemoveRangeProcessor* instance(kvstore::KVStore* kvstore) { - return new RemoveRangeProcessor(kvstore); - } - - void process(const cpp2::RemoveRangeReq& req); - - private: - explicit RemoveRangeProcessor(kvstore::KVStore* kvstore) - : BaseProcessor(kvstore) {} -}; - -} // namespace meta -} // namespace nebula - -#endif // META_REMOVERANGEPROCESSOR_H_ diff --git a/src/meta/processors/kv/ScanProcessor.cpp b/src/meta/processors/kv/ScanProcessor.cpp deleted file mode 100644 index 1b14f1a5b8a..00000000000 --- a/src/meta/processors/kv/ScanProcessor.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#include "meta/processors/kv/ScanProcessor.h" - -namespace nebula { -namespace meta { - -void ScanProcessor::process(const cpp2::ScanReq& req) { - auto start = MetaKeyUtils::assembleSegmentKey(req.get_segment(), req.get_start()); - auto end = MetaKeyUtils::assembleSegmentKey(req.get_segment(), req.get_end()); - auto result = doScan(start, end); - if (!nebula::ok(result)) { - auto retCode = nebula::error(result); - LOG(ERROR) << "Scan Failed, error: " << apache::thrift::util::enumNameSafe(retCode); - handleErrorCode(retCode); - onFinished(); - return; - } - - handleErrorCode(nebula::cpp2::ErrorCode::SUCCEEDED); - resp_.values_ref() = std::move(nebula::value(result)); - onFinished(); -} - -} // namespace meta -} // namespace nebula diff --git a/src/meta/processors/kv/ScanProcessor.h b/src/meta/processors/kv/ScanProcessor.h deleted file mode 100644 index 1d127af59fb..00000000000 --- a/src/meta/processors/kv/ScanProcessor.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#ifndef META_SCANPROCESSOR_H_ -#define META_SCANPROCESSOR_H_ - -#include "meta/processors/BaseProcessor.h" - -namespace nebula { -namespace meta { - -class ScanProcessor : public BaseProcessor { - public: - static ScanProcessor* instance(kvstore::KVStore* kvstore) { - return new ScanProcessor(kvstore); - } - - void process(const cpp2::ScanReq& req); - - private: - explicit ScanProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} -}; - -} // namespace meta -} // namespace nebula - -#endif // META_SCANPROCESSOR_H_ diff --git a/src/meta/processors/listener/ListenerProcessor.cpp b/src/meta/processors/listener/ListenerProcessor.cpp index 52c6daa90be..36966be8cb9 100644 --- a/src/meta/processors/listener/ListenerProcessor.cpp +++ b/src/meta/processors/listener/ListenerProcessor.cpp @@ -21,10 +21,10 @@ void AddListenerProcessor::process(const cpp2::AddListenerReq& req) { auto ret = listenerExist(space, type); if (ret != nebula::cpp2::ErrorCode::E_LISTENER_NOT_FOUND) { if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Add listener failed, listener already exists."; + LOG(INFO) << "Add listener failed, listener already exists."; ret = nebula::cpp2::ErrorCode::E_EXISTED; } else { - LOG(ERROR) << "Add listener failed, error: " << apache::thrift::util::enumNameSafe(ret); + LOG(INFO) << "Add listener failed, error: " << apache::thrift::util::enumNameSafe(ret); } handleErrorCode(ret); onFinished(); @@ -38,7 +38,7 @@ void AddListenerProcessor::process(const cpp2::AddListenerReq& req) { auto iterRet = doPrefix(prefix); if (!nebula::ok(iterRet)) { auto retCode = nebula::error(iterRet); - LOG(ERROR) << "List parts failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List parts failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -65,9 +65,9 @@ void RemoveListenerProcessor::process(const cpp2::RemoveListenerReq& req) { auto ret = listenerExist(space, type); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { if (ret == nebula::cpp2::ErrorCode::E_LISTENER_NOT_FOUND) { - LOG(ERROR) << "Remove listener failed, listener not exists."; + LOG(INFO) << "Remove listener failed, listener not exists."; } else { - LOG(ERROR) << "Remove listener failed, error: " << apache::thrift::util::enumNameSafe(ret); + LOG(INFO) << "Remove listener failed, error: " << apache::thrift::util::enumNameSafe(ret); } handleErrorCode(ret); onFinished(); @@ -80,7 +80,7 @@ void RemoveListenerProcessor::process(const cpp2::RemoveListenerReq& req) { auto iterRet = doPrefix(prefix); if (!nebula::ok(iterRet)) { auto retCode = nebula::error(iterRet); - LOG(ERROR) << "Remove listener failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Remove listener failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -102,7 +102,7 @@ void ListListenerProcessor::process(const cpp2::ListListenerReq& req) { auto iterRet = doPrefix(prefix); if (!nebula::ok(iterRet)) { auto retCode = nebula::error(iterRet); - LOG(ERROR) << "List listener failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List listener failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; diff --git a/src/meta/processors/listener/ListenerProcessor.h b/src/meta/processors/listener/ListenerProcessor.h index 78d8ff61062..9606cc8bf0a 100644 --- a/src/meta/processors/listener/ListenerProcessor.h +++ b/src/meta/processors/listener/ListenerProcessor.h @@ -11,6 +11,13 @@ namespace nebula { namespace meta { +/** + * @brief Add typed listeners for given space, assign one listener for each part round robin. + * Notice that in each space, listeners could be only added once now. + * But, of course, you could remove them and re-add new ones. + * It will use heartbeat to instruct the relative storaged to add listeners physically. + * + */ class AddListenerProcessor : public BaseProcessor { public: static AddListenerProcessor* instance(kvstore::KVStore* kvstore) { @@ -24,6 +31,10 @@ class AddListenerProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief Remove added listener information. Return failed if not found. + * + */ class RemoveListenerProcessor : public BaseProcessor { public: static RemoveListenerProcessor* instance(kvstore::KVStore* kvstore) { @@ -37,6 +48,11 @@ class RemoveListenerProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief List all listeners for given spaces and listener type. + * And will fill the listener ative state. + * + */ class ListListenerProcessor : public BaseProcessor { public: static ListListenerProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/processors/service/ServiceProcessor.cpp b/src/meta/processors/service/ServiceProcessor.cpp index bff6ba7aa30..5e3c7efe44c 100644 --- a/src/meta/processors/service/ServiceProcessor.cpp +++ b/src/meta/processors/service/ServiceProcessor.cpp @@ -15,15 +15,14 @@ void SignInServiceProcessor::process(const cpp2::SignInServiceReq& req) { auto serviceKey = MetaKeyUtils::serviceKey(type); auto ret = doGet(serviceKey); if (nebula::ok(ret)) { - LOG(ERROR) << "Service already exists."; + LOG(INFO) << "Service already exists."; handleErrorCode(nebula::cpp2::ErrorCode::E_EXISTED); onFinished(); return; } else { auto retCode = nebula::error(ret); if (retCode != nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { - LOG(ERROR) << "Sign in service failed, error: " - << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Sign in service failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -44,10 +43,10 @@ void SignOutServiceProcessor::process(const cpp2::SignOutServiceReq& req) { if (!nebula::ok(ret)) { auto retCode = nebula::error(ret); if (retCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { - LOG(ERROR) << "Sign out service failed, service not exists."; + LOG(INFO) << "Sign out service failed, service not exists."; } else { - LOG(ERROR) << "Sign out service failed, error: " - << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Sign out service failed, error: " + << apache::thrift::util::enumNameSafe(retCode); } handleErrorCode(retCode); onFinished(); @@ -66,7 +65,7 @@ void ListServiceClientsProcessor::process(const cpp2::ListServiceClientsReq& req auto ret = doGet(serviceKey); if (!nebula::ok(ret) && nebula::error(ret) != nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { auto retCode = nebula::error(ret); - LOG(ERROR) << "List service failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List service failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; diff --git a/src/meta/processors/service/ServiceProcessor.h b/src/meta/processors/service/ServiceProcessor.h index a424381579e..49ce53b6d74 100644 --- a/src/meta/processors/service/ServiceProcessor.h +++ b/src/meta/processors/service/ServiceProcessor.h @@ -11,6 +11,11 @@ namespace nebula { namespace meta { +/** + * @brief Sign in outer service info. It only used in listeners now, such as es + * service info. + * + */ class SignInServiceProcessor : public BaseProcessor { public: static SignInServiceProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/processors/session/SessionManagerProcessor.cpp b/src/meta/processors/session/SessionManagerProcessor.cpp index 76bb7285b22..bb91bfda288 100644 --- a/src/meta/processors/session/SessionManagerProcessor.cpp +++ b/src/meta/processors/session/SessionManagerProcessor.cpp @@ -13,7 +13,7 @@ void CreateSessionProcessor::process(const cpp2::CreateSessionReq& req) { const auto& user = req.get_user(); auto ret = userExist(user); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "User does not exist, errorCode: " << apache::thrift::util::enumNameSafe(ret); + LOG(INFO) << "User does not exist, errorCode: " << apache::thrift::util::enumNameSafe(ret); handleErrorCode(ret); onFinished(); return; @@ -34,8 +34,8 @@ void CreateSessionProcessor::process(const cpp2::CreateSessionReq& req) { resp_.session_ref() = session; ret = doSyncPut(std::move(data)); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Put data error on meta server, errorCode: " - << apache::thrift::util::enumNameSafe(ret); + LOG(INFO) << "Put data error on meta server, errorCode: " + << apache::thrift::util::enumNameSafe(ret); } handleErrorCode(ret); onFinished(); @@ -53,7 +53,7 @@ void UpdateSessionsProcessor::process(const cpp2::UpdateSessionsReq& req) { auto ret = doGet(sessionKey); if (!nebula::ok(ret)) { auto errCode = nebula::error(ret); - LOG(WARNING) << "Session id `" << sessionId << "' not found"; + LOG(INFO) << "Session id '" << sessionId << "' not found"; if (errCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { errCode = nebula::cpp2::ErrorCode::E_SESSION_NOT_FOUND; } @@ -95,8 +95,8 @@ void UpdateSessionsProcessor::process(const cpp2::UpdateSessionsReq& req) { auto ret = doSyncPut(std::move(data)); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Put data error on meta server, errorCode: " - << apache::thrift::util::enumNameSafe(ret); + LOG(INFO) << "Put data error on meta server, errorCode: " + << apache::thrift::util::enumNameSafe(ret); handleErrorCode(ret); onFinished(); return; @@ -140,7 +140,7 @@ void GetSessionProcessor::process(const cpp2::GetSessionReq& req) { auto ret = doGet(sessionKey); if (!nebula::ok(ret)) { auto errCode = nebula::error(ret); - LOG(ERROR) << "Session id `" << sessionId << "' not found"; + LOG(INFO) << "Session id `" << sessionId << "' not found"; if (errCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { errCode = nebula::cpp2::ErrorCode::E_SESSION_NOT_FOUND; } @@ -162,7 +162,7 @@ void RemoveSessionProcessor::process(const cpp2::RemoveSessionReq& req) { auto ret = doGet(sessionKey); if (!nebula::ok(ret)) { auto errCode = nebula::error(ret); - LOG(ERROR) << "Session id `" << sessionId << "' not found"; + LOG(INFO) << "Session id `" << sessionId << "' not found"; if (errCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { errCode = nebula::cpp2::ErrorCode::E_SESSION_NOT_FOUND; } @@ -186,7 +186,7 @@ void KillQueryProcessor::process(const cpp2::KillQueryReq& req) { auto ret = doGet(sessionKey); if (!nebula::ok(ret)) { auto errCode = nebula::error(ret); - LOG(ERROR) << "Session id `" << sessionId << "' not found"; + LOG(INFO) << "Session id `" << sessionId << "' not found"; if (errCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { errCode = nebula::cpp2::ErrorCode::E_SESSION_NOT_FOUND; } @@ -211,8 +211,8 @@ void KillQueryProcessor::process(const cpp2::KillQueryReq& req) { auto putRet = doSyncPut(std::move(data)); if (putRet != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Put data error on meta server, errorCode: " - << apache::thrift::util::enumNameSafe(putRet); + LOG(INFO) << "Put data error on meta server, errorCode: " + << apache::thrift::util::enumNameSafe(putRet); } handleErrorCode(putRet); onFinished(); diff --git a/src/meta/processors/session/SessionManagerProcessor.h b/src/meta/processors/session/SessionManagerProcessor.h index eb69f9ef74b..fd3d70332bd 100644 --- a/src/meta/processors/session/SessionManagerProcessor.h +++ b/src/meta/processors/session/SessionManagerProcessor.h @@ -6,12 +6,17 @@ #ifndef META_SESSIONMANAGERPROCESSOR_H #define META_SESSIONMANAGERPROCESSOR_H -#include "meta/common/MetaCommon.h" #include "meta/processors/BaseProcessor.h" namespace nebula { namespace meta { +/** + * @brief Create session and write the session meta data to kv store, + * including graph address and client ip. + * It will check if user exist or not first. + * + */ class CreateSessionProcessor : public BaseProcessor { public: static CreateSessionProcessor* instance(kvstore::KVStore* kvstore) { @@ -25,6 +30,11 @@ class CreateSessionProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief Update sessions and get killed queries. Then the graph can kill + * its queries by the reponse. + * + */ class UpdateSessionsProcessor : public BaseProcessor { public: static UpdateSessionsProcessor* instance(kvstore::KVStore* kvstore) { @@ -38,6 +48,10 @@ class UpdateSessionsProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief List all sessions saved in meta kv store. + * + */ class ListSessionsProcessor : public BaseProcessor { public: static ListSessionsProcessor* instance(kvstore::KVStore* kvstore) { @@ -51,6 +65,10 @@ class ListSessionsProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief Get session by specified session id. + * + */ class GetSessionProcessor : public BaseProcessor { public: static GetSessionProcessor* instance(kvstore::KVStore* kvstore) { @@ -64,6 +82,10 @@ class GetSessionProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief Remove session by specified session id. + * + */ class RemoveSessionProcessor : public BaseProcessor { public: static RemoveSessionProcessor* instance(kvstore::KVStore* kvstore) { @@ -77,6 +99,10 @@ class RemoveSessionProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief Mark given queries killed in their sessions. + * + */ class KillQueryProcessor : public BaseProcessor { public: static KillQueryProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/processors/user/AuthenticationProcessor.cpp b/src/meta/processors/user/AuthenticationProcessor.cpp index ac09be9844c..9185324b6f6 100644 --- a/src/meta/processors/user/AuthenticationProcessor.cpp +++ b/src/meta/processors/user/AuthenticationProcessor.cpp @@ -19,18 +19,19 @@ void CreateUserProcessor::process(const cpp2::CreateUserReq& req) { if (retCode != nebula::cpp2::ErrorCode::E_USER_NOT_FOUND) { if (retCode == nebula::cpp2::ErrorCode::SUCCEEDED) { if (!req.get_if_not_exists()) { - LOG(ERROR) << "Create User Failed : User " << account << " already existed!"; + LOG(INFO) << "Create User Failed : User " << account << " already existed!"; retCode = nebula::cpp2::ErrorCode::E_EXISTED; } } else { - LOG(ERROR) << "Create User Failed : User " << account - << " error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Create User Failed : User " << account + << " error: " << apache::thrift::util::enumNameSafe(retCode); } handleErrorCode(retCode); onFinished(); return; } + LOG(INFO) << "Create User " << account; std::vector data; data.emplace_back(MetaKeyUtils::userKey(account), MetaKeyUtils::userVal(password)); doSyncPutAndUpdate(std::move(data)); @@ -49,13 +50,14 @@ void AlterUserProcessor::process(const cpp2::AlterUserReq& req) { if (errCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { errCode = nebula::cpp2::ErrorCode::E_USER_NOT_FOUND; } - LOG(ERROR) << "Get User Failed : User " << account - << " error: " << apache::thrift::util::enumNameSafe(errCode); + LOG(INFO) << "Get User Failed : User " << account + << " error: " << apache::thrift::util::enumNameSafe(errCode); handleErrorCode(errCode); onFinished(); return; } + LOG(INFO) << "Alter User " << account; std::vector data; data.emplace_back(std::move(userKey), std::move(userVal)); doSyncPutAndUpdate(std::move(data)); @@ -71,11 +73,11 @@ void DropUserProcessor::process(const cpp2::DropUserReq& req) { if (req.get_if_exists()) { retCode = nebula::cpp2::ErrorCode::SUCCEEDED; } else { - LOG(ERROR) << "Drop User Failed: " << account << " not found."; + LOG(INFO) << "Drop User Failed: " << account << " not found."; } } else { - LOG(ERROR) << "Drop User Failed, User " << account - << " error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Drop User Failed, User " << account + << " error: " << apache::thrift::util::enumNameSafe(retCode); } handleErrorCode(retCode); onFinished(); @@ -91,8 +93,8 @@ void DropUserProcessor::process(const cpp2::DropUserReq& req) { if (!nebula::ok(iterRet)) { retCode = nebula::error(iterRet); // The error of prefix is leader change - LOG(ERROR) << "Drop User Failed, User " << account - << " error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Drop User Failed, User " << account + << " error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -130,13 +132,15 @@ void GrantProcessor::process(const cpp2::GrantRoleReq& req) { } auto retCode = userExist(account); if (retCode != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Grant User Failed : User " << account - << " error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Grant User Failed : User " << account + << " error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; } + LOG(INFO) << "Grant User " << account + << " role:" << apache::thrift::util::enumNameSafe(roleItem.get_role_type()); std::vector data; data.emplace_back(MetaKeyUtils::roleKey(spaceId, account), MetaKeyUtils::roleVal(roleItem.get_role_type())); @@ -153,8 +157,8 @@ void RevokeProcessor::process(const cpp2::RevokeRoleReq& req) { auto userRet = userExist(account); if (userRet != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Revoke User Failed : User " << account - << " error: " << apache::thrift::util::enumNameSafe(userRet); + LOG(INFO) << "Revoke User Failed : User " << account + << " error: " << apache::thrift::util::enumNameSafe(userRet); handleErrorCode(userRet); onFinished(); return; @@ -167,8 +171,8 @@ void RevokeProcessor::process(const cpp2::RevokeRoleReq& req) { if (userRet == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { userRet = nebula::cpp2::ErrorCode::E_ROLE_NOT_FOUND; } - LOG(ERROR) << "Get Role User Failed : User " << account - << " error: " << apache::thrift::util::enumNameSafe(userRet); + LOG(INFO) << "Get Role User Failed : User " << account + << " error: " << apache::thrift::util::enumNameSafe(userRet); handleErrorCode(userRet); onFinished(); return; @@ -176,12 +180,15 @@ void RevokeProcessor::process(const cpp2::RevokeRoleReq& req) { auto val = nebula::value(result); const auto role = *reinterpret_cast(val.c_str()); if (role != roleItem.get_role_type()) { - LOG(ERROR) << "Revoke User Failed : User " << account << " error: " - << apache::thrift::util::enumNameSafe(nebula::cpp2::ErrorCode::E_IMPROPER_ROLE); + LOG(INFO) << "Revoke User Failed : User " << account << " error: " + << apache::thrift::util::enumNameSafe(nebula::cpp2::ErrorCode::E_IMPROPER_ROLE); handleErrorCode(nebula::cpp2::ErrorCode::E_IMPROPER_ROLE); onFinished(); return; } + + LOG(INFO) << "Revoke user " << account + << "'s role: " << apache::thrift::util::enumNameSafe(roleItem.get_role_type()); doSyncMultiRemoveAndUpdate({std::move(roleKey)}); } @@ -190,8 +197,8 @@ void ChangePasswordProcessor::process(const cpp2::ChangePasswordReq& req) { const auto& account = req.get_account(); auto userRet = userExist(account); if (userRet != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Change password Failed, get user " << account << " failed, " - << " error: " << apache::thrift::util::enumNameSafe(userRet); + LOG(INFO) << "Change password Failed, get user " << account << " failed, " + << " error: " << apache::thrift::util::enumNameSafe(userRet); handleErrorCode(userRet); onFinished(); return; @@ -203,8 +210,8 @@ void ChangePasswordProcessor::process(const cpp2::ChangePasswordReq& req) { if (retCode == nebula::cpp2::ErrorCode::E_KEY_NOT_FOUND) { retCode = nebula::cpp2::ErrorCode::E_USER_NOT_FOUND; } - LOG(ERROR) << "Get user " << account << " failed, " - << " error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Get user " << account << " failed, " + << " error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -212,13 +219,14 @@ void ChangePasswordProcessor::process(const cpp2::ChangePasswordReq& req) { if (!nebula::value(checkRet)) { auto retCode = nebula::cpp2::ErrorCode::E_INVALID_PASSWORD; handleErrorCode(retCode); - LOG(ERROR) << "Change password failed, user " << account - << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Change password failed, user " << account + << apache::thrift::util::enumNameSafe(retCode); onFinished(); return; } } + LOG(INFO) << "Change password for user " << account; auto userKey = MetaKeyUtils::userKey(account); auto userVal = MetaKeyUtils::userVal(req.get_new_encoded_pwd()); std::vector data; @@ -229,11 +237,11 @@ void ChangePasswordProcessor::process(const cpp2::ChangePasswordReq& req) { void ListUsersProcessor::process(const cpp2::ListUsersReq& req) { UNUSED(req); folly::SharedMutex::ReadHolder rHolder(LockUtils::userLock()); - std::string prefix = "__users__"; + std::string prefix = MetaKeyUtils::userPrefix(); auto ret = doPrefix(prefix); if (!nebula::ok(ret)) { auto retCode = nebula::error(ret); - LOG(ERROR) << "List User failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List User failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -247,6 +255,8 @@ void ListUsersProcessor::process(const cpp2::ListUsersReq& req) { users.emplace(std::move(account), std::move(password)); iter->next(); } + + VLOG(2) << "List all users, user count: " << users.size(); resp_.users_ref() = std::move(users); handleErrorCode(nebula::cpp2::ErrorCode::SUCCEEDED); onFinished(); @@ -261,7 +271,7 @@ void ListRolesProcessor::process(const cpp2::ListRolesReq& req) { auto ret = doPrefix(prefix); if (!nebula::ok(ret)) { auto retCode = nebula::error(ret); - LOG(ERROR) << "List roles failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "List roles failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -279,6 +289,8 @@ void ListRolesProcessor::process(const cpp2::ListRolesReq& req) { roles.emplace_back(std::move(role)); iter->next(); } + + VLOG(2) << "List all user roles for space:" << spaceId << ", user role count: " << roles.size(); resp_.roles_ref() = std::move(roles); handleErrorCode(nebula::cpp2::ErrorCode::SUCCEEDED); onFinished(); @@ -292,7 +304,7 @@ void GetUserRolesProcessor::process(const cpp2::GetUserRolesReq& req) { auto ret = doPrefix(prefix); if (!nebula::ok(ret)) { auto retCode = nebula::error(ret); - LOG(ERROR) << "Prefix roles failed, error: " << apache::thrift::util::enumNameSafe(retCode); + LOG(INFO) << "Prefix roles failed, error: " << apache::thrift::util::enumNameSafe(retCode); handleErrorCode(retCode); onFinished(); return; @@ -313,6 +325,8 @@ void GetUserRolesProcessor::process(const cpp2::GetUserRolesReq& req) { } iter->next(); } + + VLOG(2) << "Get user:" << act << " roles, its count: " << roles.size(); resp_.roles_ref() = std::move(roles); handleErrorCode(nebula::cpp2::ErrorCode::SUCCEEDED); onFinished(); diff --git a/src/meta/processors/user/AuthenticationProcessor.h b/src/meta/processors/user/AuthenticationProcessor.h index 79fd01a4945..e044982b16a 100644 --- a/src/meta/processors/user/AuthenticationProcessor.h +++ b/src/meta/processors/user/AuthenticationProcessor.h @@ -11,6 +11,10 @@ namespace nebula { namespace meta { +/** + * @brief Create user with account and password + * + */ class CreateUserProcessor : public BaseProcessor { public: static CreateUserProcessor* instance(kvstore::KVStore* kvstore) { @@ -24,6 +28,11 @@ class CreateUserProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief Update given user's password, return error if user + * not exist. It will override old password without checking. + * + */ class AlterUserProcessor : public BaseProcessor { public: static AlterUserProcessor* instance(kvstore::KVStore* kvstore) { @@ -36,6 +45,10 @@ class AlterUserProcessor : public BaseProcessor { explicit AlterUserProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} }; +/** + * @brief Drop user and revoke related roles. + * + */ class DropUserProcessor : public BaseProcessor { public: static DropUserProcessor* instance(kvstore::KVStore* kvstore) { @@ -48,6 +61,10 @@ class DropUserProcessor : public BaseProcessor { explicit DropUserProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} }; +/** + * @brief Grant user space's given role permission(RoleType:GOD, ADMIN, DBA, USER, GUEST) + * + */ class GrantProcessor : public BaseProcessor { public: static GrantProcessor* instance(kvstore::KVStore* kvstore) { @@ -60,6 +77,10 @@ class GrantProcessor : public BaseProcessor { explicit GrantProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} }; +/** + * @brief Revoke user's given role. Return error if user or role not exist. + * + */ class RevokeProcessor : public BaseProcessor { public: static RevokeProcessor* instance(kvstore::KVStore* kvstore) { @@ -72,6 +93,10 @@ class RevokeProcessor : public BaseProcessor { explicit RevokeProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} }; +/** + * @brief Change given user's password, but it will check old password first. + * + */ class ChangePasswordProcessor : public BaseProcessor { public: static ChangePasswordProcessor* instance(kvstore::KVStore* kvstore) { @@ -85,6 +110,10 @@ class ChangePasswordProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief Get all user's accounts and passwords. + * + */ class ListUsersProcessor : public BaseProcessor { public: static ListUsersProcessor* instance(kvstore::KVStore* kvstore) { @@ -98,6 +127,10 @@ class ListUsersProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief List all user roles granted to given space. + * + */ class ListRolesProcessor : public BaseProcessor { public: static ListRolesProcessor* instance(kvstore::KVStore* kvstore) { @@ -111,6 +144,10 @@ class ListRolesProcessor : public BaseProcessor { : BaseProcessor(kvstore) {} }; +/** + * @brief Get given user's all roles and relative spaces + * + */ class GetUserRolesProcessor : public BaseProcessor { public: static GetUserRolesProcessor* instance(kvstore::KVStore* kvstore) { diff --git a/src/meta/test/ProcessorTest.cpp b/src/meta/test/ProcessorTest.cpp index 58bce373c42..cb7defb05c9 100644 --- a/src/meta/test/ProcessorTest.cpp +++ b/src/meta/test/ProcessorTest.cpp @@ -7,12 +7,6 @@ #include "common/base/Base.h" #include "common/fs/TempDir.h" #include "meta/processors/admin/CreateBackupProcessor.h" -#include "meta/processors/kv/GetProcessor.h" -#include "meta/processors/kv/MultiGetProcessor.h" -#include "meta/processors/kv/MultiPutProcessor.h" -#include "meta/processors/kv/RemoveProcessor.h" -#include "meta/processors/kv/RemoveRangeProcessor.h" -#include "meta/processors/kv/ScanProcessor.h" #include "meta/processors/parts/AlterSpaceProcessor.h" #include "meta/processors/parts/CreateSpaceProcessor.h" #include "meta/processors/parts/DropSpaceProcessor.h" diff --git a/src/meta/upgrade/v1/MetaServiceUtilsV1.h b/src/meta/upgrade/v1/MetaServiceUtilsV1.h index 189a7dcab25..156df78debb 100644 --- a/src/meta/upgrade/v1/MetaServiceUtilsV1.h +++ b/src/meta/upgrade/v1/MetaServiceUtilsV1.h @@ -36,6 +36,11 @@ const std::string kJobArchive = "__job_mgr_archive_"; // NOLINT using ConfigName = std::pair; +/** + * @brief Meta kv store utils to help parsing key and values. + * These shoule be used to upgrade meta from 1.x to 2.x + * + */ class MetaServiceUtilsV1 final { public: MetaServiceUtilsV1() = delete; diff --git a/src/meta/upgrade/v2/MetaServiceUtilsV2.h b/src/meta/upgrade/v2/MetaServiceUtilsV2.h index 47bf010ce98..7c5cbcec9a2 100644 --- a/src/meta/upgrade/v2/MetaServiceUtilsV2.h +++ b/src/meta/upgrade/v2/MetaServiceUtilsV2.h @@ -17,6 +17,11 @@ namespace nebula::meta::v2 { const std::string kGroupsTable = "__groups__"; // NOLINT +/** + * @brief Meta kv store utils to help parsing key and values. + * These shoule be used to upgrade meta from 2.x to 3.x + * + */ class MetaServiceUtilsV2 final { public: MetaServiceUtilsV2() = delete;