rocksdb/db/db_impl
Andrew Chang 89e384ca6f Support GetLiveFiles on secondary DB instances (#14475)
Summary:
Pull Request resolved: https://github.com/facebook/rocksdb/pull/14475

GetLiveFiles was previously blocked on secondary instances with
Status::NotSupported, even though the operation is safe to perform.

The only reason GetLiveFiles was originally blocked is that it defaults
to flushing the memtable (flush_memtable=true), which is a write
operation. However, the actual implementation in DBImpl::GetLiveFiles
(db_filesnapshot.cc) does two things:

1. Optionally flush the memtable — which we skip by passing
   flush_memtable=false. The secondary already overrides
   FlushForGetLiveFiles() as a no-op, so even if true were passed
   it would not actually flush.

2. Read live file state from versions_ under the mutex — this is
   purely read-only. It iterates the ColumnFamilySet to collect live
   table and blob file numbers, builds relative file paths for SST
   files, blob files, CURRENT, MANIFEST, and OPTIONS, and reads the
   manifest file size.

The secondary maintains its own VersionSet which it keeps up to date
via MANIFEST replay in TryCatchUpWithPrimary(). So all of this state
is valid and accurate — it reflects exactly which files the secondary
considers live at its current replay point.

This is the same approach used by DBImplReadOnly and CompactedDBImpl,
which both delegate to DBImpl::GetLiveFiles with flush_memtable=false.

Reviewed By: xingbowang

Differential Revision: D97563143

fbshipit-source-id: 8d5b52e26a478ef190eba598819de6527817bcfc
2026-03-23 12:09:10 -07:00
..
compacted_db_impl.cc Add option to validate sst files in the background on DB open (#14322) 2026-03-02 16:18:14 -08:00
compacted_db_impl.h Add option to validate sst files in the background on DB open (#14322) 2026-03-02 16:18:14 -08:00
db_impl.cc Add OnBackgroundJobPressureChanged listener callback (#14474) 2026-03-20 15:02:53 -07:00
db_impl.h Add OnBackgroundJobPressureChanged listener callback (#14474) 2026-03-20 15:02:53 -07:00
db_impl_compaction_flush.cc Add OnBackgroundJobPressureChanged listener callback (#14474) 2026-03-20 15:02:53 -07:00
db_impl_debug.cc Add OnBackgroundJobPressureChanged listener callback (#14474) 2026-03-20 15:02:53 -07:00
db_impl_experimental.cc Fix an infinite compaction loop bug with udt (#14228) 2026-01-20 14:10:41 -08:00
db_impl_files.cc Add option to validate sst files in the background on DB open (#14322) 2026-03-02 16:18:14 -08:00
db_impl_follower.cc Add option to validate sst files in the background on DB open (#14322) 2026-03-02 16:18:14 -08:00
db_impl_follower.h Implement obsolete file deletion (GC) in follower (#12657) 2024-05-17 19:13:33 -07:00
db_impl_open.cc Skip flush during recovery if read_only (#14440) 2026-03-09 15:17:31 -07:00
db_impl_readonly.cc Add option to validate sst files in the background on DB open (#14322) 2026-03-02 16:18:14 -08:00
db_impl_readonly.h Fix crash in GetLiveFilesStorageInfo on read-only DB (#14306) 2026-02-05 15:22:52 -08:00
db_impl_secondary.cc Skip Wal Recovery on SecondaryDB Open if for Remote Compaction (#14462) 2026-03-19 15:48:16 -07:00
db_impl_secondary.h Support GetLiveFiles on secondary DB instances (#14475) 2026-03-23 12:09:10 -07:00
db_impl_write.cc Support concurrent write for vector memtable (#13675) 2025-06-18 17:32:59 -07:00