You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/09/22 09:34:56 UTC
[GitHub] [incubator-kvrocks] caipengbo commented on a diff in pull request #906: Avoid using Get interface to obtain metadata when iterating data during migration
caipengbo commented on code in PR #906:
URL: https://github.com/apache/incubator-kvrocks/pull/906#discussion_r977429524
##########
src/slot_migrate.cc:
##########
@@ -543,29 +543,15 @@ bool SlotMigrate::CheckResponseWithCounts(int sock_fd, int total) {
return true; // Can't reach here
}
-bool SlotMigrate::GetSlotKeyMetadata(const rocksdb::Slice &prefix_key, std::string *bytes) {
- rocksdb::ReadOptions read_options;
- read_options.snapshot = slot_snapshot_;
- auto s = storage_->GetDB()->Get(read_options, storage_->GetCFHandle("metadata"), prefix_key, bytes);
- if (!s.ok()) {
- LOG(ERROR) << "[migrate] Failed to get metadata of key: " << prefix_key.ToString()
- << ", Err: " << s.ToString();
- return false;
- }
- return true;
-}
-
-Status SlotMigrate::MigrateOneKey(rocksdb::Slice key, std::string *restore_cmds) {
+Status SlotMigrate::MigrateOneKey(const rocksdb::Slice &key, const rocksdb::Slice &value, std::string *restore_cmds) {
std::string prefix_key;
AppendNamespacePrefix(key, &prefix_key);
- std::string bytes;
- bool st = GetSlotKeyMetadata(prefix_key, &bytes);
- if (!st) return Status(Status::NotOK, "[migrate] Failed to get key's metadata");
+ std::string bytes = value.ToString();
Review Comment:
That's great. That's something I don't know about. I'll dig into it. thank you @PragmaTwice
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org