PragmaTwice commented on code in PR #1345:
URL: 
https://github.com/apache/incubator-kvrocks/pull/1345#discussion_r1145679599


##########
src/cluster/slot_migrate.cc:
##########
@@ -765,23 +765,10 @@ Status SlotMigrate::MigrateStream(const Slice &key, const 
StreamMetadata &metada
       break;
     }
 
-    // Parse values of the complex key
-    // InternalKey is adopted to get complex key's value from the formatted 
key returned by iterator of rocksdb
-    InternalKey inkey(iter->key(), true);
-    std::vector<std::string> values;
-    auto s = Redis::DecodeRawStreamEntryValue(iter->value().ToString(), 
&values);
+    auto s = WriteBatchExtractor::ExtractStreamAddCommand(true, iter->key(), 
iter->value(), &user_cmd);
     if (!s.IsOK()) {
-      return {Status::NotOK, fmt::format("failed to decode stream values: {}", 
s.Msg())};
+      return s;

Review Comment:
   ```suggestion
         return s.Prefixed("failed to decode stream values");
   ```



##########
src/storage/batch_extractor.cc:
##########
@@ -291,3 +302,23 @@ rocksdb::Status 
WriteBatchExtractor::DeleteRangeCF(uint32_t column_family_id, co
   // Do nothing about DeleteRange operations
   return rocksdb::Status::OK();
 }
+
+Status WriteBatchExtractor::ExtractStreamAddCommand(bool is_slotid_encoded, 
const Slice &subkey, const Slice &value,
+                                                    std::vector<std::string> 
*command_args) {
+  InternalKey ikey(subkey, is_slotid_encoded);
+  std::string user_key = ikey.GetKey().ToString();
+  *command_args = {"XADD", user_key};
+  std::vector<std::string> values;
+  auto s = Redis::DecodeRawStreamEntryValue(value.ToString(), &values);
+  if (!s.IsOK()) {
+    return {Status::NotOK, fmt::format("failed to decode stream values: {}", 
s.Msg())};

Review Comment:
   ```suggestion
       return s.Prefixed("failed to decode stream values");
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to