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/23 13:27:50 UTC

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

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


##########
src/redis_cmd.cc:
##########
@@ -486,6 +486,36 @@ class CommandSet : public Commander {
           return Status(Status::RedisParseErr, errValueNotInterger);
         }
         if (ttl_ <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
+      } else if (opt == "exat" && !ttl_ && !expire_ && !last_arg) {
+        try {
+          std::string s = args_[++i];
+          std::string::size_type sz;
+          expire_ = std::stol(s, &sz);

Review Comment:
   Better to use parseInt<>



##########
src/redis_cmd.cc:
##########
@@ -486,6 +486,36 @@ class CommandSet : public Commander {
           return Status(Status::RedisParseErr, errValueNotInterger);
         }
         if (ttl_ <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
+      } else if (opt == "exat" && !ttl_ && !expire_ && !last_arg) {
+        try {
+          std::string s = args_[++i];
+          std::string::size_type sz;
+          expire_ = std::stol(s, &sz);
+          if (sz != s.size()) {
+            return Status(Status::RedisParseErr, errValueNotInterger);
+          }
+        } catch (std::exception &e) {
+          return Status(Status::RedisParseErr, errValueNotInterger);
+        }
+        if (expire_ <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
+      } else if (opt == "pxat" && !ttl_ && !expire_ && !last_arg) {
+        uint64_t expire_ms = 0;
+        try {
+          std::string s = args_[++i];
+          std::string::size_type sz;
+          expire_ms = std::stoul(s, &sz);

Review Comment:
   Better to use parseInt<>



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