Repository navigation
Add bearer-scoped WAL index supersession records - #15234
Open
JustinGaoF wants to merge 9 commits into
Open
JustinGaoF wants to merge 9 commits into
JustinGaoF wants to merge 9 commits into
Conversation
Summary: Defines the `PartitionWALUsage` enum and plumbs `DBOptions::partition_wal_usage` through the options machinery. This is the API surface for per-record WAL ordering numbers (`wal_index`); no WAL format code and no on-disk change yet. The enum has three values. Every value other than `kNone` prefixes each WAL record with a `wal_index`, so they share one on-disk format change and differ only in WAL layout: - `kNone` (0x00) — disabled, WAL stays bit-for-bit compatible with older versions. - `kWALIndexSingleFile` (0x01) — records carry a `wal_index`, WAL layout unchanged. Isolates the format change from any routing change so the two roll out separately. - `kWALIndexPartitionByColumnFamily` (0x02) — reserved for partitioning WALs by column family. Not implemented; a later diff rejects it at `DB::Open` rather than silently leaving the DB unpartitioned. Wiring: the field on `DBOptions` (default `kNone`) and `ImmutableDBOptions`, propagation in `BuildDBOptions`, registration via `OptionTypeInfo::Enum` against `GetPartitionWALUsageStringMap()`, the copy constructor, and `ROCKS_LOG_HEADER`. The string map accepts six keys — a `kFoo` and a `snake_case` spelling for each of the three values — so OPTIONS files and the tooling flags all parse through one table. `BuildDBOptions` propagation is easy to miss: `partition_wal_usage` lives only in `ImmutableDBOptions`, and `options_settable_test`, which would otherwise catch a missing assignment, is compiled out under clang. Differential Revision: D118367634
Summary: Adds the WAL index record types to the log format. Header-only; no writer, reader or on-disk change yet. Marker types `kWALIndexMarkerType` (12) and `kRecyclableWALIndexMarkerType` (13) tag a file as carrying per-record ordering numbers. Indexed data record types `kWALIndexFullType`..`kRecyclableWALIndexLastType` (14-21) mirror the existing full/first/middle/last set, with a recyclable twin for each, so every existing record shape has an indexed counterpart. Each fragment is self-describing: the marker is not required to decode a record, and the marker itself carries no payload. Also adds `IsWALIndexRecordType`, extends `IsRecyclableRecordType` to cover the new recyclable types, and defines `kWALIndexSize = 8` for the fixed64 prefix. All new types stay below `kRecordTypeSafeIgnoreMask`, which is what makes indexed WALs fail closed: an older binary must reject an indexed record rather than silently ignore it and report success. Two `static_assert`s enforce that, so renumbering into the ignorable range breaks the build instead of turning into silent data loss. Differential Revision: D118369740
Summary: Teaches `log::Writer` to emit WAL index records. The writer does not allocate the index — it receives one from the caller and encodes it. Allocation lands in a later diff, where the sequence number is also assigned. `SetPartitionWALUsage` turns indexing on for a writer; `WALIndexEnabled` reports it. `MaybeAddWALIndexMarkerRecord` emits the leading marker. The marker carries **no payload** — the record type alone identifies the file, and its value is positional: it is the first record, so an older binary fails on record #1 rather than partway through replay. `AddRecord` takes the assigned `wal_index`, encodes it as a fixed64 ahead of the record, and picks the matching indexed record type via `SelectRecordType`. Because the index counts as part of the record's payload for checksum and fragmentation, it survives both. Debug asserts enforce that indices are strictly increasing and sequence numbers non-decreasing per writer; a zero index with indexing enabled is rejected outright. The uncompressed path passes the index to `EmitPhysicalRecord` as a **separate 8-byte prefix**, so the caller's payload is never copied. Compression still requires one contiguous input, so that path keeps the joined buffer. `wal_compression` defaults to `kNoCompression`, so the common path avoids the allocation and the full write-batch copy. On-disk bytes, record boundaries and checksums are identical either way. `EmitPhysicalRecord` now selects the header size via `IsRecyclableRecordType` rather than a hand-maintained whitelist. With indexing disabled the output is byte-identical to before, and a `static_assert` in the tests pins that by checking the new predicate agrees with the old whitelist on every pre-existing record type. One hazard is documented rather than fixed: a failed append burns an allocated index. Harmless until a completeness check exists; the `TODO` names the two remedies. Measured on the no-copy path, with the full stack applied so `db_bench` can drive it — `--benchmarks=fillseq --partition_wal_usage=wal_index_single_file --wal_compression=none --compression_type=none --disable_auto_compactions=true --threads=1`, medians of 3 runs on one AMD EPYC-Genoa host, ~512 MiB written per run: | Value size | Entries | Copying prefix | Separate prefix | Latency change | | 64 KiB | 8,192 | 224.908 us/op, 4,445 ops/s | 215.764 us/op, 4,628 ops/s | -4.1% | | 1 MiB | 512 | 2,813.432 us/op, 355 ops/s | 2,373.035 us/op, 421 ops/s | -15.7% | Differential Revision: D118369607
Summary: Teaches `log::Reader` and `FragmentBufferedReader` to decode WAL index records. `MaybeStripAndVerifyWALIndex` extracts the leading fixed64 into `last_read_wal_index_`, strips it from the record, and recomputes the logical-record checksum over the stripped payload so upper layers see the same bytes and checksum they would without indexing. It reports corruption if a record's type claims an index but the payload is too short to hold one, and clears the index for records that carry none, so `GetLastReadWALIndex()` always describes the record just returned. **There is no gap or continuity checking here, deliberately.** wal_index is consecutive across the WAL partition as a whole, not within any single file, so a jump between successive records in one file is normal. Treating it as a gap would be a false positive, and the response to a detected gap is truncation — so the detector is left out until the sequence-to-index correlation it would depend on is resolved. Decoding is driven purely by the record type at all eight dispatch sites in both readers, so a file may hold indexed and plain records and each is handled on its own terms. The marker record is not required to decode anything; it is only checked for position, reporting corruption if it appears after a data record, matching how `kSetCompressionType` is handled. `ReadPhysicalRecord` selects header size via `IsRecyclableRecordType`, and `FragmentBufferedReader` tracks whether the in-progress fragmented record is indexed so mismatched fragment types are reported. Exposes one accessor, `GetLastReadWALIndex()`. Per-record state, zero when the record carried no index. Differential Revision: D118369608
Summary: Makes `DBImpl` the owner of WAL index allocation, and wires indexing into the write path. WAL recovery treats `wal_index` order as the durable proxy for sequence-number order. Allocating the two with independent atomics lets concurrent partition writers reverse those orders, so truncating an index prefix could leave an undetectable hole in sequence space. `AllocateSequenceAndWALIndex` reserves the sequence block and, when a WAL record will be written, its `wal_index`, under one short DB-wide `InstrumentedMutex`. The assigned index is then passed into `log::Writer::AddRecord`. A mutex was chosen over a 16-byte atomic so the future durability-watermark `RegisterPending` can join the same critical section. The lock covers only counter updates — batch merging, WAL append, compression, sync and all other I/O stay outside it. The `kNone` path never takes it. An exhausted counter fails the write inside the lock rather than wrapping, since wrapping would break the monotonicity ordering depends on. Also binds `SetPartitionWALUsage` on each newly created WAL writer and emits the marker from `StartWALFile`, so both WAL-creation paths — DB open and WAL switch — are covered by one call site. Sequence-only writes use the same allocator without consuming an index; `disableWAL` is covered directly. External-file ingestion already fences both write queues across its sequence assignment, so no indexed allocation can interleave with it. `two_write_queues` is rejected, since its second allocation site would need a broader ordering change. `kWALIndexPartitionByColumnFamily` is rejected as unimplemented, rather than silently leaving the DB unpartitioned. The counter is **not** restored across restarts — it starts at `kWALIndexStartNumber` on every open, so indices are unique among WALs written by one process, not for all time. This is reachable with plain writes rather than only in theory: any write after a reopen starts a second live WAL numbering from `kWALIndexStartNumber` again, and `WALIndexNumberingRestartsAcrossLiveWALs` pins that state so a future fix has to change the test deliberately. Harmless while nothing consumes the index; to be resolved before anything does. The burned-index window from the diff below is wider here, because allocation now precedes write-group merging and payload preparation rather than happening inside `AddRecord`. It still spans no additional I/O, and the existing `TODO` continues to track it. Differential Revision: D119600943
Summary: Exposes `partition_wal_usage` in the tooling. No production behaviour change — everything it drives was built in the diffs below. Adds `--partition_wal_usage` to db_bench and db_stress, and randomises it in db_crashtest between `none` and `wal_index_single_file`. Both tools parse the flag through `GetDBOptionsFromString` rather than a private string table, so they accept exactly what `DBOptions` accepts and cannot drift from it as values are added. Adds the release note: indexed WALs are fail-closed for older binaries, and rolling back means setting `kNone`, flushing every column family so indexed WALs become obsolete, waiting for those files to be deleted, then downgrading. Also adds the compressed-path coverage that needs the whole feature working end to end. Differential Revision: D118371518
Summary: Closes the burned-index hole recorded by the `TODO(justingao)` in `log_writer.cc`. `DBImpl::AllocateSequenceAndWALIndex` consumes a `wal_index` inside its critical section, but the append happens later in `log::Writer::AddRecord`. Anything failing in between leaves the index allocated but absent from the WAL, and a burned index is indistinguishable from a record that was written and then lost. Once gap detection exists it would read as a real gap, and the response to a gap is truncation -- so a benign error would silently discard durable, acknowledged data. This establishes the invariant, in the form gap detection will have to be written against -- all three clauses matter: > Every allocated `wal_index` is on a data record, or under a *void record* covering it, or above every index whose write was acknowledged. The first two clauses are the ones this diff adds. The third is the terminal case and is not a caveat to skim past: when neither the record nor its cover can be written, the write path fails and nothing above the burned index is ever acknowledged, so a gap check that stops at the highest acknowledged index never reaches it. Stating only the first two clauses would be stronger than what is actually guaranteed. New record types `kWALIndexVoidType` (22) and `kRecyclableWALIndexVoidType` (23) carry a closed range as `fixed64 lo | fixed64 hi`, so a burst of burns costs one record. Both stay below `kRecordTypeSafeIgnoreMask` with their own `static_assert`, since an older binary skipping a void record would take the covered range for missing data. A void record consumes no index and, unlike the marker, is not positionally constrained -- a cover is written after the append it stands in for failed, so it can appear anywhere. That is also why it gets its own types rather than a marker payload: the reader enforces the marker's "first record" rule, which a cover would violate by construction. `Writer::AddWALIndexVoidRecord` mirrors `MaybeAddWALIndexMarkerRecord`. It deliberately does not advance `last_wal_index_recorded_` and is not subject to the strictly-increasing check, because its range is behind the high-water mark by construction. Both readers skip void records as metadata, leave `last_read_wal_index_` alone, and abandon an interrupted fragmented record exactly as the marker does -- a cover written after a torn append lands on that path, so the two readers must agree. `DBImpl::CoverBurnedWALIndex` is called on every path where an index was allocated and the append did not reach disk: `WriteImpl`, `PipelinedWriteImpl`, and `ConcurrentWriteGroupToWAL`. The last is unreachable today (`two_write_queues` is rejected alongside indexing) but is covered rather than asserted, so enabling it later cannot silently reintroduce a hole. The recovery dummy write in `db_impl_open.cc` is a documented exception: a failure there fails `Open()`, so the DB never becomes writable and nothing can be acknowledged above the hole. **Worth knowing for review -- this is the third clause above:** at `kWALIndexSingleFile` an IO error can never be covered. The error poisons the `WritableFileWriter`, so `MaybeHandleSeenFileWriterError` fails the cover too. The cover therefore serves the non-poisoning failures inside the window -- batch checksum, `PrepareIOOptions`, compression -- while an IO error falls through to the terminal path, where the same poisoned writer is what guarantees no write above the burned index is acknowledged. That dependency is now explicit (assert plus comment) and the uncovered index is logged at `ERROR`, rather than being incidental. The ordering rule for the future durability watermark is recorded on `AllocateSequenceAndWALIndex` and not implemented here: a failed append leaves its entry in `pending_low[p]`, and the cover must be written and synced before that entry may be popped, or the watermark advances past an uncovered hole. Not included: the optional hoist of `MergeBatch` and `PrepareIOOptions` above the allocation. It would shrink the burn window, but it also removes the only non-poisoning failures that this diff's cover path can be exercised through, so the two are better done in that order rather than together. Out of scope: gap detection, the durability watermark, recovery seeding of `next_wal_index_`, and `kWALIndexPartitionByColumnFamily`. Differential Revision: D119751506
Summary: WAL void ranges are a record-format contract shared by burn covers and the recovery policy in the dependent diff. The reader previously skipped their payload without validating it, while recovery needs a trustworthy upper bound. Define a trusted declaration as exactly 16 bytes, with a nonzero lower bound and `lo <= hi`. A single `Reader::DecodeWALIndexVoidRecord` helper reports corruption for every other form and updates the validated void high-water mark; both `Reader` and `FragmentBufferedReader` call that helper, so their behavior cannot drift. This diff changes no DB recovery policy on its own. Differential Revision: D120171238
Summary: Recovery can restart `wal_index` at its replay cut only when records left above that cut are explicitly obsolete. Existing closed, index-only void ranges cannot distinguish repeated indices stored in different WAL files. Add an open-ended supersession record containing the target WAL number and first obsolete `wal_index`. Readers validate the fixed 16-byte payload and scope supersession to that exact WAL, so equal indices in newer files remain live. This diff defines the format without changing DB recovery behavior. Void and supersession records are both index-only control records: they describe `wal_index` values instead of carrying one, and neither advances the writer's high-water mark. They share one emit path, `EmitWALIndexControlRecord` (seen-error check, block switch, physical record, non-manual flush), parameterized by record type and payload, so the two forms cannot drift on the trailing flush or anything else in that sequence. The bearer-scoped map uses the project's `UnorderedMap` alias, like `recorded_cf_to_ts_sz_` beside it. Differential Revision: D120408456
|
@JustinGaoF has exported this pull request. If you are a Meta employee, you can view the originating Diff in D120408456. |
✅ clang-tidy: No findings on changed linesCompleted in 746.5s. |
✅ Claude Code ReviewAuto-triggered after CI passed — reviewing commit 96ce7cd SummaryWell-structured PR that adds WAL index (wal_index / LSN) support with careful attention to failure handling and backward compatibility. The design is sound: new record types fail-closed on older readers, the allocator is serialized, and burned indices are covered with void records. Test coverage is extensive. High-severity findings (1):
Full review (click to expand)Findings🔴 HIGHH1. New defaulted parameter on
|
| Context | Does code execute? | Assumptions hold? | Action needed? |
|---|---|---|---|
| WritePreparedTxnDB | NO (two_write_queues rejected) | N/A | Safe |
| WriteUnpreparedTxnDB | NO (two_write_queues rejected) | N/A | Safe |
| ReadOnly DB | NO (no writes) | N/A | Safe |
| SecondaryInstance | Partial (compaction progress writer) | YES (MANIFEST writers don't enable WAL index) | Safe |
| User-defined timestamps | YES | YES (UDT size records unaffected) | Safe |
| unordered_write | YES | Mostly (see M1) | Review needed |
| FIFO compaction | YES (write path) | YES | Safe |
| WAL compression | YES (handled in code) | YES (see M4 - untested) | Test needed |
| Recycle log files | YES (recyclable types defined) | YES | Safe |
| Concurrent memtable write | YES (allocator serialized) | YES | Safe |
Positive Observations
- The
static_assertguards ensuring WAL index types stay belowkRecordTypeSafeIgnoreMaskare excellent defensive programming for backward compatibility. - The
IsRecyclableRecordTyperefactoring centralizes a scattered pattern and includes aconstexprcompile-time test (HeaderSelectionUnchangedForPreWALIndexTypes) to verify equivalence with the old inline checks. - The
CoverBurnedWALIndexmechanism with its detailed comments about the three-clause invariant shows careful reasoning about failure modes. - The
EmitWALIndexControlRecordshared path for void and supersession records prevents drift between the two forms. - Comprehensive test coverage including atomicity tests, burned-index tests, IO-error tests, cross-WAL tests, and physical record layout verification.
- The crashtest sanitizer correctly disables WAL indexing when
two_write_queuesis enabled.
ℹ️ 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
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 10, 2026
Summary: Pull Request resolved: meta#15234 Recovery can restart `wal_index` at its replay cut only when records left above that cut are explicitly obsolete. Existing closed, index-only void ranges cannot distinguish repeated indices stored in different WAL files. Add an open-ended supersession record containing the target WAL number and first obsolete `wal_index`. Readers validate the fixed 16-byte payload and scope supersession to that exact WAL, so equal indices in newer files remain live. This diff defines the format without changing DB recovery behavior. Void and supersession records are both index-only control records: they describe `wal_index` values instead of carrying one, and neither advances the writer's high-water mark. They share one emit path, `EmitWALIndexControlRecord` (seen-error check, block switch, physical record, non-manual flush), parameterized by record type and payload, so the two forms cannot drift on the trailing flush or anything else in that sequence. The bearer-scoped map uses the project's `UnorderedMap` alias, like `recorded_cf_to_ts_sz_` beside it. Scope: bearer scoping resolves repeated indices within the live recovery set only. `WAL_ttl_seconds` and `WAL_size_limit_MB` move retired WALs to `archive/`, where they keep the indices they were written with while sitting outside `wal_numbers`; a supersession record names a live WAL and says nothing about an archived one. Any future consumer that merges `wal_index` streams must read the live set only. Test Plan: - `buck2 test fbcode//internal_repo_rocksdb/repo:log_test` -- 379 passed - `arc lint -a` on all changed files: clean. Formatting verified with `clang-format <f> | diff - <f>`: empty M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug build, touched test binaries): PASS; log_test: 379 pass. M5 fold: Absorbs 2 A.1 entries (GC27 2): GC27 Q9 (d) supersession writer; Q9 (b) type-24 assert. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of log_test); 379 tests, 0 failed. Reviewers: #rocksdb, kinbertchou, anand76, dyao, rbanerjee2, taopeng, huixiao, rajivharlalka, xbw Subscribers: jewoongh, rbanerjee2, anand76 Differential Revision: https://phabricator.intern.facebook.com/D120408456 Tags: sentinelized
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
Summary: Pull Request resolved: meta#15234 Recovery can restart `wal_index` at its replay cut only when records left above that cut are explicitly obsolete. Existing closed, index-only void ranges cannot distinguish repeated indices stored in different WAL files. Add an open-ended supersession record containing the target WAL number and first obsolete `wal_index`. Readers validate the fixed 16-byte payload and scope supersession to that exact WAL, so equal indices in newer files remain live. This diff defines the format without changing DB recovery behavior. Void and supersession records are both index-only control records: they describe `wal_index` values instead of carrying one, and neither advances the writer's high-water mark. They share one emit path, `EmitWALIndexControlRecord` (seen-error check, block switch, physical record, non-manual flush), parameterized by record type and payload, so the two forms cannot drift on the trailing flush or anything else in that sequence. The bearer-scoped map uses the project's `UnorderedMap` alias, like `recorded_cf_to_ts_sz_` beside it. Scope: bearer scoping resolves repeated indices within the live recovery set only. `WAL_ttl_seconds` and `WAL_size_limit_MB` move retired WALs to `archive/`, where they keep the indices they were written with while sitting outside `wal_numbers`; a supersession record names a live WAL and says nothing about an archived one. Any future consumer that merges `wal_index` streams must read the live set only. The new types are `kWALIndexSupersessionType` (24) and `kRecyclableWALIndexSupersessionType` (25), kept below `kRecordTypeSafeIgnoreMask` by their own `static_assert`. `Writer::AddWALIndexSupersessionRecord` returns `Corruption`, and both readers report corruption, for a target WAL number that is zero or not older than the bearing WAL, or a first index of zero. Readers also report a supersession that follows a data record. Readers expose the result through `IsWALIndexSuperseded` and `GetFirstSupersededWALIndex`, keeping the lowest boundary when one WAL is named more than once. Test Plan: - `buck2 test fbcode//internal_repo_rocksdb/repo:log_test` -- 379 passed - `arc lint -a` on all changed files: clean. Formatting verified with `clang-format <f> | diff - <f>`: empty M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug build, touched test binaries): PASS; log_test: 379 pass. M5 fold: Absorbs 2 A.1 entries (GC27 2): GC27 Q9 (d) supersession writer; Q9 (b) type-24 assert. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of log_test); 379 tests, 0 failed. Reviewers: #rocksdb, kinbertchou, anand76, dyao, rbanerjee2, taopeng, huixiao, rajivharlalka, xbw Subscribers: jewoongh, rbanerjee2, anand76 Differential Revision: https://phabricator.intern.facebook.com/D120408456 Tags: sentinelized, skip_dr_passed
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
Summary: Pull Request resolved: meta#15234 Recovery can restart `wal_index` at its replay cut only when records left above that cut are explicitly obsolete. Existing closed, index-only void ranges cannot distinguish repeated indices stored in different WAL files. Add an open-ended supersession record containing the target WAL number and first obsolete `wal_index`. Readers validate the fixed 16-byte payload and scope supersession to that exact WAL, so equal indices in newer files remain live. This diff defines the format without changing DB recovery behavior. Void and supersession records are both index-only control records: they describe `wal_index` values instead of carrying one, and neither advances the writer's high-water mark. They share one emit path, `EmitWALIndexControlRecord` (seen-error check, block switch, physical record, non-manual flush), parameterized by record type and payload, so the two forms cannot drift on the trailing flush or anything else in that sequence. The bearer-scoped map uses the project's `UnorderedMap` alias, like `recorded_cf_to_ts_sz_` beside it. Scope: bearer scoping resolves repeated indices within the live recovery set only. `WAL_ttl_seconds` and `WAL_size_limit_MB` move retired WALs to `archive/`, where they keep the indices they were written with while sitting outside `wal_numbers`; a supersession record names a live WAL and says nothing about an archived one. Any future consumer that merges `wal_index` streams must read the live set only. The new types are `kWALIndexSupersessionType` (24) and `kRecyclableWALIndexSupersessionType` (25), kept below `kRecordTypeSafeIgnoreMask` by their own `static_assert`. `Writer::AddWALIndexSupersessionRecord` returns `Corruption`, and both readers report corruption, for a target WAL number that is zero or not older than the bearing WAL, or a first index of zero. Readers also report a supersession that follows a data record. Readers expose the result through `IsWALIndexSuperseded` and `GetFirstSupersededWALIndex`, keeping the lowest boundary when one WAL is named more than once. Test Plan: - `buck2 test fbcode//internal_repo_rocksdb/repo:log_test` -- 379 passed - `arc lint -a` on all changed files: clean. Formatting verified with `clang-format <f> | diff - <f>`: empty M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug build, touched test binaries): PASS; log_test: 379 pass. M5 fold: Absorbs 2 A.1 entries (GC27 2): GC27 Q9 (d) supersession writer; Q9 (b) type-24 assert. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of log_test); 379 tests, 0 failed. Reviewers: #rocksdb, kinbertchou, anand76, dyao, rbanerjee2, taopeng, huixiao, rajivharlalka, xbw Subscribers: jewoongh, rbanerjee2, anand76 Differential Revision: https://phabricator.intern.facebook.com/D120408456 Tags: sentinelized, skip_dr_passed
This branch has not been deployed
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.
Summary:
Recovery can restart
wal_indexat its replay cut only when records left above that cut are explicitly obsolete. Existing closed, index-only void ranges cannot distinguish repeated indices stored in different WAL files.Add an open-ended supersession record containing the target WAL number and first obsolete
wal_index. Readers validate the fixed 16-byte payload and scope supersession to that exact WAL, so equal indices in newer files remain live. This diff defines the format without changing DB recovery behavior.Void and supersession records are both index-only control records: they describe
wal_indexvalues instead of carrying one, and neither advances the writer's high-water mark. They share one emit path,EmitWALIndexControlRecord(seen-error check, block switch, physical record, non-manual flush), parameterized by record type and payload, so the two forms cannot drift on the trailing flush or anything else in that sequence.The bearer-scoped map uses the project's
UnorderedMapalias, likerecorded_cf_to_ts_sz_beside it.Differential Revision: D120408456