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

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

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

wutao 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 f9a7ba6  refactor: use rocksdb_wrapper::write_batch_put to reimplement incr (#667)
f9a7ba6 is described below

commit f9a7ba6c35c69621aa77fd8fd2ca6bfb76a47229
Author: zhao liwei <zl...@163.com>
AuthorDate: Mon Jan 4 11:34:41 2021 +0800

    refactor: use rocksdb_wrapper::write_batch_put to reimplement incr (#667)
---
 src/server/pegasus_write_service_impl.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/server/pegasus_write_service_impl.h b/src/server/pegasus_write_service_impl.h
index ecdf4f3..97bfd61 100644
--- a/src/server/pegasus_write_service_impl.h
+++ b/src/server/pegasus_write_service_impl.h
@@ -256,19 +256,17 @@ public:
             }
         }
 
-        resp.error =
-            db_write_batch_put(decree, update.key, std::to_string(new_value), new_expire_ts);
+        auto cleanup = dsn::defer([this]() { _rocksdb_wrapper->clear_up_write_batch(); });
+        resp.error = _rocksdb_wrapper->write_batch_put(
+            decree, update.key, std::to_string(new_value), new_expire_ts);
         if (resp.error) {
-            clear_up_batch_states(decree, resp.error);
             return resp.error;
         }
 
-        resp.error = db_write(decree);
+        resp.error = _rocksdb_wrapper->write(decree);
         if (resp.error == 0) {
             resp.new_value = new_value;
         }
-
-        clear_up_batch_states(decree, resp.error);
         return resp.error;
     }
 


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