From 52453135d03bf18dab89595e41c414fbacc8b3f5 Mon Sep 17 00:00:00 2001 From: "wangyi.ywq" Date: Thu, 30 Jun 2022 20:22:07 +0800 Subject: [PATCH] fix manifest too large --- db/version_builder.cc | 2 +- db/version_edit.h | 2 +- include/rocksdb/options.h | 2 +- utilities/checkpoint/checkpoint_impl.cc | 14 +++++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/db/version_builder.cc b/db/version_builder.cc index f47d277602..b03ee2d655 100644 --- a/db/version_builder.cc +++ b/db/version_builder.cc @@ -879,7 +879,7 @@ bool VersionBuilder::CheckConsistencyForNumLevels() { void VersionBuilder::Apply(VersionEdit* edit) { // not change the current state - if(edit->check_point()) return; +// if(edit->check_point()) return; rep_->Apply(edit); } diff --git a/db/version_edit.h b/db/version_edit.h index f47c995d5b..305ea7cb0d 100644 --- a/db/version_edit.h +++ b/db/version_edit.h @@ -411,7 +411,7 @@ class VersionEdit { std::string DebugString(bool hex_key = false) const; std::string DebugJSON(int edit_num, bool hex_key = false) const; - bool check_point() { return for_checkpoint_; } + bool check_point() const { return for_checkpoint_; } void set_check_point(bool b) { for_checkpoint_ = b; } private: diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index 07ab6d0e74..0b48a058fe 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -993,7 +993,7 @@ struct DBOptions { // transaction is encountered in the WAL bool allow_2pc = false; - bool check_point_fake_flush = true; + bool check_point_fake_flush = false; // A global cache for table-level rows. // Default: nullptr (disabled) diff --git a/utilities/checkpoint/checkpoint_impl.cc b/utilities/checkpoint/checkpoint_impl.cc index f385df8870..bf65668eb6 100644 --- a/utilities/checkpoint/checkpoint_impl.cc +++ b/utilities/checkpoint/checkpoint_impl.cc @@ -205,12 +205,16 @@ Status CheckpointImpl::CreateCustomCheckpoint( } // this will return live_files prefixed with "/" - if(db_options.check_point_fake_flush){ + if (db_options.check_point_fake_flush) { s = db_->FakeFlush(fake_flush_files); - s = db_->GetLiveFiles(live_files, &manifest_file_size, false); - live_files.insert(live_files.end(), fake_flush_files.begin(), - fake_flush_files.end()); - }else{ + if (s.ok()) { + s = db_->GetLiveFiles(live_files, &manifest_file_size, false); + } + if (s.ok()) { + live_files.insert(live_files.end(), fake_flush_files.begin(), + fake_flush_files.end()); + } + } else { s = db_->GetLiveFiles(live_files, &manifest_file_size, flush_memtable); }