Repository navigation
[GC] GC19: Point-in-time prefix and openability fixes for N>1 recovery - #10
Closed
JustinGaoF wants to merge 1 commit into
Closed
JustinGaoF wants to merge 1 commit into
JustinGaoF wants to merge 1 commit into
Conversation
Owner
Author
|
GC19 A/B round: the other candidate (#11) was accepted. Closing this one. |
[GC] GC19 -- recovery fixes: point-in-time prefix and openability at N>1 (gap-close2 FU14 H3, H4, H5, H6 and K2). Reviewer question: Does recovery at N>1 now always produce a prefix of the write history and never leave a valid DB unopenable, in the four cases the review reproduced and the mixed-set fallback? Yes, for each of the five cases below. The four repro tests at the base (DBWalPartitionCoverageTest.FU14H3/H4/H5/H6) fail at ad32830 with the recorded symptoms and pass at this commit unmodified. Each fix has a neuter that makes its tests fail again. Q1 (H3): point-in-time stops at a reported tail gap whatever earlier passes did. - Property: under kPointInTimeRecovery (paranoid_checks, so reports are wired into recovery state), a tail gap whose loss was reported arms the stop at the gap. No record above the gap's index applies unless its sequence continues the recovered one, which a lost index rules out. Tolerate and absolute are unchanged (they still fail at the gap); skip is unchanged. - How: map_tail_gap (db/db_impl/db_impl_open.cc) takes the stop-arming branch when TailGap::reported is set, not only when status is still non-OK. Before, a record from a later WAL passed the torn WAL's loss, reset status, and its continuing sequence resumed replay, so when the gap surfaced the no-report branch cut without stopping. - Evidence: FU14H3ReportedTailGapAfterPassStopsPIT fails at base ("i4 recovered above the prefix end OK") and passes now. New GC19ReportedTailGapStopsPITEitherPartition covers the torn WAL numbered lower (H3's shape) and higher, each with point-in-time stopping at the gap and tolerate/absolute failing with Corruption. - Neuter: drop `|| (stop_on_report && gap.reported)`. H3 and the lower case of the new test fail with "i4 recovered above the prefix end OK". The higher case passes under the neuter: there the report is still pending in status when the gap surfaces, which the base already handled. Q2 (H4): a superseded-only hole with a live record above it is a frontier. - Property: the merge skips a superseded-only index only when no live record appears above it before a void from a WAL older than the declaring WAL. Otherwise the index is the frontier: point-in-time opens the prefix below it, and absolute and tolerate fail with "unexplained hole". Skip keeps re-trusting the declaration (continue_past_discarded_holes). No new on-disk record. - How (WALIndexMerger::Next, db/log_merge.cc): instead of skipping such an index outright, the merge records it as pending (pending_discarded_) along with the lowest WAL declaring the supersession (pending_declarer_), then moves on. If a live record is about to be emitted while one is pending, the merge stops at the pending index (StopAtFrontier). Every other frontier the merge reaches above a pending index also reports the pending index, since it is the first unexplained one. A void covered by a WAL numbered below the declarer clears the pending index. Such a void predates the cut, and an open at N=1 seeds past voids (seed_past_voids and the post-stop void re-read), so indices below it were never reissued. A void in the declarer or a later WAL was burned after the cut and explains nothing below it. Supersessions go to partition 0's new WAL, the lowest-numbered WAL the open creates, so "older than the declarer" means "predates the cut". - Why deferred and not "can an unfinished member still hold a live record": that eager rule fails two N=1 tests (UnreadVoidAfterStopIsNotReissued, BreakSeedsPastVoidAboveLastAppliedRecord). There the stop seeds past a pre-cut void, so superseded indices below the void are legitimately never reissued while live records sit above. - Evidence: FU14H4SupersededOnlyHoleWithLiveAboveStops fails at base ("na2 (wal_index 8) applied above the lost nb (wal_index 7)") and passes now. New LogMergeTest.DiscardedHoleWithLiveAboveIsAFrontier: no void gives a frontier at 4; a pre-cut void in the superseded WAL gives a clean end emitting 1,2,3,7; a post-cut void in the declarer gives a frontier at 4. StopCutsCleanWALsHoldingDroppedRecords, WalFilterStopWritesSupersessionAtReplayCut, UnreadVoidAfterStopIsNotReissued, BreakSeedsPastVoidAboveLastAppliedRecord and every other log_merge_test supersession case pass. - Neuters: - Restore the unconditional skip (never set pending). H4 fails with "na2 (wal_index 8) applied above the lost nb (wal_index 7)", and DiscardedHoleWithLiveAboveIsAFrontier fails. - Never clear on a void. DiscardedHoleWithLiveAboveIsAFrontier (pre-cut case) fails, and UnreadVoidAfterStopIsNotReissued and BreakSeedsPastVoidAboveLastAppliedRecord fail with "unexplained hole at wal_index 5". - Clear on any void (drop the declarer check). The post-cut case fails. - StopAtFrontier reports expected_. The no-void case fails (frontier 6, not 4). Q3 (H5): a DB with a synced unindexed prefix WAL reopens after partitioning. - Property: WALs replayed sequentially ahead of the merge (in wal_numbers and below merge_from) are not demanded by the merge's MANIFEST membership. A missing indexed WAL is still detected. - How: ProcessLogFilesMerged leaves those WALs out of expected_wals. A MANIFEST-tracked WAL below merge_from that is NOT on disk stays demanded, so the filter drops only WALs actually replayed. - Evidence: FU14H5SyncedUnindexedPrefixWalReopens fails at base ("WAL 19 named but not held; cannot bound") and passes now. New GC19MissingIndexedWalAfterPrefixFails: with the same unindexed prefix, a deleted MANIFEST-tracked mid-chain indexed WAL still fails all four modes, naming it. ManifestTrackedMissingWALFailsEveryMode and ManifestTracksEveryPartitionsWalsUnderSkew pass unchanged. - Neuter: keep the prefix in expected_wals. H5 fails with "WAL 19 named but not held; cannot bound". Q4 (H6): a brand-new DB created at N>=2 opens after a torn first record. - Property: when the history floor applies (partitioned set, LastSequence 0, MinWalNumberToKeep 0) and no member attests a predecessor, the lower bound sits at the floor, so every member's head is bounded. A torn first record is then a torn tail: point-in-time and tolerate open the prefix (idx 1), skip opens with idx 1, and absolute fails (Corruption) as for any torn tail. When the floor is off, a data-less torn head still fails closed with "head damaged and unattested". - How: WALIndexMerger::HeadBounded (db/log_merge.h) also holds when history_floor_ is set and attested_wals_ is empty. These are exactly the conditions under which ComputeLowerBound lowers the bound to the floor. The post-drive head check in ProcessLogFilesMerged and the lower-bound damaged-head gate both read HeadBounded, so neither needs its own change. - Evidence: FU14H6TornFirstRecordInBrandNewNTwoDb fails at base ("WAL 5 head damaged and unattested; cannot bound", point-in-time and tolerate) and passes now. New GC19TornFirstRecordInBrandNewNTwoDbModes: absolute gives Corruption, skip gives OK with idx 1. New negative GC19TornFirstRecordAfterFlushStaysDamaged: after a flush (floor off) with spans suppressed, all four modes still fail with "head damaged and unattested". - Neuters: - Drop the floor term. H6 and GC19TornFirstRecordInBrandNewNTwoDbModes fail with "WAL 5 head damaged and unattested". - Let HeadBounded hold whenever no member attests, ignoring whether the floor applies. The negative test fails: the opens succeed. Q5 (K2): the sequential path no longer replays superseded records. - Property: superseded records are not replayed on any path. - A pure legacy prefix (every unindexed WAL below the first indexed one, with at least one indexed WAL, not partitioned) recovers through ProcessLogFilesMerged. That path replays the prefix sequentially and honors supersessions. - An all-indexed N=1 set opened without indexing also takes the merge when a WAL head in the set declares a supersession. - An interleaved set (an unindexed WAL after an indexed one) that declares a supersession fails closed: "WAL <n> carries no WAL index but follows indexed WAL <m> in a set that declares WAL index supersessions; sequential replay cannot honor them". - Interleaved sets without supersessions, and supersession-free indexed sets opened without indexing, keep the sequential path. - How: CheckWALFilesCarryWALIndex already reads every WAL head; it now also reports whether any head declares a supersession for a WAL in the set (supersession records precede the first data record). RecoverLogFiles routes on that flag and on legacy_prefix. - Evidence: new DBWALIndexTest.LegacyPrefixHonorsSupersessionAfterFilterStop. Steps: legacy WAL; enable indexing; two indexed WALs; a StopReplayAfterRecordsWalFilter stop with avoid_flush_during_recovery; more writes; drop the filter; reopen. It fails at base ("Sequence number is being set backwards during recovery ... Prev next seqno: 9 , current next seqno: 7") and passes now with the dropped keys NOT_FOUND. New SupersedingSetOpenedWithoutIndexing (the kNone-opener route) and InterleavedSupersedingSetFailsClosed. - Neuters: - Today's routing for the legacy prefix: LegacyPrefix fails with "Sequence number is being set backwards". - Ignore supersessions in the kNone branch: SupersedingSetOpenedWithoutIndexing fails the same way. - Drop the interleaved check: InterleavedSupersedingSetFailsClosed fails the same way, instead of with the clear status. Fold-back split (absorbing diffs per the GC19 fold-back map; blame at ad32830): - Q1 -> D120649665: db/db_impl/db_impl_open.cc map_tail_gap, the old_log_record branch condition and its comment (lines blamed to D120649665). Test GC19ReportedTailGapStopsPITEitherPartition (db/db_write_test.cc, DBWalPartitionCoverageTest fixture from D127093323; N>1 tests compile at or above D123079329). - Q2 -> D120649665: db/log_merge.cc, in WALIndexMerger::Next: - the superseded-only branch and its comment, the void/swallowed skip branch, the lost-floor frontier and the pristine frontier (lines blamed to D120649665, the pristine frontier partly to D120624825); - the emission check, new code next to the D120624825 emit block. db/log_merge.h: the class comment line (D120649665), StopAtFrontier (new code beside D120624825's Fail), pending_discarded_/pending_declarer_ (new code beside D120649665's members). Tests: the updated DiscardedHoleWithoutTornTailSkips and the new DiscardedHoleWithLiveAboveIsAFrontier (db/log_merge_test.cc, from D120649665). - Q3 -> D120649665: db/db_impl/db_impl_open.cc expected_wals filter and comment. Test GC19MissingIndexedWalAfterPrefixFails (db/db_write_test.cc). - Q4 -> D120624825 (HeadBounded): db/log_merge.h HeadBounded and its comment. The D123928339 post-drive head check is not modified; it reads HeadBounded. Tests GC19TornFirstRecordInBrandNewNTwoDbModes and GC19TornFirstRecordAfterFlushStaysDamaged (db/db_write_test.cc). - Q5 -> D121636079 (mixed-set gate) with the routing lines from D123928339. - db/db_impl/db_impl.h: the CheckWALFilesCarryWALIndex declaration (comment D121636079, signature D123928339). - db/db_impl/db_impl_open.cc: - CheckWALFilesCarryWALIndex signature, asserts, init and the supersession scan (D123928339 lines); - in RecoverLogFiles, the superseding local and call (D123928339), the interleaved fail-closed check and legacy_prefix (new code after the D123928339 partitioned check), and the branch conditions (D123928339); - the sequential-branch comment (D121636079). - Tests LegacyPrefixHonorsSupersessionAfterFilterStop, SupersedingSetOpenedWithoutIndexing and InterleavedSupersedingSetFailsClosed (db/db_wal_test.cc, DBWALIndexTest fixture from D120415420; StopReplayAfterRecordsWalFilter from D120415420). Assumptions: 1. Q1 is conditioned on stop_on_report (paranoid_checks, non-skip). Without paranoid_checks reports are not wired into recovery state on either path, so behaviour there is unchanged (least change, N=1 unaffected). 2. Q2 keeps skip mode's continue_past_discarded_holes re-trust: the doc scopes Q2's failure mapping to point-in-time and absolute. 3. Q2's "can still hold a live record above" is computed lazily (the first live record actually emitted above the index), with the pre-cut-void exception. A pristine, lost-floor or torn-over-superseded frontier above a pending index reports the pending index. 4. Q5 interleaved case: fail closed rather than honor. Honoring would need the sequential ProcessLogFile path to skip superseded records, which is a larger change in shared N=1 code. Since an open without indexing that merges always flushes (ProcessLogFilesMerged), it never leaves an interleaved set behind, so the fail-closed case arises only when an interleaved set already exists and a later indexed open declares a supersession. 5. Q5 also routes a supersession-declaring all-indexed N=1 set opened without indexing through the merge. The question requires superseded records never be replayed on any path, and that route had the same defect (SupersedingSetOpenedWithoutIndexing fails at base). 6. LogMergeTest.DiscardedHoleWithoutTornTailSkips encoded the buggy outcome (old WAL superseded from 4, young holds live 6 and 7, so 4 and 5 were skipped). By H4's argument that history means the reissued 4 and 5 were lost. It now checks the legitimate skip (young reissued only 4, so 5 is skipped and the drive ends clean). The old layout moved to DiscardedHoleWithLiveAboveIsAFrontier, which expects a frontier at 4. This is the only previously passing test whose expectation changed. 7. FU14H6's leftover callback on the removed sync point DBImpl::ValidateOptions:AllowWalPartitions is dead but harmless (GC18 lifted the gate). The repro test is left as is. Not done: - None of Q1-Q5. - Not verified: whether a deleted *current* (never rotated) indexed WAL after SyncWAL is caught. An early draft of GC19MissingIndexedWalAfterPrefixFails deleted partition 1's current WAL and tolerate opened OK. The test now deletes a rotated WAL. This was not compared against the base and is outside this round's scope. Test plan (results at this commit unless noted; logs under ~/pwal-3p/gc-19-claude-tmp/logs; host 166 cores, J=83): - Repro tests, unmodified (debug): at the base all four fail with the recorded symptoms (H3 "i4 recovered above the prefix end OK"; H4 "na2 (wal_index 8) applied above the lost nb (wal_index 7)"; H5 "WAL 19 named but not held; cannot bound"; H6 "WAL 5 head damaged and unattested; cannot bound" for point-in-time and tolerate). At this commit, 4/4 pass. - Required suites (debug), one gtest-parallel run of db_write_test, db_wal_test, log_merge_test, log_test, db_wal_oracle_test, db_basic_test and transaction_test: 6841/6842 passed. The exception, DBWALTest.SyncClosedWalsEmptiedByWaitLeavesLaterMark, hung under the 60-worker run. Its stack shows a SyncPoint dependency wait in DBImpl::SyncWAL -> ClaimWalPartitionForSyncWalImpl, a write-path test this change does not touch. Rerun alone it passes 30/30 at this commit and 30/30 at the base, so I count it as a pre-existing rare hang, not a regression; it was not reproduced. That run preceded the clang-format pass (whitespace only). After that pass, the 8 FU14/GC19 db_write_test tests, the 3 Q5 db_wal_test tests and log_merge_test (196/196) were rerun and pass. - Neuters: one per behaviour, each listed under its question above. Each was applied by script, the patched file's sha256 checked to differ, the binaries rebuilt, the named tests run, then the file restored (sha verified). All 11 neuters made their tests fail as described. Logs in ~/pwal-3p/gc-19-claude-tmp/neuter. - Repeats (debug, --gtest_repeat=100): db_write_test FU14*/GC19* 800/800; db_wal_test Q5 tests plus UnreadVoidAfterStopIsNotReissued and BreakSeedsPastVoidAboveLastAppliedRecord 500/500; log_merge_test *DiscardedHole* 1200/1200 (3 tests x 4 params x 100). - TSan (clang, USE_CLANG=1 COMPILE_WITH_TSAN=1): the same new and changed tests (8 db_write_test, 5 db_wal_test, 12 log_merge_test instances) pass with 0 ThreadSanitizer reports. - GC15 oracle: ROCKSDB_WAL_ORACLE_CYCLES=1000 ./db_wal_oracle_test passes. 1000 cycles from seed 20261019, N=2 in 507 and N=8 in 493, 0 prefix violations, 129 recoveries stopped at a cross-partition hole. The three self-tests (CatchesSafePointOffByOne, CatchesMergeStopOffByOne, CatchesLowerBoundWithoutSpans) still catch their injected bugs. - N=1 byte identity (DEBUG_LEVEL=0 db_bench, fillseq --threads=1 --num=10000 --seed=20260928 --disable_auto_compactions=1). SHA-256 of 000004.log, identical between base (~/pwal-3p/gc-19-claude-base) and this commit: - --partition_wal_usage=none: 6d1351117a289a2784449a68d5421b1aa385ab0b383273c2c5918befa9181b09 - --partition_wal_usage=partition_by_column_family: 9a69a3fc66777fadce05e8a999479a5f57364aca27cd6d22aa00e4631adfc796 - make check-format: "Nothing needs to be reformatted!" (clang-format 21.1.2; my changed lines were formatted with clang-format-diff). - make check-sources: passes. - db_stress / crash test: not run; the owner deferred all db_stress work (2026-10-27). - ASan/UBSan: not run; the doc does not require it.
Owner
Author
|
GC19 selection changed by the owner: this candidate (Claude) is accepted. Head moved to the de-branded commit be48c68 (message-only change). |
Owner
Author
|
GC19 selection changed by the owner: this candidate (Claude) is accepted. The head moves to the de-branded commit be48c68 (message-only change). |
JustinGaoF
force-pushed
the
pwal/gc19-claude
branch
from
October 28, 2026 20:47
f609920 to
be48c68
Compare
This was referenced Oct 28, 2026
Owner
Author
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.
[GC] GC19 -- recovery fixes: point-in-time prefix and openability at N>1
(gap-close2 FU14 H3, H4, H5, H6 and K2).
Reviewer question: Does recovery at N>1 now always produce a prefix of the
write history and never leave a valid DB unopenable, in the four cases the
review reproduced and the mixed-set fallback?
Yes, for each of the five cases below. The four repro tests at the base
(DBWalPartitionCoverageTest.FU14H3/H4/H5/H6) fail at ad32830 with the
recorded symptoms and pass at this commit unmodified. Each fix has a neuter
that makes its tests fail again.
Q1 (H3): point-in-time stops at a reported tail gap whatever earlier
passes did.
into recovery state), a tail gap whose loss was reported arms the stop at
the gap. No record above the gap's index applies unless its sequence
continues the recovered one, which a lost index rules out. Tolerate and
absolute are unchanged (they still fail at the gap); skip is unchanged.
branch when TailGap::reported is set, not only when status is still
non-OK. Before, a record from a later WAL passed the torn WAL's loss,
reset status, and its continuing sequence resumed replay, so when the gap
surfaced the no-report branch cut without stopping.
recovered above the prefix end OK") and passes now. New
GC19ReportedTailGapStopsPITEitherPartition covers the torn WAL numbered
lower (H3's shape) and higher, each with point-in-time stopping at the gap
and tolerate/absolute failing with Corruption.
|| (stop_on_report && gap.reported). H3 and the lower caseof the new test fail with "i4 recovered above the prefix end OK". The
higher case passes under the neuter: there the report is still pending in
status when the gap surfaces, which the base already handled.
Q2 (H4): a superseded-only hole with a live record above it is a frontier.
appears above it before a void from a WAL older than the declaring WAL.
Otherwise the index is the frontier: point-in-time opens the prefix below
it, and absolute and tolerate fail with "unexplained hole". Skip keeps
re-trusting the declaration (continue_past_discarded_holes). No new
on-disk record.
index outright, the merge records it as pending (pending_discarded_) along
with the lowest WAL declaring the supersession (pending_declarer_), then
moves on. If a live record is about to be emitted while one is pending, the
merge stops at the pending index (StopAtFrontier). Every other frontier the
merge reaches above a pending index also reports the pending index, since
it is the first unexplained one. A void covered by a WAL numbered below the
declarer clears the pending index. Such a void predates the cut, and an
open at N=1 seeds past voids (seed_past_voids and the post-stop void
re-read), so indices below it were never reissued. A void in the declarer
or a later WAL was burned after the cut and explains nothing below it.
Supersessions go to partition 0's new WAL, the lowest-numbered WAL the open
creates, so "older than the declarer" means "predates the cut".
that eager rule fails two N=1 tests (UnreadVoidAfterStopIsNotReissued,
BreakSeedsPastVoidAboveLastAppliedRecord). There the stop seeds past a
pre-cut void, so superseded indices below the void are legitimately never
reissued while live records sit above.
(wal_index 8) applied above the lost nb (wal_index 7)") and passes now. New
LogMergeTest.DiscardedHoleWithLiveAboveIsAFrontier: no void gives a
frontier at 4; a pre-cut void in the superseded WAL gives a clean end
emitting 1,2,3,7; a post-cut void in the declarer gives a frontier at 4.
StopCutsCleanWALsHoldingDroppedRecords, WalFilterStopWritesSupersessionAtReplayCut,
UnreadVoidAfterStopIsNotReissued, BreakSeedsPastVoidAboveLastAppliedRecord
and every other log_merge_test supersession case pass.
(wal_index 8) applied above the lost nb (wal_index 7)", and
DiscardedHoleWithLiveAboveIsAFrontier fails.
case) fails, and UnreadVoidAfterStopIsNotReissued and
BreakSeedsPastVoidAboveLastAppliedRecord fail with "unexplained hole at
wal_index 5".
4).
Q3 (H5): a DB with a synced unindexed prefix WAL reopens after partitioning.
below merge_from) are not demanded by the merge's MANIFEST membership. A
missing indexed WAL is still detected.
MANIFEST-tracked WAL below merge_from that is NOT on disk stays demanded,
so the filter drops only WALs actually replayed.
named but not held; cannot bound") and passes now. New
GC19MissingIndexedWalAfterPrefixFails: with the same unindexed prefix, a
deleted MANIFEST-tracked mid-chain indexed WAL still fails all four modes,
naming it. ManifestTrackedMissingWALFailsEveryMode and
ManifestTracksEveryPartitionsWalsUnderSkew pass unchanged.
not held; cannot bound".
Q4 (H6): a brand-new DB created at N>=2 opens after a torn first record.
MinWalNumberToKeep 0) and no member attests a predecessor, the lower bound
sits at the floor, so every member's head is bounded. A torn first record
is then a torn tail: point-in-time and tolerate open the prefix (idx 1),
skip opens with idx 1, and absolute fails (Corruption) as for any torn tail.
When the floor is off, a data-less torn head still fails closed with "head
damaged and unattested".
history_floor_ is set and attested_wals_ is empty. These are exactly the
conditions under which ComputeLowerBound lowers the bound to the floor. The
post-drive head check in ProcessLogFilesMerged and the lower-bound
damaged-head gate both read HeadBounded, so neither needs its own change.
damaged and unattested; cannot bound", point-in-time and tolerate) and
passes now. New GC19TornFirstRecordInBrandNewNTwoDbModes: absolute gives
Corruption, skip gives OK with idx 1. New negative
GC19TornFirstRecordAfterFlushStaysDamaged: after a flush (floor off) with
spans suppressed, all four modes still fail with "head damaged and
unattested".
fail with "WAL 5 head damaged and unattested".
floor applies. The negative test fails: the opens succeed.
Q5 (K2): the sequential path no longer replays superseded records.
with at least one indexed WAL, not partitioned) recovers through
ProcessLogFilesMerged. That path replays the prefix sequentially and
honors supersessions.
a WAL head in the set declares a supersession.
supersession fails closed: "WAL carries no WAL index but follows
indexed WAL in a set that declares WAL index supersessions;
sequential replay cannot honor them".
sets opened without indexing, keep the sequential path.
reports whether any head declares a supersession for a WAL in the set
(supersession records precede the first data record). RecoverLogFiles
routes on that flag and on legacy_prefix.
Steps: legacy WAL; enable indexing; two indexed WALs; a
StopReplayAfterRecordsWalFilter stop with avoid_flush_during_recovery; more
writes; drop the filter; reopen. It fails at base ("Sequence number is
being set backwards during recovery ... Prev next seqno: 9 , current next
seqno: 7") and passes now with the dropped keys NOT_FOUND. New
SupersedingSetOpenedWithoutIndexing (the kNone-opener route) and
InterleavedSupersedingSetFailsClosed.
"Sequence number is being set backwards".
fails the same way.
the same way, instead of with the clear status.
Fold-back split (absorbing diffs per the GC19 fold-back map; blame at
ad32830):
old_log_record branch condition and its comment (lines blamed to
D120649665). Test GC19ReportedTailGapStopsPITEitherPartition
(db/db_write_test.cc, DBWalPartitionCoverageTest fixture from D127093323;
N>1 tests compile at or above D123079329).
branch, the lost-floor frontier and the pristine frontier (lines blamed
to D120649665, the pristine frontier partly to D120624825);
db/log_merge.h: the class comment line (D120649665), StopAtFrontier (new
code beside D120624825's Fail), pending_discarded_/pending_declarer_ (new
code beside D120649665's members). Tests: the updated
DiscardedHoleWithoutTornTailSkips and the new
DiscardedHoleWithLiveAboveIsAFrontier (db/log_merge_test.cc, from
D120649665).
comment. Test GC19MissingIndexedWalAfterPrefixFails (db/db_write_test.cc).
The D123928339 post-drive head check is not modified; it reads
HeadBounded. Tests GC19TornFirstRecordInBrandNewNTwoDbModes and
GC19TornFirstRecordAfterFlushStaysDamaged (db/db_write_test.cc).
D121636079, signature D123928339).
supersession scan (D123928339 lines);
interleaved fail-closed check and legacy_prefix (new code after the
D123928339 partitioned check), and the branch conditions (D123928339);
SupersedingSetOpenedWithoutIndexing and InterleavedSupersedingSetFailsClosed
(db/db_wal_test.cc, DBWALIndexTest fixture from D120415420;
StopReplayAfterRecordsWalFilter from D120415420).
Assumptions:
paranoid_checks reports are not wired into recovery state on either path,
so behaviour there is unchanged (least change, N=1 unaffected).
scopes Q2's failure mapping to point-in-time and absolute.
live record actually emitted above the index), with the pre-cut-void
exception. A pristine, lost-floor or torn-over-superseded frontier above a
pending index reports the pending index.
the sequential ProcessLogFile path to skip superseded records, which is a
larger change in shared N=1 code. Since an open without indexing that
merges always flushes (ProcessLogFilesMerged), it never leaves an
interleaved set behind, so the fail-closed case arises only when an
interleaved set already exists and a later indexed open declares a
supersession.
indexing through the merge. The question requires superseded records
never be replayed on any path, and that route had the same defect
(SupersedingSetOpenedWithoutIndexing fails at base).
(old WAL superseded from 4, young holds live 6 and 7, so 4 and 5 were
skipped). By H4's argument that history means the reissued 4 and 5 were
lost. It now checks the legitimate skip (young reissued only 4, so 5 is
skipped and the drive ends clean). The old layout moved to
DiscardedHoleWithLiveAboveIsAFrontier, which expects a frontier at 4. This
is the only previously passing test whose expectation changed.
DBImpl::ValidateOptions:AllowWalPartitions is dead but harmless (GC18
lifted the gate). The repro test is left as is.
Not done:
SyncWAL is caught. An early draft of GC19MissingIndexedWalAfterPrefixFails
deleted partition 1's current WAL and tolerate opened OK. The test now
deletes a rotated WAL. This was not compared against the base and is
outside this round's scope.
Test plan (results at this commit unless noted; logs under
~/pwal-3p/gc-19-claude-tmp/logs; host 166 cores, J=83):
recorded symptoms (H3 "i4 recovered above the prefix end OK"; H4 "na2
(wal_index 8) applied above the lost nb (wal_index 7)"; H5 "WAL 19 named
but not held; cannot bound"; H6 "WAL 5 head damaged and unattested; cannot
bound" for point-in-time and tolerate). At this commit, 4/4 pass.
db_wal_test, log_merge_test, log_test, db_wal_oracle_test, db_basic_test
and transaction_test: 6841/6842 passed. The exception,
DBWALTest.SyncClosedWalsEmptiedByWaitLeavesLaterMark, hung under the
60-worker run. Its stack shows a SyncPoint dependency wait in
DBImpl::SyncWAL -> ClaimWalPartitionForSyncWalImpl, a write-path test this
change does not touch. Rerun alone it passes 30/30 at this commit and
30/30 at the base, so I count it as a pre-existing rare hang, not a
regression; it was not reproduced. That run preceded the clang-format pass
(whitespace only). After that pass, the 8 FU14/GC19 db_write_test tests,
the 3 Q5 db_wal_test tests and log_merge_test (196/196) were rerun and
pass.
applied by script, the patched file's sha256 checked to differ, the
binaries rebuilt, the named tests run, then the file restored (sha
verified). All 11 neuters made their tests fail as described. Logs in
~/pwal-3p/gc-19-claude-tmp/neuter.
db_wal_test Q5 tests plus UnreadVoidAfterStopIsNotReissued and
BreakSeedsPastVoidAboveLastAppliedRecord 500/500; log_merge_test
DiscardedHole 1200/1200 (3 tests x 4 params x 100).
tests (8 db_write_test, 5 db_wal_test, 12 log_merge_test instances) pass
with 0 ThreadSanitizer reports.
1000 cycles from seed 20261019, N=2 in 507 and N=8 in 493, 0 prefix
violations, 129 recoveries stopped at a cross-partition hole. The three
self-tests (CatchesSafePointOffByOne, CatchesMergeStopOffByOne,
CatchesLowerBoundWithoutSpans) still catch their injected bugs.
--num=10000 --seed=20260928 --disable_auto_compactions=1). SHA-256 of
000004.log, identical between base (~/pwal-3p/gc-19-claude-base) and this
commit:
6d1351117a289a2784449a68d5421b1aa385ab0b383273c2c5918befa9181b09
9a69a3fc66777fadce05e8a999479a5f57364aca27cd6d22aa00e4631adfc796
21.1.2; my changed lines were formatted with clang-format-diff).
(2026-10-27).