fix(inkless): correctly migrate all producer states after a diskless switch - #615
Merged
Merged
Conversation
…switch Previously, diskless init only migrated one aggregate producer state per producer, using the first sequence and last offset from different retained batches. This could lose intermediate retained batch metadata and produce an invalid sequence/offset range after the switch. The fix serializes each retained BatchMetadata entry as its own producer state, preserving the exact sequence range, first offset, and timestamp needed for duplicate detection after migration.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes diskless-init producer-state migration so that all retained batches per producer are preserved (instead of collapsing to a single, potentially invalid range), improving correctness of duplicate detection after a classic→diskless switch.
Changes:
- Serialize each retained
BatchMetadataentry as its ownProducerStatein the InitDisklessLog controller request. - Update/extend unit tests to validate multiple retained batches per producer and multiple producers in the request payload.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| core/src/main/scala/kafka/server/InitDisklessLogState.scala | Builds InitDisklessLog request producer states from per-batch retained metadata rather than a single aggregated range. |
| core/src/test/scala/unit/kafka/server/InitDisklessLogManagerTest.scala | Updates existing expectations and adds a new test covering multiple producers and multiple retained batches per producer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
viktorsomogyi
approved these changes
May 28, 2026
giuseppelillo
added a commit
that referenced
this pull request
May 29, 2026
…switch (#615) Previously, diskless init only migrated one aggregate producer state per producer, using the first sequence and last offset from different retained batches. This could lose intermediate retained batch metadata and produce an invalid sequence/offset range after the switch. The fix serializes each retained BatchMetadata entry as its own producer state, preserving the exact sequence range, first offset, and timestamp needed for duplicate detection after migration.
giuseppelillo
added a commit
that referenced
this pull request
May 29, 2026
…switch (#615) Previously, diskless init only migrated one aggregate producer state per producer, using the first sequence and last offset from different retained batches. This could lose intermediate retained batch metadata and produce an invalid sequence/offset range after the switch. The fix serializes each retained BatchMetadata entry as its own producer state, preserving the exact sequence range, first offset, and timestamp needed for duplicate detection after migration.
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.
Previously, diskless init only migrated one aggregate producer state per producer, using the first sequence and last offset from different retained batches.
This could lose intermediate retained batch metadata and produce an invalid sequence/offset range after the switch.
The fix serializes each retained BatchMetadata entry as its own producer state, preserving the exact sequence range, first offset, and timestamp needed for duplicate detection after migration.