You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by zh...@apache.org on 2021/01/04 06:52:37 UTC

[incubator-pegasus] branch master updated: refactor: use rocksdb_wrapper::write_batch_put to reimplement check_and_set (#666)

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

zhaoliwei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new af0b3df  refactor: use rocksdb_wrapper::write_batch_put to reimplement check_and_set (#666)
af0b3df is described below

commit af0b3df27cbd789254e1cd5d24929f7d435c7d48
Author: zhao liwei <zl...@163.com>
AuthorDate: Mon Jan 4 14:52:31 2021 +0800

    refactor: use rocksdb_wrapper::write_batch_put to reimplement check_and_set (#666)
---
 rdsn                                    |  2 +-
 src/server/pegasus_write_service_impl.h | 15 +++++++--------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/rdsn b/rdsn
index f27decf..bcc0e6a 160000
--- a/rdsn
+++ b/rdsn
@@ -1 +1 @@
-Subproject commit f27decf2e7015b4b75e2e40b53ad6b33fb752ecd
+Subproject commit bcc0e6a2f99a323ac36811a4957a22f078a60afc
diff --git a/src/server/pegasus_write_service_impl.h b/src/server/pegasus_write_service_impl.h
index 97bfd61..2638941 100644
--- a/src/server/pegasus_write_service_impl.h
+++ b/src/server/pegasus_write_service_impl.h
@@ -135,20 +135,19 @@ public:
             return empty_put(decree);
         }
 
+        auto cleanup = dsn::defer([this]() { _rocksdb_wrapper->clear_up_write_batch(); });
         for (auto &kv : update.kvs) {
-            resp.error = db_write_batch_put_ctx(ctx,
-                                                composite_raw_key(update.hash_key, kv.key),
-                                                kv.value,
-                                                static_cast<uint32_t>(update.expire_ts_seconds));
+            resp.error = _rocksdb_wrapper->write_batch_put_ctx(
+                ctx,
+                composite_raw_key(update.hash_key, kv.key),
+                kv.value,
+                static_cast<uint32_t>(update.expire_ts_seconds));
             if (resp.error) {
-                clear_up_batch_states(decree, resp.error);
                 return resp.error;
             }
         }
 
-        resp.error = db_write(decree);
-
-        clear_up_batch_states(decree, resp.error);
+        resp.error = _rocksdb_wrapper->write(decree);
         return resp.error;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org