You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by ti...@apache.org on 2022/10/31 08:21:29 UTC

[incubator-kvrocks] branch unstable updated: Fix CAS and CAD return statuses (#1055)

This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 0a1a9fc5 Fix CAS and CAD return statuses (#1055)
0a1a9fc5 is described below

commit 0a1a9fc5f40c514a2cc412317e731d04865bea5a
Author: Yaroslav <to...@gmail.com>
AuthorDate: Mon Oct 31 10:21:24 2022 +0200

    Fix CAS and CAD return statuses (#1055)
---
 src/types/redis_string.cc | 5 ++---
 src/types/redis_string.h  | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/types/redis_string.cc b/src/types/redis_string.cc
index 82ff6cc9..eefb766a 100644
--- a/src/types/redis_string.cc
+++ b/src/types/redis_string.cc
@@ -23,7 +23,6 @@
 #include <cmath>
 #include <limits>
 #include <string>
-#include <utility>
 
 #include "parse_util.h"
 
@@ -466,7 +465,7 @@ rocksdb::Status String::CAS(const std::string &user_key, const std::string &old_
     raw_value.append(new_value);
     auto write_status = updateRawValue(ns_key, raw_value);
     if (!write_status.ok()) {
-      return s;
+      return write_status;
     }
     *ret = 1;
   }
@@ -498,7 +497,7 @@ rocksdb::Status String::CAD(const std::string &user_key, const std::string &valu
     auto delete_status = storage_->Delete(storage_->DefaultWriteOptions(),
                                           storage_->GetCFHandle(Engine::kMetadataColumnFamilyName), ns_key);
     if (!delete_status.ok()) {
-      return s;
+      return delete_status;
     }
     *ret = 1;
   }
diff --git a/src/types/redis_string.h b/src/types/redis_string.h
index 94e20a59..98a09c89 100644
--- a/src/types/redis_string.h
+++ b/src/types/redis_string.h
@@ -26,10 +26,10 @@
 #include "storage/redis_db.h"
 #include "storage/redis_metadata.h"
 
-typedef struct {
+struct StringPair {
   Slice key;
   Slice value;
-} StringPair;
+};
 
 namespace Redis {