-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add db-upgrade V3 * use ingest * modify upgrade args * write data version key * address wenhao's comment * address some comment * address some comment * format Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com>
- Loading branch information
1 parent
2a4be17
commit a89e5b3
Showing
8 changed files
with
191 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Copyright (c) 2021 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License. | ||
*/ | ||
|
||
#include "tools/db-upgrade/NebulaKeyUtilsV3.h" | ||
|
||
namespace nebula { | ||
std::string NebulaKeyUtilsV3::partTagPrefix(PartitionID partId) { | ||
PartitionID item = (partId << kPartitionOffset) | static_cast<uint32_t>(kTag_); | ||
std::string key; | ||
key.reserve(sizeof(PartitionID)); | ||
key.append(reinterpret_cast<const char*>(&item), sizeof(PartitionID)); | ||
return key; | ||
} | ||
std::string NebulaKeyUtilsV3::getVertexKey(folly::StringPiece tagKey) { | ||
std::string key = tagKey.toString(); | ||
key[3] = static_cast<uint32_t>(kVertex); | ||
key.resize(key.size() - sizeof(TagID)); | ||
return key; | ||
} | ||
std::string NebulaKeyUtilsV3::dataVersionValue() { | ||
return "3.0"; | ||
} | ||
|
||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* Copyright (c) 2021 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License. | ||
*/ | ||
#pragma once | ||
#include "common/utils/Types.h" | ||
namespace nebula { | ||
class NebulaKeyUtilsV3 { | ||
public: | ||
static std::string partTagPrefix(PartitionID partId); | ||
static std::string getVertexKey(folly::StringPiece tagKey); | ||
static std::string dataVersionValue(); | ||
|
||
private: | ||
enum NebulaKeyTypeV3 : uint32_t { kTag_ = 0x00000001, kVertex = 0x00000007 }; | ||
}; | ||
|
||
} // namespace nebula |