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/20 11:05:15 UTC

[GitHub] [incubator-kvrocks] ellutionist commented on a diff in pull request #901: fix: non positive ttl in slot migration

ellutionist commented on code in PR #901:
URL: https://github.com/apache/incubator-kvrocks/pull/901#discussion_r975209212


##########
src/slot_migrate.cc:
##########
@@ -568,6 +568,12 @@ Status SlotMigrate::MigrateOneKey(rocksdb::Slice key, std::string *restore_cmds)
     return Status(Status::cOK, "empty");;
   }
 
+  int64_t now;
+  rocksdb::Env::Default()->GetCurrentTime(&now);
+  if (metadata.expire <= now) {

Review Comment:
   Thank you for reminding me to check that `metadata.expire` must be greater than 0.
   The reason why I did not use `metadata.Expired()` is that this method returns `false` when `metadata.expire == now`, which will make the source send a ttl of 0 to the destination, thus ruin the whole slot migration. I happened to meet such case before.



-- 
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