Skip to content

Conversation

@jbowens
Copy link
Collaborator

@jbowens jbowens commented Oct 17, 2025

25.4 backport of #5431.


During Open, scan the directory listing for obsolete files before scheduling a memtable flush or compaction. Previously, contrary to its documentation, DB.scanObsoleteFiles could run in parallel to compactions. Subtly, scanObsoleteFiles would block, waiting for compactions to queisce before proceeding. This ensured that once it proceeded it had a consistent view of the set of live files. This structure was subtle, less-deterministic and blocked Open from proceeding until compactions quiesced.

This commit moves the scanning of the directory listing before the scheduling of flushes or compactions, and adds an assertion that no flushes or compactions are running during scanObsoleteFiles.

Fix #5420.

During Open, scan the directory listing for obsolete files before scheduling a
memtable flush or compaction. Previously, contrary to its documentation,
DB.scanObsoleteFiles could run in parallel to compactions. Subtly,
scanObsoleteFiles would block, waiting for compactions to queisce before
proceeding. This ensured that once it proceeded it had a consistent view of the
set of live files. This structure was subtle, less-deterministic and blocked
Open from proceeding until compactions quiesced.

This commit moves the scanning of the directory listing before the scheduling
of flushes or compactions, and adds an assertion that no flushes or compactions
are running during scanObsoleteFiles.

Fix cockroachdb#5420.
@jbowens jbowens requested a review from a team as a code owner October 17, 2025 18:05
@jbowens jbowens requested a review from RaduBerinde October 17, 2025 18:05
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants