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 more table in meta dump #3870

Merged
merged 6 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add some prefix func
  • Loading branch information
pengweisong committed Mar 2, 2022
commit 45cc04b0e62fa2f5ca53565bf78d21b2aa648ef2
12 changes: 12 additions & 0 deletions src/common/utils/MetaKeyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ std::string MetaKeyUtils::schemaEdgesPrefix(GraphSpaceID spaceId) {
return key;
}

const std::string& MetaKeyUtils::schemaEdgesPrefix() {
return kEdgesTable;
}

std::string MetaKeyUtils::schemaEdgeKey(GraphSpaceID spaceId,
EdgeType edgeType,
SchemaVer version) {
Expand Down Expand Up @@ -590,6 +594,10 @@ std::string MetaKeyUtils::schemaTagPrefix(GraphSpaceID spaceId, TagID tagId) {
return key;
}

const std::string& MetaKeyUtils::schemaTagsPrefix() {
return kTagsTable;
}

std::string MetaKeyUtils::schemaTagsPrefix(GraphSpaceID spaceId) {
std::string key;
key.reserve(kTagsTable.size() + sizeof(GraphSpaceID));
Expand Down Expand Up @@ -625,6 +633,10 @@ std::string MetaKeyUtils::indexVal(const nebula::meta::cpp2::IndexItem& item) {
return value;
}

const std::string& MetaKeyUtils::indexPrefix() {
return kIndexesTable;
}

std::string MetaKeyUtils::indexPrefix(GraphSpaceID spaceId) {
std::string key;
key.reserve(kIndexesTable.size() + sizeof(GraphSpaceID));
Expand Down
6 changes: 6 additions & 0 deletions src/common/utils/MetaKeyUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ class MetaKeyUtils final {

static std::string schemaEdgesPrefix(GraphSpaceID spaceId);

static const std::string& schemaEdgesPrefix();

static std::string schemaEdgeKey(GraphSpaceID spaceId, EdgeType edgeType, SchemaVer version);

static EdgeType parseEdgeType(folly::StringPiece key);
Expand All @@ -199,6 +201,8 @@ class MetaKeyUtils final {

static std::string schemaTagsPrefix(GraphSpaceID spaceId);

static const std::string& schemaTagsPrefix();

static meta::cpp2::Schema parseSchema(folly::StringPiece rawData);

static std::string indexKey(GraphSpaceID spaceId, IndexID indexID);
Expand All @@ -207,6 +211,8 @@ class MetaKeyUtils final {

static std::string indexPrefix(GraphSpaceID spaceId);

static const std::string& indexPrefix();

static IndexID parseIndexesKeyIndexID(folly::StringPiece key);

static meta::cpp2::IndexItem parseIndex(const folly::StringPiece& rawData);
Expand Down
8 changes: 4 additions & 4 deletions src/tools/meta-dump/MetaDumpTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class MetaDumper {
{
LOG(INFO) << "------------------------------------------\n\n";
LOG(INFO) << "Tag info:";
prefix = "__tags__";
prefix = MetaKeyUtils::schemaTagsPrefix();
iter->Seek(rocksdb::Slice(prefix));
while (iter->Valid() && iter->key().starts_with(prefix)) {
auto key = folly::StringPiece(iter->key().data(), iter->key().size());
Expand All @@ -166,7 +166,7 @@ class MetaDumper {
{
LOG(INFO) << "------------------------------------------\n\n";
LOG(INFO) << "Edge info:";
prefix = "__edges__";
prefix = MetaKeyUtils::schemaEdgesPrefix();
iter->Seek(rocksdb::Slice(prefix));
while (iter->Valid() && iter->key().starts_with(prefix)) {
auto key = folly::StringPiece(iter->key().data(), iter->key().size());
Expand All @@ -180,7 +180,7 @@ class MetaDumper {
{
LOG(INFO) << "------------------------------------------\n\n";
LOG(INFO) << "Index info:";
prefix = "__indexes__";
prefix = MetaKeyUtils::indexPrefix();
iter->Seek(rocksdb::Slice(prefix));
while (iter->Valid() && iter->key().starts_with(prefix)) {
auto key = folly::StringPiece(iter->key().data(), iter->key().size());
Expand All @@ -193,7 +193,7 @@ class MetaDumper {
{
LOG(INFO) << "------------------------------------------\n\n";
LOG(INFO) << "Leader info:";
prefix = "__leader_terms__";
prefix = MetaKeyUtils::leaderPrefix();
HostAddr host;
TermID term;
nebula::cpp2::ErrorCode code;
Expand Down