summaryrefslogtreecommitdiff
path: root/db/db_impl/db_impl.h
diff options
context:
space:
mode:
authorPeter Dillinger <peterd@meta.com>2024-07-01 23:29:02 -0700
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2024-07-01 23:29:02 -0700
commit0bb939611dd80a2a4cb07d4fb526cc39304d9a1d (patch)
treed95a6cc8a4e668acf706da33304d52e690ceceb7 /db/db_impl/db_impl.h
parent84296bc2489ab24e023fe3d9bc93160f6b91fe29 (diff)
Avoid unnecessary work in internal calls to GetSortedWalFiles (#12831)
Summary: We are seeing a number of crash test failures coming from checkpoint and backup code, likely from WalManager::GetSortedWalFiles -> ... -> WalManager::ReadFirstLine and this code path is not needed, because we don't need to know the sequence numbers of WAL files going into a checkpoint or backup. We can minimize the impact of whatever inconsistency is causing that problem by not relying on it where it's not needed. Similarly, when we only need a roughly accurate set of current WAL files, we don't need to query all the archived WAL files (and redundantly the live ones again). So this reduces filesystem queries and DB mutex acquires in creating backups and checkpoints. Needed follow-up: Figure out what is causing various failures with an apparent inconsistency where GetSortedWalFiles fails on reading a WAL file. If it's an injected failure, perhaps it's not propagating that injected failure appropriately. It might also be an inconsistency between what the DB knows is flushed and what WalManager reads from the filesystem (which we know is dubious and should be phased out, which this is arguably another step toward). Or completing that phase-out might solve the problem without a full diagnosis. Pull Request resolved: https://github.com/facebook/rocksdb/pull/12831 Test Plan: existing tests (easily caught when I went too far in initally developing this change) Update to BackupUsingDirectIO test so that there's a WAL file in what is backed up. (Was relying on some oddity.) Reviewed By: cbi42 Differential Revision: D59252649 Pulled By: pdillinger fbshipit-source-id: 7ad4187a1c70caa59a6d6c1c643ef95232b929f5
Diffstat (limited to 'db/db_impl/db_impl.h')
-rw-r--r--db/db_impl/db_impl.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/db/db_impl/db_impl.h b/db/db_impl/db_impl.h
index 7ecf53b40..319cad99e 100644
--- a/db/db_impl/db_impl.h
+++ b/db/db_impl/db_impl.h
@@ -508,6 +508,8 @@ class DBImpl : public DB {
Status GetLiveFiles(std::vector<std::string>&, uint64_t* manifest_file_size,
bool flush_memtable = true) override;
Status GetSortedWalFiles(VectorWalPtr& files) override;
+ Status GetSortedWalFilesImpl(VectorWalPtr& files, bool need_seqnos);
+
// Get the known flushed sizes of WALs that might still be written to
// or have pending sync.
// NOTE: unlike alive_log_files_, this function includes WALs that might