summaryrefslogtreecommitdiff
path: root/db/db_impl/db_impl.h
diff options
context:
space:
mode:
authorYu Zhang <yuzhangyu@fb.com>2024-09-10 13:23:13 -0700
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2024-09-10 13:23:13 -0700
commit43bc71fef678eb5480d6ee010cc8875bd5618be1 (patch)
treed29d3f7a49f13828c3e366783a5be4f3f7de6edd /db/db_impl/db_impl.h
parent55ac0b729e5266a47d91e8ba9cd7ac9e5feea35b (diff)
Add an internal API MemTableList::GetEditForDroppingCurrentVersion (#13001)
Summary: Prepare this internal API to be used by atomic data replacement. The main purpose of this API is to get a `VersionEdit` to mark the entire current `MemTableListVersion` as dropped. Flush needs the similar functionality when installing results, so that logic is refactored into a util function `GetDBRecoveryEditForObsoletingMemTables` to be shared by flush and this internal API. To test this internal API, flush's result installation is redirected to use this API when it is flushing all the immutable MemTables in debug mode. It should achieve the exact same results, just with a duplicated `VersionEdit::log_number` field that doesn't upsets the recovery logic. Pull Request resolved: https://github.com/facebook/rocksdb/pull/13001 Test Plan: Existing tests Reviewed By: pdillinger Differential Revision: D62309591 Pulled By: jowlyzhang fbshipit-source-id: e25914d9a2e281c25ab7ee31a66eaf6adfae4b88
Diffstat (limited to 'db/db_impl/db_impl.h')
-rw-r--r--db/db_impl/db_impl.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/db/db_impl/db_impl.h b/db/db_impl/db_impl.h
index 7206d85e1..1b3bafaae 100644
--- a/db/db_impl/db_impl.h
+++ b/db/db_impl/db_impl.h
@@ -2963,6 +2963,14 @@ DBOptions SanitizeOptions(const std::string& db, const DBOptions& src,
CompressionType GetCompressionFlush(const ImmutableCFOptions& ioptions,
const MutableCFOptions& mutable_cf_options);
+// Return a VersionEdit for the DB's recovery when the `memtables` of the
+// specified column family are obsolete. Specifically, the min log number to
+// keep, and the WAL files that can be deleted.
+VersionEdit GetDBRecoveryEditForObsoletingMemTables(
+ VersionSet* vset, const ColumnFamilyData& cfd,
+ const autovector<VersionEdit*>& edit_list,
+ const autovector<MemTable*>& memtables, LogsWithPrepTracker* prep_tracker);
+
// Return the earliest log file to keep after the memtable flush is
// finalized.
// `cfd_to_flush` is the column family whose memtable (specified in