8000 fix(inkless:switch): advance the leader's local log start past the seal on DeleteRecords [KC-880] by viktorsomogyi · Pull Request #927 · aiven/inkless · GitHub
[go: up one dir, main page]

Skip to content

fix(inkless:switch): advance the leader's local log start past the seal on DeleteRecords [KC-880] - #927

Merged
giuseppelillo merged 2 commits into
mainfrom
svv/kc-880-leader-serves-deleted-past-seal
Dec 3, 2026
Merged

giuseppelillo merged 2 commits into
mainfrom
svv/kc-880-leader-serves-deleted-past-seal

Conversation

@viktorsomogyi
Copy link
Copy Markdown
Contributor

Summary

On a switched consolidating partition, DeleteRecords past the seal now moves the leader's local log start up to the requested offset instead of leaving it at the seal.

 deleteRecords(X)                       // switched partition, X > seal
   local leg
-    cut at seal
+    cut at max(seal, min(X, local high watermark))
   diskless leg: delete WAL up to X
   advance cross-tier earliest to X
leader consumer fetch at an offset in [seal, X)
  before: logStartOffset = seal → serves the deleted records
  after:  logStartOffset = X    → OFFSET_OUT_OF_RANGE, same as followers and ListOffsets(EARLIEST)

Evidence

  • Before: both new ReplicaManagerInklessTest cases fail on main:
    seal = 100, leader local log [0, 200), deleteRecords(150)
      assert leader.logStartOffset == 150              // was 100
      assert leader.read(100) throws OffsetOutOfRange  // returned records
    
    seal = 100, leader local high watermark 120, deleteRecords(150)
      assert leader.logStartOffset == 120              // was 100
    
    After: both pass, and the full ReplicaManagerInklessTest suite passes (297 tests).

Merge Danger

Door: two-way

Reverting restores the old cut at the seal. The extra local records this removes on the leader were already deleted by the same request: in the WAL, and from EARLIEST on every broker.

Blast Radius: narrow

Only DeleteRecords on switched partitions with an offset above the seal is affected. Without consolidation, the local log ends at the seal, so the result is unchanged. A leader whose local high watermark is below X stops there, and its consolidation fetch resets it to X.

🤖 Generated with Claude Code

@viktorsomogyi
viktorsomogyi force-pushed the svv/kc-880-leader-serves-deleted-past-seal branch from 792f00f to 1e86a36 Compare December 2, 2026 12:43
waitUntilTrue(() => responseData.nonEmpty, "Lagging switched consolidating delete records response was not completed")
assertEquals(Errors.NONE.code, responseData(disklessTopicPartition.topicPartition()).errorCode)
assertEquals(150L, responseData(disklessTopicPartition.topicPartition()).lowWatermark)
assertEquals(120L, partition.localLogOrException.logStartOffset)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR body says a leader whose local high watermark is below X "stops there, and its consolidation fetch resets it to X". This test stops at logStartOffset == 120. No test covers the step from 120 to 150.

That step depends on several pieces lining up:

  • find_batches returns offset_out_of_range at 120.
  • DisklessLeaderEndPoint.fetch reports min(crossTier, localLog.logStartOffset) = 120 as the log start, and returns OFFSET_OUT_OF_RANGE because crossTier >= disklessStartOffset.
  • fetchOffsetAndTruncate then gets EARLIEST = 150 and calls truncateFullyAndStartAt(150).

The existing endpoint test for that branch, testFetchResetsBelowSealBeforeFirstPruneWhenPrefixIsDeleted, uses a local log start of 0, below the seal. The state this PR creates, with the local log start above the seal and below the cross-tier earliest, isn't exercised.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, your trace is right. I added two tests in dc037e3:

  • DisklessLeaderEndPointTest.testFetchResetsAboveSealWhenDeleteRecordsPassedLaggingLeader covers the endpoint in the state this PR creates: local log start 120, seal 100, WAL start and cross-tier earliest 150, and find_batches returning OFFSET_OUT_OF_RANGE at 120. It returns OFFSET_OUT_OF_RANGE with log start 120 and doesn't consult RLMM.
  • ConsolidationFetcherThreadTest.testLaggingLeaderResetsToCrossTierEarliestAfterDeleteRecordsPastSeal drives the real ConsolidationFetcherThread and DisklessLeaderEndPoint through one doWork() and checks truncateFullyAndStartAt(150). The local LEO is 120, not 0, so shouldFetchFromLastTieredOffset is false and the fetcher takes the plain EARLIEST reset.

@viktorsomogyi
viktorsomogyi force-pushed the svv/kc-880-leader-serves-deleted-past-seal branch from 1e86a36 to dc037e3 Compare December 2, 2026 15:59
…al on DeleteRecords [KC-880]

On a switched consolidating partition, DeleteRecords with an offset above
the seal cut the leader's local log only at the seal. The leader's local
log also holds the consolidated range from the seal up to its high
watermark, and its consumer fetch is gated only by the local log start.
The leader kept serving the deleted range while ListOffsets(EARLIEST)
and every follower already rejected it.

The local leg now deletes up to the requested offset, capped at the
local high watermark and never below the seal. A lagging leader stops
at its high watermark, and its consolidation fetch later resets to the
cross-tier earliest. Without consolidation the local log ends at the
seal, so the behavior there doesn't change.

## Test plan

- Add `ReplicaManagerInklessTest` cases for a delete past the seal and
  for a delete past the leader's local high watermark. Both fail
  without the fix.
- Run the full `ReplicaManagerInklessTest` suite: 297 tests pass.

Assisted-by: Claude Opus 5.5
…cords past the seal [KC-880]

A leader whose local high watermark is below the DeleteRecords offset
cuts its local log at the high watermark, past the seal. Its next
consolidation fetch has to reset it to the cross-tier earliest. Nothing
exercised the endpoint with a local log start between the seal and the
cross-tier earliest, or the fetcher reset that follows.

## Test plan

- Add a `DisklessLeaderEndPointTest` case for that state: the endpoint
  returns `OFFSET_OUT_OF_RANGE` without consulting RLMM.
- Add a `ConsolidationFetcherThreadTest` case that drives the real
  fetcher thread and endpoint through one `doWork()` and checks
  `truncateFullyAndStartAt` at the cross-tier earliest.

Assisted-by: Claude Opus 5.5
@viktorsomogyi
viktorsomogyi force-pushed the svv/kc-880-leader-serves-deleted-past-seal branch from dc037e3 to 24f13a4 Compare December 3, 2026 10:30
@giuseppelillo
giuseppelillo enabled auto-merge (squash) December 3, 2026 10:35
@giuseppelillo
giuseppelillo merged commit 1247174 into main Dec 3, 2026
14 checks passed
@giuseppelillo
giuseppelillo deleted the svv/kc-880-leader-serves-deleted-past-seal branch December 3, 2026 10:40
gqmelo added a commit that referenced this pull request Dec 3, 2026
On 4.3, `ConfigurationControlManager#incrementalAlterConfig`,
`incrementalAlterConfigs`, and `legacyAlterConfigs` take a `forwarded`
flag. The tests added by #899 used the main signatures, so they now pass
`false`.

The #927 test in `ConsolidationFetcherThreadTest` mocks `LogConfig`. On
main, an earlier main-only change already imports it, so the cherry-pick
adds the import.

After these picks, `kafka.server.ReplicaManager` on 4.3 is too big for
SpotBugs, and `:core:spotbugsMain` fails with `SKIPPED_CLASS_TOO_BIG`.
The exclude filter skips that pattern for `ReplicaManager` only, as
`inkless-4.1` has done since 0.51.

Assisted-by: Claude Opus 5.5
gqmelo added a commit that referenced this pull request Dec 4, 2026
…branch

0.53 is the first release of `inkless-4.4`, so the branch joins the
active table in `RELEASES.md`. The cherry-pick guide now places main at
the 4.4 branch point and records the adaptations of this round: the
SpotBugs exclude on 4.3, and the `forwarded` argument and the
reassignment completion rule on 4.2 and 4.1.

`ca375e2131` reached `main` inside the upstream sync merge #897, so
`branch-consistency.sh` didn't list it, and the 4.1, 4.2, and 4.3
release-prep PRs failed `Compile and Check Java` without it. The guide
now shows how to find Inkless commits inside a sync merge.

The 4.1 session log first listed the hashes of the release-branch
cherry-picks. The session template and the guide's agent prompt now ask
for the hashes of the commits on main, as the other logs list them.

The session logs record the cherry-pick of #882 through #927 to
`inkless-4.1`, `inkless-4.2`, and `inkless-4.3`, and of #911 through
#927 to `inkless-4.4`, with the follow-up pick of `ca375e2131` and the
4.3 jOOQ fix.

Assisted-by: Claude Opus 5.5
jeqo pushed a commit that referenced this pull request Dec 4, 2026
…branch (#939)

0.53 is the first release of `inkless-4.4`, so the branch joins the
active table in `RELEASES.md`. The cherry-pick guide now places main at
the 4.4 branch point and records the adaptations of this round: the
SpotBugs exclude on 4.3, and the `forwarded` argument and the
reassignment completion rule on 4.2 and 4.1.

`ca375e2131` reached `main` inside the upstream sync merge #897, so
`branch-consistency.sh` didn't list it, and the 4.1, 4.2, and 4.3
release-prep PRs failed `Compile and Check Java` without it. The guide
now shows how to find Inkless commits inside a sync merge.

The 4.1 session log first listed the hashes of the release-branch
cherry-picks. The session template and the guide's agent prompt now ask
for the hashes of the commits on main, as the other logs list them.

The session logs record the cherry-pick of #882 through #927 to
`inkless-4.1`, `inkless-4.2`, and `inkless-4.3`, and of #911 through
#927 to `inkless-4.4`, with the follow-up pick of `ca375e2131` and the
4.3 jOOQ fix.

Assisted-by: Claude Opus 5.5
viktorsomogyi pushed a commit that referenced this pull request Dec 4, 2026
…branch (#939)

0.53 is the first release of `inkless-4.4`, so the branch joins the
active table in `RELEASES.md`. The cherry-pick guide now places main at
the 4.4 branch point and records the adaptations of this round: the
SpotBugs exclude on 4.3, and the `forwarded` argument and the
reassignment completion rule on 4.2 and 4.1.

`ca375e2131` reached `main` inside the upstream sync merge #897, so
`branch-consistency.sh` didn't list it, and the 4.1, 4.2, and 4.3
release-prep PRs failed `Compile and Check Java` without it. The guide
now shows how to find Inkless commits inside a sync merge.

The 4.1 session log first listed the hashes of the release-branch
cherry-picks. The session template and the guide's agent prompt now ask
for the hashes of the commits on main, as the other logs list them.

The session logs record the cherry-pick of #882 through #927 to
`inkless-4.1`, `inkless-4.2`, and `inkless-4.3`, and of #911 through
#927 to `inkless-4.4`, with the follow-up pick of `ca375e2131` and the
4.3 jOOQ fix.

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.

2 participants

0