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 a096e56 fix(split): add flush_memtable for copy_checkpoint_to_dir
(#684)
a096e56 is described below
commit a096e56db535848c7fb059eaca0de47aa698dc03
Author: HeYuchen <[email protected]>
AuthorDate: Mon Feb 1 12:58:19 2021 +0800
fix(split): add flush_memtable for copy_checkpoint_to_dir (#684)
---
rdsn | 2 +-
src/server/pegasus_server_impl.cpp | 11 +++++++----
src/server/pegasus_server_impl.h | 6 ++++--
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/rdsn b/rdsn
index ab9520d..7404376 160000
--- a/rdsn
+++ b/rdsn
@@ -1 +1 @@
-Subproject commit ab9520df9bb47be2eb7d5720098ff463cd83ec36
+Subproject commit 7404376b45cde468df2435cab3f6913fe7e2dd40
diff --git a/src/server/pegasus_server_impl.cpp
b/src/server/pegasus_server_impl.cpp
index fb7b600..38b15d7 100644
--- a/src/server/pegasus_server_impl.cpp
+++ b/src/server/pegasus_server_impl.cpp
@@ -1802,19 +1802,21 @@ private:
// Must be thread safe.
::dsn::error_code pegasus_server_impl::copy_checkpoint_to_dir(const char
*checkpoint_dir,
- /*output*/
int64_t *last_decree)
+ /*output*/
int64_t *last_decree,
+ bool
flush_memtable)
{
CheckpointingTokenHelper token_helper(_is_checkpointing);
if (!token_helper.token_got()) {
return ::dsn::ERR_WRONG_TIMING;
}
- return copy_checkpoint_to_dir_unsafe(checkpoint_dir, last_decree);
+ return copy_checkpoint_to_dir_unsafe(checkpoint_dir, last_decree,
flush_memtable);
}
// not thread safe, should be protected by caller
::dsn::error_code pegasus_server_impl::copy_checkpoint_to_dir_unsafe(const
char *checkpoint_dir,
- int64_t
*checkpoint_decree)
+ int64_t
*checkpoint_decree,
+ bool
flush_memtable)
{
rocksdb::Checkpoint *chkpt_raw = nullptr;
auto status = rocksdb::Checkpoint::Create(_db, &chkpt_raw);
@@ -1834,7 +1836,8 @@ private:
}
// CreateCheckpoint() will not flush memtable when log_size_for_flush = max
- status = chkpt->CreateCheckpoint(checkpoint_dir,
std::numeric_limits<uint64_t>::max());
+ status = chkpt->CreateCheckpoint(checkpoint_dir,
+ flush_memtable ? 0 :
std::numeric_limits<uint64_t>::max());
if (!status.ok()) {
derror_replica("CreateCheckpoint failed, error = {}",
status.ToString());
if (!::dsn::utils::filesystem::remove_path(checkpoint_dir)) {
diff --git a/src/server/pegasus_server_impl.h b/src/server/pegasus_server_impl.h
index 1703dd7..5785624 100644
--- a/src/server/pegasus_server_impl.h
+++ b/src/server/pegasus_server_impl.h
@@ -124,13 +124,15 @@ public:
// must be thread safe
// this method will not trigger flush(), just copy even if the app is
empty.
::dsn::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;
//
// help function, just copy checkpoint to specified dir and ignore
_is_checkpointing.
// if checkpoint_dir already exist, this function will delete it first.
::dsn::error_code copy_checkpoint_to_dir_unsafe(const char *checkpoint_dir,
- /**output*/ int64_t
*checkpoint_decree);
+ /**output*/ int64_t
*checkpoint_decree,
+ bool flush_memtable =
false);
// get the last checkpoint
// if succeed:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]