Skip to content

Limit prepared ingestion SST protection to reserved files - #15490

Closed
joshkang97 wants to merge 1 commit into
meta:mainfrom
joshkang97:export-D127694250
Closed

joshkang97 wants to merge 1 commit into
meta:mainfrom
joshkang97:export-D127694250

Conversation

@joshkang97

@joshkang97 joshkang97 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary:
X-link: #15490

Summary

Prepared external ingestions held a pending_outputs_ watermark until commit or abort, preventing reclamation of unrelated SSTs created later and compacted away. Prepared ingestions now protect only their reserved SST numbers through pending_ingestion_outputs_ (first_file_number -> num_files), copied into full-purge sst_live snapshots. This preserves staged inputs and generated tombstones while allowing unrelated obsolete SSTs to be deleted.

Successful manifest completion releases reservations under the DB mutex after all Versions are installed, including grouped commits performed by another writer. Waiting for the ingestion caller to resume could otherwise let purge claim a compacted input and retain it through the stale reservation, leaving its grabbed marker behind. Failure and abort retain protection through cleanup. Public APIs and persisted formats are unchanged, existing background-output protection remains in place, and handles still retain other resources until consumed.

Example

Keep a prepared handle open for SST 100, containing key z. Meanwhile, normal DB writes update another key, a. The SST numbers are illustrative.

Prepare ingestion:
  SST 100: key z (staged, awaiting commit)

Unrelated DB activity:
  flush a=old --> SST 101 --+
                            +--> compaction --> SST 103 (live)
  flush a=new --> SST 102 --+
                  101 and 102 become obsolete

Files remaining after full purge, before commit/abort:
  SST   State      Before fix   After fix
  100   staged     kept         kept
  101   obsolete   kept         deleted
  102   obsolete   kept         deleted
  103   live       kept         kept

100 is not yet visible to reads or compaction. After compaction releases its input references, the old watermark still protects obsolete 101 and 102. The new reservation protects only staged 100; 103 remains because it is live.

Reviewed By: xingbowang

Differential Revision: D127694250

@meta-cla meta-cla Bot added the CLA Signed label Oct 27, 2026
@meta-codesync

meta-codesync Bot commented Oct 27, 2026

Copy link
Copy Markdown

@joshkang97 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D127694250.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✅ clang-tidy: No findings on changed lines

Completed in 345.6s.

joshkang97 added a commit to joshkang97/rocksdb that referenced this pull request Oct 27, 2026
Summary:
Pull Request resolved: meta#15490

## Summary

Prepared external ingestions held a `pending_outputs_` watermark until commit or abort, preventing reclamation of unrelated SSTs created later and compacted away. Prepared ingestions now protect only their reserved SST numbers through `pending_ingestion_outputs_` (`first_file_number` -> `num_files`), copied into full-purge `sst_live` snapshots. This preserves staged inputs and generated tombstones while allowing unrelated obsolete SSTs to be deleted.

Successful manifest completion releases reservations under the DB mutex after all Versions are installed, including grouped commits performed by another writer. Waiting for the ingestion caller to resume could otherwise let purge claim a compacted input and retain it through the stale reservation, leaving its grabbed marker behind. Failure and abort retain protection through cleanup. Public APIs and persisted formats are unchanged, existing background-output protection remains in place, and handles still retain other resources until consumed.

## Example

Keep a prepared handle open for SST `100`, containing key `z`. Meanwhile, normal DB writes update another key, `a`. The SST numbers are illustrative.

```text
Prepare ingestion:
  SST 100: key z (staged, awaiting commit)

Unrelated DB activity:
  flush a=old --> SST 101 --+
                            +--> compaction --> SST 103 (live)
  flush a=new --> SST 102 --+
                  101 and 102 become obsolete

Files remaining after full purge, before commit/abort:
  SST   State      Before fix   After fix
  100   staged     kept         kept
  101   obsolete   kept         deleted
  102   obsolete   kept         deleted
  103   live       kept         kept
```

`100` is not yet visible to reads or compaction. After compaction releases its input references, the old watermark still protects obsolete `101` and `102`. The new reservation protects only staged `100`; `103` remains because it is live.

Differential Revision: D127694250
@meta-codesync meta-codesync Bot changed the title Limit prepared ingestion SST protection to reserved files Limit prepared ingestion SST protection to reserved files (#15490) Oct 27, 2026
Summary:
X-link: meta#15490

## Summary

Prepared external ingestions held a `pending_outputs_` watermark until commit or abort, preventing reclamation of unrelated SSTs created later and compacted away. Prepared ingestions now protect only their reserved SST numbers through `pending_ingestion_outputs_` (`first_file_number` -> `num_files`), copied into full-purge `sst_live` snapshots. This preserves staged inputs and generated tombstones while allowing unrelated obsolete SSTs to be deleted.

Successful manifest completion releases reservations under the DB mutex after all Versions are installed, including grouped commits performed by another writer. Waiting for the ingestion caller to resume could otherwise let purge claim a compacted input and retain it through the stale reservation, leaving its grabbed marker behind. Failure and abort retain protection through cleanup. Public APIs and persisted formats are unchanged, existing background-output protection remains in place, and handles still retain other resources until consumed.

## Example

Keep a prepared handle open for SST `100`, containing key `z`. Meanwhile, normal DB writes update another key, `a`. The SST numbers are illustrative.

```text
Prepare ingestion:
  SST 100: key z (staged, awaiting commit)

Unrelated DB activity:
  flush a=old --> SST 101 --+
                            +--> compaction --> SST 103 (live)
  flush a=new --> SST 102 --+
                  101 and 102 become obsolete

Files remaining after full purge, before commit/abort:
  SST   State      Before fix   After fix
  100   staged     kept         kept
  101   obsolete   kept         deleted
  102   obsolete   kept         deleted
  103   live       kept         kept
```

`100` is not yet visible to reads or compaction. After compaction releases its input references, the old watermark still protects obsolete `101` and `102`. The new reservation protects only staged `100`; `103` remains because it is live.

Reviewed By: xingbowang

Differential Revision: D127694250
@meta-codesync meta-codesync Bot changed the title Limit prepared ingestion SST protection to reserved files (#15490) Limit prepared ingestion SST protection to reserved files Oct 30, 2026
@github-actions

Copy link
Copy Markdown

✅ Claude Code Review

Auto-triggered after CI passed — reviewing commit fd77489


Summary

Well-designed change that replaces an overly-broad watermark-based file protection mechanism with targeted tracking of specific ingestion file ranges. The correctness reasoning is sound: the manifest write callback fires under mutex after all Versions are installed, the non-full-scan path is inherently safe (ingestion files cannot enter obsolete_files_ before commit), and all cleanup paths correctly erase from the new map. The new tests cover the key scenarios including grouped commits and range tombstone protection.

No high-severity findings.

Full review (click to expand)

Findings

🔴 HIGH

None.

🟡 MEDIUM

M1. Capture-by-reference &hs in manifest_wcbs lambda needs lifetime reasoning documented — db_impl.cc
  • Issue: The manifest write callback captures hs (a local vector<FileIngestionHandleImpl*>) by reference. The callback fires inside ProcessManifestWrites::finish_batch (version_set.cc:5942), which runs under mutex after re-acquiring the lock (version_set.cc:6411). In grouped commits, another thread may execute the batch, but the ingestion thread blocks on first_writer.cv.Wait() until done, so hs remains alive. This is correct but non-obvious.
  • Root cause: Capturing local state by reference into a callback that may execute in a different thread's context requires careful lifetime reasoning.
  • Suggested fix: Add a brief comment near the lambda explaining why the capture is safe:
    // Safe to capture &hs by reference: the ManifestWriter lives on this
    // thread's stack and LogAndApply blocks (via cv.Wait) until finish_batch
    // has run the callback, even in grouped commits.
M2. manifest_wcbs vector sizing assumes num_jobs == cfds_to_commit.size() — db_impl.cc
  • Issue: manifest_wcbs is sized num_jobs while LogAndApply indexes it as manifest_wcbs[i] for i in 0..num_cfds-1 (version_set.cc:6682). These are equal because both cfds_to_commit and manifest_wcbs are sized from ingestion_jobs, but this implicit coupling could break if the loop building cfds_to_commit were ever changed to skip entries.
  • Root cause: The manifest callback vector size is implicitly coupled to the cfds_to_commit construction loop rather than being derived from the same source.
  • Suggested fix: Consider initializing manifest_wcbs after cfds_to_commit is built, sized to cfds_to_commit.size(). Or add an assertion assert(manifest_wcbs.size() == cfds_to_commit.size()).

🟢 LOW / NIT

L1. Include order cleanup is unrelated to the functional change — db_impl.cc
  • Issue: The diff reorders #include <cstdint> / <cinttypes> and moves #include "db/db_impl/db_impl_metadata.h" into alphabetical order. While correct, mixing formatting with functional changes makes the diff harder to review.
  • Suggested fix: Could be a separate commit, but this is a minor nit.
L2. GenerateAndPrepareExternalFile test helper could take IngestExternalFileOptions — external_sst_file_test.cc
  • Issue: The new helper always uses default IngestExternalFileOptions(), limiting its reuse for tests that need custom options (e.g., snapshot_consistency = false).
  • Suggested fix: Add an optional IngestExternalFileOptions parameter with a default value for flexibility.
L3. Release note is well-scoped — prepared_ingestion_sst_retention.md
  • Issue: None. The release note correctly categorizes this as a bug fix, is appropriately concise, and describes user-visible impact.

Cross-Component Analysis

Context Code executes? Assumptions hold? Action needed?
WritePreparedTxnDB Yes (ingestion goes through same path) Yes Safe
ReadOnly DB No (ingestion not supported) N/A Safe
CompactionService No (ingestion runs on primary) N/A Safe
User-defined timestamps Yes Yes (file numbering unaffected) Safe
Column family drop Yes (caught at commit time with error) Yes Safe
db_paths (multi-path) Yes (ingestion always path_id=0, full scan covers all paths) Yes Safe
FIFO / Universal compaction Yes Yes (file numbering unaffected) Safe

Non-full-scan path safety: Files enter obsolete_files_ only when Version::Unref drops a file's refcount to zero (version_set.cc:1045-1057). Ingestion files are not in any Version until commit, so they cannot appear in obsolete_files_. The non-full-scan path only processes files from GetObsoleteFiles, so no protection is needed there. Verified.

Grouped commit callback ordering: finish_batch processes ALL writers in the batch sequentially (version_set.cc:5930-5951), calling each writer's callback. The callback on the last writer erases all handles' entries. This fires after all Versions are installed (line 6454+) and under mutex (line 6411). Even when another thread is the batch leader, the ingestion thread blocks on cv.Wait() until finish_batch completes. Verified safe.

Assumption stress test:

  • Claim: "contiguous file number range." FetchAddFileNumber(n) is next_file_number_.fetch_add(n) (version_set.h:1565), atomic. Called under mutex. Returns start of contiguous range. Verified.
  • Claim: "no double-erase." On success: only manifest_wcb erases (old post-LogAndApply erase removed). On failure: only rollback erases (manifest_wcb checks s.ok()). UnorderedMap::erase with missing key is a no-op. Verified.
  • Claim: "crash recovery is safe." pending_ingestion_outputs_ is in-memory only. After crash, files exist on disk but are not in any Version. Next full-scan purge finds them not in sst_live (no in-memory map) and deletes them. Same as old behavior. Verified.

Positive Observations

  • The design correctly separates concerns: background jobs use the pending_outputs_ watermark (appropriate for monotonically increasing file numbers), while ingestion uses precise file-range tracking.
  • Using manifest write callbacks ensures the reservation is released atomically with Version installation, closing a subtle race window in grouped commits.
  • Test coverage is thorough: the grouped commit test (PreparedIngestionGroupedCommitDoesNotKeepObsoleteSsts) uses sync points to precisely control thread interleaving and verify the callback fires correctly even when another thread performs the manifest write.
  • The PreparedIngestionProtectsGeneratedTombstone test verifies that range tombstone files generated during atomic_replace_range are also protected, covering the NumFilesToPrepare accounting.

ℹ️ About this response

Generated by Claude Code.
Review methodology: claude_md/ci_review_prompt.md

Limitations:

  • Claude may miss context from files not in the diff
  • Large PRs may be truncated
  • Always apply human judgment to AI suggestions

Commands:

  • /claude-review [context] — Request a code review
  • /claude-query <question> — Ask about the PR or codebase

@meta-codesync meta-codesync Bot closed this in 800b574 Oct 30, 2026
@meta-codesync meta-codesync Bot added the Merged label Oct 30, 2026
@meta-codesync

meta-codesync Bot commented Oct 30, 2026

Copy link
Copy Markdown

This pull request has been merged in 800b574.

pdillinger added a commit to pdillinger/rocksdb that referenced this pull request Nov 18, 2026
Summary:
## Background

RocksDB deletes an SST file once it is obsolete, meaning no Version references it anymore, usually because a compaction replaced it. Files that a running flush or compaction is still writing are also in no Version, but they must not be deleted. To protect them, each flush or compaction records the next file number in `pending_outputs_` when it starts. The obsolete-file purge then skips every SST numbered at or above the smallest recorded number (`min_pending_output`, exposed as `rocksdb.min-obsolete-sst-number-to-keep`). The purge applies this cutoff to every SST: both files found by scanning the DB directories and files that `VersionSet` already knows are obsolete (`obsolete_files_`, filled when the last Version referencing a file is destroyed).

`53af5d877` ("Redesign pending_outputs_", 2014) introduced the cutoff, replacing tracking of each job's exact output file numbers. At first the cutoff was applied only in `PurgeObsoleteFiles()`. That leaked files: a file taken from `obsolete_files_` and then held back was neither deleted nor tracked until the next full directory scan. `863009b5a` ("Fix deleting obsolete files meta#2", 2015) fixed the leak by also applying the cutoff in `VersionSet::GetObsoleteFiles()`, so such files stay in `obsolete_files_` until the cutoff moves past them. A `FIXME` left in `PurgeObsoleteFiles()` asks whether these files should be held back at all. More recently, [meta#15490](meta#15490) stopped prepared external ingestions from holding a `pending_outputs_` entry. They now protect only their reserved file numbers, so a long-lived prepared ingestion no longer holds back unrelated obsolete SSTs.

## The problem

While a long-running job is in progress, obsolete SSTs pile up on disk. Every SST created after the job started and since compacted away is kept until the job finishes, even though none of them can be an unfinished output: each was part of an installed Version, so holding it back protects nothing. Usually the wait is short, but a remote compaction can wait in `CompactionService::Wait()` for hours or days. Under a steady write load, obsolete SSTs can then grow to many times the size of the live data and fill the disk; `rocksdb.obsolete-sst-files-size` shows the growth.

## Previous behavior

- `GetObsoleteFiles()` handed off only obsolete SSTs numbered below `min_pending_output`; the rest stayed in `obsolete_files_`.
- `PurgeObsoleteFiles()` kept every SST candidate numbered at or above `min_pending_output`, from either source.

## New behavior

The purge deletes an SST that `VersionSet` reports as obsolete, whatever jobs are still running, apart from a brief exception when event listeners are configured (below). `GetObsoleteFiles()` hands off all obsolete SSTs, and `PurgeObsoleteFiles()` applies the cutoff only to SST candidates that came from the directory scan. Both parts are needed: changing only `GetObsoleteFiles()` would bring back the 2015 leak.

Unchanged:
- Unfinished outputs are found only by the directory scan, so the cutoff still protects them.
- Inputs of a running compaction stay protected: the compaction holds a reference on its input Version, so they never reach `obsolete_files_`.
- Live files, including trivially moved ones, are still excluded by the live-file set and `only_delete_metadata`.
- Files quarantined after a failed MANIFEST write are still checked before anything else.
- Obsolete blob files still honor the cutoff. `VersionBuilder` can report a blob file obsolete without it having been part of an installed Version, so the argument above does not cover them.

## Keeping event listener outputs available

The cutoff also had a side effect that listeners can observe. A job removes its `pending_outputs_` entry only after its `OnFlushCompleted()` or `OnCompactionCompleted()` callbacks return, so RocksDB did not delete the files those callbacks report while the callbacks ran, even if another compaction made them obsolete in the meantime. `EventListener` did not document this, but a listener that opens, copies, or links a reported file might depend on it. Without the cutoff for known-obsolete files, such a listener could find the file already deleted.

To keep that behavior, this change keeps a narrower form of the cutoff for known-obsolete SSTs, in `DBImpl::listener_pending_outputs_`. While a job might still report its outputs to listeners, its `pending_outputs_` number is also registered there, and `GetObsoleteFiles()` leaves obsolete SSTs at or above the smallest registered number in `obsolete_files_` for a later purge. A compaction registers just before installing its outputs and unregisters after `OnCompactionCompleted()` returns, so a remote compaction holds nothing back while it waits. A flush registers for its whole duration, which also covers a flush that installs its outputs over several MANIFEST writes. Nothing is registered when no listeners are configured.

This change also documents the behavior in `listener.h`, as best effort rather than a guarantee: RocksDB actively avoids deleting a file before a callback that reports it returns. The documented exceptions predate this change: the inputs that `OnCompactionCompleted()` reports (including trivially moved files), and files reported to `OnExternalFileIngested()`, whose protection ends when the ingestion is committed, before the callback runs.

Registering a lower bound on file numbers, as `pending_outputs_` does, rather than the exact output file numbers is a deliberate compromise, because more precision has diminishing returns. With listeners configured, RocksDB therefore still keeps unrelated obsolete SSTs created after a job started while a flush runs or while a compaction's completion callbacks run. That retention lasts as long as a local flush or the callbacks, not as long as a compaction waits. Alternatives considered:
- Track the exact output file numbers. This alternative keeps only the reported files, but the numbers would have to be passed out of `MemTableList::TryInstallMemtableFlushResults()` and `CompactionJob::Install()` at each install site, roughly 2.5 to 3 times the code, only to delete some files a little sooner.
- Hold a reference on the current Version while listeners run. This alternative is simpler, but the reference is taken after the outputs are installed, so it misses a flush that installs its outputs over several MANIFEST writes if a compaction deletes an earlier output in between.
- Keep newly installed outputs from being picked by compactions until listeners have been notified. A slow listener would then block compaction of new L0 files.

## Consequences

- `rocksdb.min-obsolete-sst-number-to-keep` returns the same value as before, but now bounds only unrecognized files found by a directory scan, not known-obsolete SSTs (apart from the brief retention with listeners described above). Its documentation is updated. An application that read the property to decide which obsolete SSTs it could still copy or link out of band would be affected. Like meta#15490, this change adds no option to restore the previous behavior.
- Secondary instances, including remote compaction workers opened by `DB::OpenAndCompact()`, may find obsolete SSTs deleted sooner than before. They already handle this for files below the cutoff: they read the MANIFEST through `ManifestTailer`, which builds the most recent Version that has no missing files.

Bonus: `CLAUDE.md` gets guidance on keeping crash test checks for one feature cheap, so that they do not take time and operations away from finding other failures. The guidance comes from designing the `db_stress` check described in the test plan.

Reviewed By: jaykorean

Differential Revision: D130987455
meta-codesync Bot pushed a commit that referenced this pull request Nov 18, 2026
Summary:
Pull Request resolved: #15710

## Background

RocksDB deletes an SST file once it is obsolete, meaning no Version references it anymore, usually because a compaction replaced it. Files that a running flush or compaction is still writing are also in no Version, but they must not be deleted. To protect them, each flush or compaction records the next file number in `pending_outputs_` when it starts. The obsolete-file purge then skips every SST numbered at or above the smallest recorded number (`min_pending_output`, exposed as `rocksdb.min-obsolete-sst-number-to-keep`). The purge applies this cutoff to every SST: both files found by scanning the DB directories and files that `VersionSet` already knows are obsolete (`obsolete_files_`, filled when the last Version referencing a file is destroyed).

`53af5d877` ("Redesign pending_outputs_", 2014) introduced the cutoff, replacing tracking of each job's exact output file numbers. At first the cutoff was applied only in `PurgeObsoleteFiles()`. That leaked files: a file taken from `obsolete_files_` and then held back was neither deleted nor tracked until the next full directory scan. `863009b5a` ("Fix deleting obsolete files #2", 2015) fixed the leak by also applying the cutoff in `VersionSet::GetObsoleteFiles()`, so such files stay in `obsolete_files_` until the cutoff moves past them. A `FIXME` left in `PurgeObsoleteFiles()` asks whether these files should be held back at all. More recently, [#15490](#15490) stopped prepared external ingestions from holding a `pending_outputs_` entry. They now protect only their reserved file numbers, so a long-lived prepared ingestion no longer holds back unrelated obsolete SSTs.

## The problem

While a long-running job is in progress, obsolete SSTs pile up on disk. Every SST created after the job started and since compacted away is kept until the job finishes, even though none of them can be an unfinished output: each was part of an installed Version, so holding it back protects nothing. Usually the wait is short, but a remote compaction can wait in `CompactionService::Wait()` for hours or days. Under a steady write load, obsolete SSTs can then grow to many times the size of the live data and fill the disk; `rocksdb.obsolete-sst-files-size` shows the growth.

## Previous behavior

- `GetObsoleteFiles()` handed off only obsolete SSTs numbered below `min_pending_output`; the rest stayed in `obsolete_files_`.
- `PurgeObsoleteFiles()` kept every SST candidate numbered at or above `min_pending_output`, from either source.

## New behavior

The purge deletes an SST that `VersionSet` reports as obsolete, whatever jobs are still running, apart from a brief exception when event listeners are configured (below). `GetObsoleteFiles()` hands off all obsolete SSTs, and `PurgeObsoleteFiles()` applies the cutoff only to SST candidates that came from the directory scan. Both parts are needed: changing only `GetObsoleteFiles()` would bring back the 2015 leak.

Unchanged:
- Unfinished outputs are found only by the directory scan, so the cutoff still protects them.
- Inputs of a running compaction stay protected: the compaction holds a reference on its input Version, so they never reach `obsolete_files_`.
- Live files, including trivially moved ones, are still excluded by the live-file set and `only_delete_metadata`.
- Files quarantined after a failed MANIFEST write are still checked before anything else.
- Obsolete blob files still honor the cutoff. `VersionBuilder` can report a blob file obsolete without it having been part of an installed Version, so the argument above does not cover them.

## Keeping event listener outputs available

The cutoff also had a side effect that listeners can observe. A job removes its `pending_outputs_` entry only after its `OnFlushCompleted()` or `OnCompactionCompleted()` callbacks return, so RocksDB did not delete the files those callbacks report while the callbacks ran, even if another compaction made them obsolete in the meantime. `EventListener` did not document this, but a listener that opens, copies, or links a reported file might depend on it. Without the cutoff for known-obsolete files, such a listener could find the file already deleted.

To keep that behavior, this change keeps a narrower form of the cutoff for known-obsolete SSTs, in `DBImpl::listener_pending_outputs_`. While a job might still report its outputs to listeners, its `pending_outputs_` number is also registered there, and `GetObsoleteFiles()` leaves obsolete SSTs at or above the smallest registered number in `obsolete_files_` for a later purge. A compaction registers just before installing its outputs and unregisters after `OnCompactionCompleted()` returns, so a remote compaction holds nothing back while it waits. A flush registers for its whole duration, which also covers a flush that installs its outputs over several MANIFEST writes. Nothing is registered when no listeners are configured.

This change also documents the behavior in `listener.h`, as best effort rather than a guarantee: RocksDB actively avoids deleting a file before a callback that reports it returns. The documented exceptions predate this change: the inputs that `OnCompactionCompleted()` reports (including trivially moved files), and files reported to `OnExternalFileIngested()`, whose protection ends when the ingestion is committed, before the callback runs.

Registering a lower bound on file numbers, as `pending_outputs_` does, rather than the exact output file numbers is a deliberate compromise, because more precision has diminishing returns. With listeners configured, RocksDB therefore still keeps unrelated obsolete SSTs created after a job started while a flush runs or while a compaction's completion callbacks run. That retention lasts as long as a local flush or the callbacks, not as long as a compaction waits. Alternatives considered:
- Track the exact output file numbers. This alternative keeps only the reported files, but the numbers would have to be passed out of `MemTableList::TryInstallMemtableFlushResults()` and `CompactionJob::Install()` at each install site, roughly 2.5 to 3 times the code, only to delete some files a little sooner.
- Hold a reference on the current Version while listeners run. This alternative is simpler, but the reference is taken after the outputs are installed, so it misses a flush that installs its outputs over several MANIFEST writes if a compaction deletes an earlier output in between.
- Keep newly installed outputs from being picked by compactions until listeners have been notified. A slow listener would then block compaction of new L0 files.

## Consequences

- `rocksdb.min-obsolete-sst-number-to-keep` returns the same value as before, but now bounds only unrecognized files found by a directory scan, not known-obsolete SSTs (apart from the brief retention with listeners described above). Its documentation is updated. An application that read the property to decide which obsolete SSTs it could still copy or link out of band would be affected. Like #15490, this change adds no option to restore the previous behavior.
- Secondary instances, including remote compaction workers opened by `DB::OpenAndCompact()`, may find obsolete SSTs deleted sooner than before. They already handle this for files below the cutoff: they read the MANIFEST through `ManifestTailer`, which builds the most recent Version that has no missing files.

Bonus: `CLAUDE.md` gets guidance on keeping crash test checks for one feature cheap, so that they do not take time and operations away from finding other failures. The guidance comes from designing the `db_stress` check described in the test plan.

Reviewed By: jaykorean

Differential Revision: D130987455

fbshipit-source-id: 1ec9c7127bec6017a6742b98bb53dba45139e87d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant