Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
fix(split): add flush_memtable for copy_checkpoint_to_dir (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
hycdong authored Feb 1, 2021
1 parent ae16305 commit 7404376
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/dsn/dist/replication/replication_app_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ class replication_app_base : public replica_base
// must be thread safe
//
virtual ::dsn::error_code copy_checkpoint_to_dir(const char *checkpoint_dir,
/*output*/ int64_t *last_decree) = 0;
/*output*/ int64_t *last_decree,
bool flush_memtable = false) = 0;

//
// Query methods.
Expand Down
6 changes: 3 additions & 3 deletions src/replica/split/replica_split_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void replica_split_manager::parent_prepare_states(const std::string &dir) // on
learn_state parent_states;
int64_t checkpoint_decree;
// generate checkpoint
error_code ec = _replica->_app->copy_checkpoint_to_dir(dir.c_str(), &checkpoint_decree);
error_code ec = _replica->_app->copy_checkpoint_to_dir(dir.c_str(), &checkpoint_decree, true);
if (ec == ERR_OK) {
ddebug_replica("prepare checkpoint succeed: checkpoint dir = {}, checkpoint decree = {}",
dir,
Expand Down Expand Up @@ -207,8 +207,8 @@ void replica_split_manager::parent_prepare_states(const std::string &dir) // on
plist->truncate(last_committed_decree());

dcheck_eq(last_committed_decree(), checkpoint_decree);
dcheck_gt(mutation_list.size(), 0);
dcheck_gt(files.size(), 0);
dcheck_ge(mutation_list.size(), 0);
dcheck_ge(files.size(), 0);
ddebug_replica("prepare state succeed: {} mutations, {} private log files, total file size = "
"{}, last_committed_decree = {}",
mutation_list.size(),
Expand Down
3 changes: 2 additions & 1 deletion src/replica/storage/simple_kv/simple_kv.server.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ class simple_kv_service_impl : public simple_kv_service
virtual ::dsn::error_code async_checkpoint(bool flush_memtable) override;

virtual ::dsn::error_code copy_checkpoint_to_dir(const char *checkpoint_dir,
int64_t *last_decree) override
int64_t *last_decree,
bool flush_memtable = false) override
{
return ERR_NOT_IMPLEMENTED;
}
Expand Down
3 changes: 2 additions & 1 deletion src/replica/storage/simple_kv/test/simple_kv.server.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class simple_kv_service_impl : public application::simple_kv_service
virtual ::dsn::error_code async_checkpoint(bool flush_memtable) override;

virtual ::dsn::error_code copy_checkpoint_to_dir(const char *checkpoint_dir,
int64_t *last_decree) override
int64_t *last_decree,
bool flush_memtable = false) override
{
return ERR_NOT_IMPLEMENTED;
}
Expand Down
3 changes: 2 additions & 1 deletion src/replica/test/mock_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class mock_replication_app_base : public replication_app_base
return ERR_OK;
}
error_code copy_checkpoint_to_dir(const char *checkpoint_dir,
/*output*/ int64_t *last_decree) override
/*output*/ int64_t *last_decree,
bool flush_memtable = false) override
{
if (last_decree != nullptr) {
*last_decree = _decree;
Expand Down

0 comments on commit 7404376

Please sign in to comment.