Repository navigation
fix(inkless:delete-records): fail DeleteRecords when the cross-tier advance fails [KC-883] - #931
Merged
Merged
Conversation
viktorsomogyi
force-pushed
the
svv/kc-883-swallowed-advance-failure
branch
5 times, most recently
from
December 4, 2026 11:10
40a05d0 to
3526e42
Compare
viktorsomogyi
marked this pull request as ready for review
December 4, 2026 11:11
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The test expects deletion success during a pending classic-to-diskless switch, but the implementation returns INVALID_REQUEST before deletion, invalidating its success and log-start assertions.
1 open issue
What changed in this PR
This PR makes DeleteRecords report cross-tier offset advance failures for consolidating diskless partitions instead of returning success with stale earliest offsets.
Changes:
- Extracts cross-tier advancement into a dedicated helper.
- Validates responses and maps failures to partition errors.
- Adds coverage for failure handling and partition edge cases.
| File | Description |
|---|---|
core/src/test/scala/unit/kafka/server/ReplicaManagerInklessTest.scala |
Adds error, malformed-response, mixed-batch, and pending-switch tests. |
core/src/main/scala/kafka/server/ReplicaManager.scala |
Delegates advancement to the helper and clarifies cleanup comments. |
core/src/main/scala/io/aiven/inkless/consolidation/CrossTierDeleteRecords.scala |
Implements response validation, failure mapping, and cache updates. |
Review effort: Balanced
viktorsomogyi
force-pushed
the
svv/kc-883-swallowed-advance-failure
branch
2 times, most recently
from
December 4, 2026 13:01
d7cdf8c to
46d1f86
Compare
giuseppelillo
approved these changes
Dec 4, 2026
giuseppelillo
enabled auto-merge (squash)
December 4, 2026 14:59
… fails [KC-883] A failed cross-tier earliest-offset advance previously left DeleteRecords reporting success, with no mechanism to resend the value. Other brokers could retain a stale earliest offset and continue serving deleted records. Return a partition error with an invalid low watermark when advancement fails. Map an unavailable control plane to retriable KAFKA_STORAGE_ERROR and other advance failures to UNKNOWN_SERVER_ERROR. Preserve the original results for untracked partitions and pending-switch deletes with an unknown low watermark. Validate response counts and stored offsets before writing through the cache. Keep the cross-tier advancement logic in an Inkless helper so ReplicaManager stays within the SpotBugs analysis size limit. Clarify caller retry behavior, pending-switch routing, and the control-plane reclaim floor used for remote cleanup. Validation: :core:spotbugsMain, make vale, and git diff --check pass. No local tests run. Assisted-by: Claude Opus 5.5 Assisted-by: Claude Sonnet 5.5 Assisted-by: GPT-6.1 Sol
…own watermark The rebased broker rejects DeleteRecords if a classic-to-diskless switch is pending. Cover HIGH_WATERMARK in the existing switch-race test and exercise the unknown low watermark guard directly in the cross-tier advance helper. Assisted-by: GPT-6.2 Sol
viktorsomogyi
force-pushed
the
svv/kc-883-swallowed-advance-failure
branch
from
December 4, 2026 15:02
46d1f86 to
6e80c30
Compare
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
After a
DeleteRecordson a consolidating diskless partition, the broker advances the cross-tier earliest offset in the control plane. Nothing re-sends that value if the call fails, so the broker now reports the failure instead of returning success. Before this change,EARLIESTstayed stale on every broker and followers kept serving deleted records.The advance is forward-only, so repeating a delete or advance to a fixed offset is idempotent. A
HIGH_WATERMARKdelete resolves its offset again on each attempt. The upstream switch guard rejectsDeleteRecordswhile the switch is pending or the classic prefix is only on local disks.Evidence
testDeleteRecordsConsolidatingDoesNotReportSuccessWhenCrossTierAdvanceFails(the first version of the test) failed on the old code:AssertionFailedError: The client must not see success when the cross-tier earliest was not advanced ==> expected: not equal but was: <0>The log showed
Failed to advance cross-tier log start offset for diskless-0.After: CI on
3526e42f94passes compilation, SpotBugs, and the cross-tier advancement cases. The Java 17 and Java 25core-other-and-kafkajobs fail on the same test that expects a pending-switch delete to succeed. The correction checksINVALID_REQUESTand an unchanged local log start forHIGH_WATERMARKduring a pending switch. A separate helper test checks that an unknown low watermark skips the advance. Test compilation and Vale pass for the correction; CI hasn't run on the correction yet.Merge Danger
Door: two-way
Blast Radius:
DeleteRecordson consolidating diskless topicsKnown limitation: if the control plane returns
UNKNOWN_TOPIC_OR_PARTITIONfor the advance, the broker keeps the original result for compatibility. The broker doesn't schedule a retry or guarantee reconciliation.EARLIESTcan stay stale even though the client receives success.A control-plane outage now surfaces as an error on these deletes, where it used to be swallowed. The delete can already have advanced the local or WAL log start when the error returns. The AdminClient (
DeleteRecordsHandler) retries the delete on its own for the retriableKAFKA_STORAGE_ERROR. For theUNKNOWN_TOPIC_OR_PARTITIONfrom an unresolved topic ID, it refreshes metadata and retries. It returnsUNKNOWN_SERVER_ERRORto the caller. A retriedHIGH_WATERMARKdelete can also trim records produced after the first attempt. During a pending switch, the broker returnsINVALID_REQUESTbefore either delete leg runs. No wire format, config, or on-disk change.Alternatives
CrossTierLogStartReporterbuffer and keep returning success: not chosen. It heals without admin action, butEARLIESTstays stale until the retry lands, and it adds async wiring and concurrency risk.Fixes KC-883.
🤖 Generated with Claude Code