This is an automated email from the ASF dual-hosted git repository.
laiyingchun 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 b676991a6 refactor: remove useless function 'last_flushed_decree()'
(#1456)
b676991a6 is described below
commit b676991a649f75832ee675ed0271107a13905f1b
Author: Yingchun Lai <[email protected]>
AuthorDate: Thu Apr 20 10:53:53 2023 +0800
refactor: remove useless function 'last_flushed_decree()' (#1456)
https://github.com/apache/incubator-pegasus/issues/887
Function `decree replication_app_base::last_flushed_decree()` is useless
and the only one caller can be replaced, thus this patch remove it.
---
src/replica/replica.cpp | 2 --
src/replica/replica.h | 1 -
src/replica/replication_app_base.h | 1 -
src/server/pegasus_server_impl.cpp | 7 +------
src/server/pegasus_server_impl.h | 2 --
5 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/src/replica/replica.cpp b/src/replica/replica.cpp
index 73182cb5c..5c423a7dc 100644
--- a/src/replica/replica.cpp
+++ b/src/replica/replica.cpp
@@ -439,8 +439,6 @@ mutation_ptr replica::new_mutation(decree decree)
decree replica::last_durable_decree() const { return
_app->last_durable_decree(); }
-decree replica::last_flushed_decree() const { return
_app->last_flushed_decree(); }
-
decree replica::last_prepared_decree() const
{
ballot lastBallot = 0;
diff --git a/src/replica/replica.h b/src/replica/replica.h
index a79550f8d..17d2338e4 100644
--- a/src/replica/replica.h
+++ b/src/replica/replica.h
@@ -229,7 +229,6 @@ public:
decree last_committed_decree() const { return
_prepare_list->last_committed_decree(); }
decree last_prepared_decree() const;
decree last_durable_decree() const;
- decree last_flushed_decree() const;
const std::string &dir() const { return _dir; }
uint64_t create_time_milliseconds() const { return _create_time_ms; }
const char *name() const { return replica_name(); }
diff --git a/src/replica/replication_app_base.h
b/src/replica/replication_app_base.h
index 66ac6fb9b..772270a5f 100644
--- a/src/replica/replication_app_base.h
+++ b/src/replica/replication_app_base.h
@@ -221,7 +221,6 @@ public:
// Query methods.
//
virtual replication::decree last_durable_decree() const = 0;
- virtual replication::decree last_flushed_decree() const { return
last_durable_decree(); }
// The return type is generated by storage engine, e.g.
rocksdb::Status::Code, 0 always mean OK.
virtual int on_request(message_ex *request) = 0;
diff --git a/src/server/pegasus_server_impl.cpp
b/src/server/pegasus_server_impl.cpp
index dba81be2e..a22c2fd3b 100644
--- a/src/server/pegasus_server_impl.cpp
+++ b/src/server/pegasus_server_impl.cpp
@@ -2615,11 +2615,6 @@ void pegasus_server_impl::update_app_envs(const
std::map<std::string, std::strin
update_throttling_controller(envs);
}
-int64_t pegasus_server_impl::last_flushed_decree() const
-{
- return _meta_store->get_last_flushed_decree();
-}
-
void pegasus_server_impl::update_app_envs_before_open_db(
const std::map<std::string, std::string> &envs)
{
@@ -3251,7 +3246,7 @@ bool
pegasus_server_impl::release_storage_after_manual_compact()
gc_checkpoints(true);
LOG_INFO_PREFIX("finish gc_checkpoints, time_used = {}ms", dsn_now_ms() -
start_time);
- int64_t new_last_durable = last_flushed_decree();
+ int64_t new_last_durable = _meta_store->get_last_flushed_decree();
if (new_last_durable > old_last_durable) {
LOG_INFO_PREFIX("release storage succeed, last_durable_decree changed
from {} to {}",
old_last_durable,
diff --git a/src/server/pegasus_server_impl.h b/src/server/pegasus_server_impl.h
index bb0cbd8bd..d156acdce 100644
--- a/src/server/pegasus_server_impl.h
+++ b/src/server/pegasus_server_impl.h
@@ -221,8 +221,6 @@ public:
int64_t last_durable_decree() const override { return
_last_durable_decree.load(); }
- int64_t last_flushed_decree() const override;
-
void update_app_envs(const std::map<std::string, std::string> &envs)
override;
void query_app_envs(/*out*/ std::map<std::string, std::string> &envs)
override;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]