Skip to content

fix(inkless:switch): start the diskless leader epoch at a lowered seal [KC-837] - #884

Open
giuseppelillo wants to merge 1 commit into
mainfrom
claude/verify-kc-837-issue-d0a8eb
Open

giuseppelillo wants to merge 1 commit into
mainfrom
claude/verify-kc-837-issue-d0a8eb

Conversation

@giuseppelillo

Copy link
Copy Markdown
Contributor

lower-seal moves the committed seal from S to S' < S, but the
diskless log still starts at S. When consolidation fetches at S', the
first batch starts at S, so the leader epoch cache starts the diskless
leader epoch E_d at S and maps S' to a classic epoch.
hasConsolidatedDisklessSuffixFromSeal reads the epoch at the seal, so
maybeTruncateSwitchedFollower and maybeReconcileSwitchedLeader
truncate the consolidated records to S', and
divergenceFromCommittedHistory recreates the replica on a new leader
epoch.

This hits every replica in phase 2. The leader that the seal was lowered
to has E_d at S' from makeLeader, but the restart that the recovery
needs bumps its leader epoch. The consolidated batch in E_d then
replaces that entry with E_d at S.

When the first batch that consolidation fetches at the seal starts past
the seal, ConsolidationFetcherThread now assigns E_d at the seal
before the append. The cache then maps every offset from the seal on to
E_d, as it does when the first batch starts at the seal.

Testing

  • ConsolidationFetcherThreadTest.testAssignsDisklessLeaderEpochAtLoweredSeal
    appends a batch at 10 to a real log that ends at the lowered seal 7
    and has a later leader epoch at 7. The log ends at 11, and the cache
    has E_d at 7. Without the change, the test fails with E_d at 10.
  • testDoesNotAssignDisklessLeaderEpochWhenFirstBatchStartsAtSeal checks
    that a batch at the seal leaves the cache to the append.
  • ReplicaManagerInklessTest.testSwitchedReplicaKeepsConsolidatedRecordsAfterLoweredSeal
    applies a phase 2 delta with a new leader epoch to a replica with classic
    records [0, 7), E_d at 7, and consolidated records [10, 13). The
    replica keeps its log as a leader and as a follower.
  • No cluster test takes a lowered seal through phase 2.

🤖 Generated with Claude Code

…l [KC-837]

`lower-seal` moves the committed seal from `S` to `S' < S`, but the
diskless log still starts at `S`. When consolidation fetches at `S'`, the
first batch starts at `S`, so the leader epoch cache starts the diskless
leader epoch `E_d` at `S` and maps `S'` to a classic epoch.
`hasConsolidatedDisklessSuffixFromSeal` reads the epoch at the seal, so
`maybeTruncateSwitchedFollower` and `maybeReconcileSwitchedLeader`
truncate the consolidated records to `S'`, and
`divergenceFromCommittedHistory` recreates the replica on a new leader
epoch.

This hits every replica in phase 2. The leader that the seal was lowered
to has `E_d` at `S'` from `makeLeader`, but the restart that the recovery
needs bumps its leader epoch. The consolidated batch in `E_d` then
replaces that entry with `E_d` at `S`.

When the first batch that consolidation fetches at the seal starts past
the seal, `ConsolidationFetcherThread` now assigns `E_d` at the seal
before the append. The cache then maps every offset from the seal on to
`E_d`, as it does when the first batch starts at the seal.

Testing

- `ConsolidationFetcherThreadTest.testAssignsDisklessLeaderEpochAtLoweredSeal`
  appends a batch at `10` to a real log that ends at the lowered seal `7`
  and has a later leader epoch at `7`. The log ends at `11`, and the cache
  has `E_d` at `7`. Without the change, the test fails with `E_d` at `10`.
- `testDoesNotAssignDisklessLeaderEpochWhenFirstBatchStartsAtSeal` checks
  that a batch at the seal leaves the cache to the append.
- `ReplicaManagerInklessTest.testSwitchedReplicaKeepsConsolidatedRecordsAfterLoweredSeal`
  applies a phase 2 delta with a new leader epoch to a replica with classic
  records `[0, 7)`, `E_d` at `7`, and consolidated records `[10, 13)`. The
  replica keeps its log as a leader and as a follower.
- No cluster test takes a lowered seal through phase 2.

Assisted-by: Claude Opus 5.5
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.

1 participant