Skip to content

Commit

Permalink
[SKV-636] refactor: remove useless function 'last_flushed_decree()' (a…
Browse files Browse the repository at this point in the history
…pache#1456)

对应社区commit: https://github.com/apache/incubator-pegasus/pull/1456/files

apache#1383

This is a refactor patch before fixing apache#1383. This patch has no functionality
changes, but just including refactors:
1. Moves functions `load()`, `newr()` and `clear_on_failure()` from class replica
to class replica_stub, and the first two have been renamed to `load_replica()`
and `new_replica()`.
2. Encapsulates a new function `move_to_err_path`.
3. Some minor refactors like fix typo.
  • Loading branch information
acelyc111 authored and 王聃 committed May 5, 2023
1 parent 44cc352 commit fdc125c
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ class replication_app_base : public replica_base
// 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;

Expand Down
2 changes: 0 additions & 2 deletions src/rdsn/src/replica/replica.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,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;
Expand Down
1 change: 0 additions & 1 deletion src/rdsn/src/replica/replica.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ class replica : public serverlet<replica>, public ref_counter, public replica_ba
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(); }
Expand Down
7 changes: 1 addition & 6 deletions src/server/pegasus_server_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2597,11 +2597,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)
{
Expand Down Expand Up @@ -3174,7 +3169,7 @@ bool pegasus_server_impl::release_storage_after_manual_compact()
gc_checkpoints(true);
ddebug_replica("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) {
ddebug_replica("release storage succeed, last_durable_decree changed from {} to {}",
old_last_durable,
Expand Down
2 changes: 0 additions & 2 deletions src/server/pegasus_server_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ class pegasus_server_impl : public pegasus_read_service

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;
Expand Down

0 comments on commit fdc125c

Please sign in to comment.