Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comments and change log level for meta #3709

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 0 additions & 174 deletions src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,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:
Expand Down Expand Up @@ -1406,134 +1404,6 @@ StatusOr<std::vector<std::string>> MetaClient::getAllEdgeFromCache(const GraphSp
return it->second;
}

folly::Future<StatusOr<bool>> MetaClient::multiPut(
std::string segment, std::vector<std::pair<std::string, std::string>> pairs) {
if (!nebula::meta::checkSegment(segment) || pairs.empty()) {
return Status::Error("arguments invalid!");
}

cpp2::MultiPutReq req;
std::vector<nebula::KeyValue> 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<StatusOr<bool>> 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<StatusOr<std::string>> 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<StatusOr<std::string>> 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<StatusOr<std::vector<std::string>>> MetaClient::multiGet(
std::string segment, std::vector<std::string> 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<StatusOr<std::vector<std::string>>> promise;
auto future = promise.getFuture();
getResponse(
std::move(req),
[](auto client, auto request) { return client->future_multiGet(request); },
[](cpp2::MultiGetResp&& resp) -> std::vector<std::string> { return resp.get_values(); },
std::move(promise));
return future;
}

folly::Future<StatusOr<std::vector<std::string>>> 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<StatusOr<std::vector<std::string>>> promise;
auto future = promise.getFuture();
getResponse(
std::move(req),
[](auto client, auto request) { return client->future_scan(request); },
[](cpp2::ScanResp&& resp) -> std::vector<std::string> { return resp.get_values(); },
std::move(promise));
return future;
}

folly::Future<StatusOr<bool>> 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<StatusOr<bool>> 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<StatusOr<bool>> 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<StatusOr<bool>> 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();
Expand Down Expand Up @@ -2777,50 +2647,6 @@ folly::Future<StatusOr<std::vector<cpp2::RoleItem>>> MetaClient::getUserRoles(st
return future;
}

folly::Future<StatusOr<std::string>> 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<const char*>(&spaceId), sizeof(GraphSpaceID));
key.append(reinterpret_cast<const char*>(&tagId), sizeof(TagID));
key.append(field);
req.key_ref() = std::move(key);
folly::Promise<StatusOr<std::string>> 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<StatusOr<std::string>> 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<const char*>(&spaceId), sizeof(GraphSpaceID));
key.append(reinterpret_cast<const char*>(&edgeType), sizeof(EdgeType));
key.append(field);
req.key_ref() = std::move(key);
folly::Promise<StatusOr<std::string>> 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<StatusOr<bool>> MetaClient::regConfig(const std::vector<cpp2::ConfigItem>& items) {
cpp2::RegConfigReq req;
req.items_ref() = items;
Expand Down
27 changes: 0 additions & 27 deletions src/clients/meta/MetaClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,25 +371,6 @@ class MetaClient {

folly::Future<StatusOr<std::vector<cpp2::IndexStatus>>> listEdgeIndexStatus(GraphSpaceID spaceId);

// Operations for custom kv
folly::Future<StatusOr<bool>> multiPut(std::string segment,
std::vector<std::pair<std::string, std::string>> pairs);

folly::Future<StatusOr<std::string>> get(std::string segment, std::string key);

folly::Future<StatusOr<std::vector<std::string>>> multiGet(std::string segment,
std::vector<std::string> keys);

folly::Future<StatusOr<std::vector<std::string>>> scan(std::string segment,
std::string start,
std::string end);

folly::Future<StatusOr<bool>> remove(std::string segment, std::string key);

folly::Future<StatusOr<bool>> removeRange(std::string segment,
std::string start,
std::string end);

// Operations for users.
folly::Future<StatusOr<bool>> createUser(std::string account,
std::string password,
Expand Down Expand Up @@ -589,14 +570,6 @@ class MetaClient {

const std::vector<HostAddr>& getAddresses();

folly::Future<StatusOr<std::string>> getTagDefaultValue(GraphSpaceID spaceId,
TagID tagId,
const std::string& field);

folly::Future<StatusOr<std::string>> getEdgeDefaultValue(GraphSpaceID spaceId,
EdgeType edgeType,
const std::string& field);

std::vector<cpp2::RoleItem> getRolesByUserFromCache(const std::string& user);

Status authCheckFromCache(const std::string& account, const std::string& password);
Expand Down
7 changes: 0 additions & 7 deletions src/common/meta/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ using RemoteListeners =
std::unordered_map<GraphSpaceID,
std::unordered_map<PartitionID, std::vector<RemoteListenerInfo>>>;

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
Expand Down
7 changes: 0 additions & 7 deletions src/common/utils/MetaKeyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions src/common/utils/MetaKeyUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
59 changes: 0 additions & 59 deletions src/interface/meta.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -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<common.KeyValue> 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<binary> keys,
}

struct MultiGetResp {
1: common.ErrorCode code,
2: common.HostAddr leader,
3: list<binary> 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<binary> values,
}

struct HBResp {
1: common.ErrorCode code,
2: common.HostAddr leader,
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/meta/ActiveHostsMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <thrift/lib/cpp/util/EnumUtils.h>

#include "common/utils/Utils.h"
#include "meta/common/MetaCommon.h"
#include "meta/processors/Common.h"

DECLARE_int32(heartbeat_interval_secs);
Expand Down
6 changes: 0 additions & 6 deletions src/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading