fix(vfs): recover straddling L1 polls - #1478
Open
corylanou wants to merge 4 commits into
Open
Conversation
Recover L1 compaction files that straddle an unanchored polling watermark without changing replica client seek semantics. Keep page index entries from regressing when older L1 files arrive, including pending readers, hydration, and VFS write mode. Add tagged VFS race tests to CI.
PR Build Metrics✅ All clear — no issues detected
Binary Size
Dependency ChangesNo dependency changes. govulncheck OutputBuild Info
History (3 previous)
🤖 Updated on each push. |
Prefer higher compaction levels when page index entries share a MaxTXID so inclusive L0 retention cannot strand page reads. Cover equal-TXID promotion, greater-TXID L0 preservation, and the hydration failure fallback.
- ingest unanchored L1 files at the seeded TXID boundary - record streamed VFS writes in the page index - strengthen equal-TXID and write-mode regressions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The recovery remains local to the VFS poller. It does not change
ReplicaClient.LTXFilesseek semantics or the GCS/Azure prefix behavior.Incremental hydration failures disable hydrated reads and return the polling error because leaving a stale hydrated file enabled could serve wrong pages; disabling hydration falls back to remote page-index reads.
Motivation and Context
A follower can open while L1 is empty and seed its L1 watermark from an L0/snapshot position such as TXID 6. When the first L1 compaction later produces
1-b, the existing MinTXID-based seek for TXID 7 hides that covering file. The next visible file,c-1d, then produces this permanent polling error even though storage is contiguous:The regression test for the related freshness defect also failed on main before this fix:
That stale page-index behavior predates this issue: an older L1 page entry could overwrite a newer L0 entry in the combined, active, pending, or hydrated indexes. Recovering straddling files makes that existing path more reachable, so this PR fixes both behaviors together.
Equal-TXID entries need a level tie-break as well. Once L1 covers TXID N, L0 retention can delete files with MaxTXID less than or equal to N. Repointing equal-TXID pages to the higher L1 level keeps reads valid after that inclusive cleanup, while a strictly newer L0 entry still wins.
PR #1464 and PR #1465 were evaluated. This differs from #1464 by retaining the backend seek contract and containing recovery in the VFS caller, avoiding changes to all storage backends and the GCS/Azure listing prefixes. It differs from #1465 by retaining the current seed because a first L1 file can start above TXID 1; the new anchored fallback recovers the covering range without relying on a TXID-1 invariant. A freshness guard is included for the pre-existing stale-index defect that neither alternative fully addresses.
Fixes #1460
How Has This Been Tested?
The tagged race suite covers the reported two-poll timeline, a straddler and its successor visible in one poll, already-covered L1 ranges, a true L1 gap, a first L1 range starting above TXID 1, aligned and straddling freshness, equal-TXID promotion to retained L1 storage, greater-TXID L0 preservation, pending readers, completed hydration, hydration update failure with remote fallback, VFS writer self-compaction, and commit-shrink replacement.
Types of changes
Checklist
go fmt,go vet)go test ./...)