From 1841523ec9912f82bd104380d9cc3b6f05cc7425 Mon Sep 17 00:00:00 2001 From: liuhu Date: Wed, 3 Apr 2024 14:59:00 +0800 Subject: [PATCH] Add dump all keys for cache dumper impl --- unreleased_history/behavior_changes/dump_all_keys.md | 1 + utilities/cache_dump_load_impl.cc | 3 ++- utilities/cache_dump_load_impl.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 unreleased_history/behavior_changes/dump_all_keys.md diff --git a/unreleased_history/behavior_changes/dump_all_keys.md b/unreleased_history/behavior_changes/dump_all_keys.md new file mode 100644 index 000000000000..913cc044235b --- /dev/null +++ b/unreleased_history/behavior_changes/dump_all_keys.md @@ -0,0 +1 @@ +Dump all keys for cache dumper impl if `SetDumpFilter()` is not called diff --git a/utilities/cache_dump_load_impl.cc b/utilities/cache_dump_load_impl.cc index 52f2a4df7d97..99b12d3191e6 100644 --- a/utilities/cache_dump_load_impl.cc +++ b/utilities/cache_dump_load_impl.cc @@ -24,6 +24,7 @@ namespace ROCKSDB_NAMESPACE { // requirement. Status CacheDumperImpl::SetDumpFilter(std::vector db_list) { Status s = Status::OK(); + dump_all_keys_ = false; for (size_t i = 0; i < db_list.size(); i++) { assert(i < db_list.size()); TablePropertiesCollection ptc; @@ -140,7 +141,7 @@ CacheDumperImpl::DumpOneBlockCallBack(std::string& buf) { } // based on the key prefix, check if the block should be filter out. - if (ShouldFilterOut(key)) { + if (!dump_all_keys_ && ShouldFilterOut(key)) { return; } diff --git a/utilities/cache_dump_load_impl.h b/utilities/cache_dump_load_impl.h index 4ec42ef633f9..a2c71406b235 100644 --- a/utilities/cache_dump_load_impl.h +++ b/utilities/cache_dump_load_impl.h @@ -121,6 +121,8 @@ class CacheDumperImpl : public CacheDumper { // improvement can be applied like BloomFilter or others to speedup the // filtering. std::set prefix_filter_; + // dump all keys of cache if user doesn't call SetDumpFilter + bool dump_all_keys_ = true; }; // The default implementation of CacheDumpedLoader