Skip to content

fix(inkless): correctly migrate all producer states after a diskless switch - #615

Merged
jeqo merged 1 commit into
mainfrom
giuseppelillo/fix-producer-states-migration
May 28, 2026
Merged

fix(inkless): correctly migrate all producer states after a diskless switch#615
jeqo merged 1 commit into
mainfrom
giuseppelillo/fix-producer-states-migration

Conversation

@giuseppelillo

Copy link
Copy Markdown
Contributor

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.

…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.

Copilot AI left a comment

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.

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 BatchMetadata entry as its own ProducerState in 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.

@jeqo
jeqo merged commit 12cb1e2 into main May 28, 2026
6 checks passed
@jeqo
jeqo deleted the giuseppelillo/fix-producer-states-migration branch May 28, 2026 08:15
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.
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.

4 participants