Skip to content

fix(inkless:switch): Init Diskless Log on Control Plane on leader changes#603

Merged
giuseppelillo merged 2 commits into
mainfrom
giuseppelillo/init-diskless-control-plane-bug-fix
May 21, 2026
Merged

fix(inkless:switch): Init Diskless Log on Control Plane on leader changes#603
giuseppelillo merged 2 commits into
mainfrom
giuseppelillo/init-diskless-control-plane-bug-fix

Conversation

@giuseppelillo

@giuseppelillo giuseppelillo commented May 21, 2026

Copy link
Copy Markdown
Contributor

Currently diskless init on Control Plane is only executed by leaders when they see a change in classicToDisklessStartOffset from <0 to >=0, which means that the offset was just committed to the metadata log. In case the init on control plane was not successful and a new leader is elected, the new leader will not retry the init in cases where the metadata record that committed classicToDisklessStartOffset was already processed previously by the new leader.
Change this behavior so that diskless init on Control Plane is done also when there's a leader change.

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

This PR updates the diskless classic→diskless migration flow so that Control Plane diskless init is re-driven when leadership changes, even if the committing metadata (classicToDisklessStartOffset / producer states) was already processed while the broker was a follower.

Changes:

  • Trigger Control Plane init not only when classicToDisklessStartOffset is newly committed, but also when the broker becomes leader for a partition that already has committed diskless-init metadata.
  • Refactor ReplicaManager’s Control Plane init traversal to operate on the broker’s locally-leading partitions from TopicsDelta.localChanges(...).
  • Add unit tests covering leader failover re-drive behavior and ensuring same-leader partition changes do not re-drive Control Plane init.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
core/src/main/scala/kafka/server/ReplicaManager.scala Expands Control Plane init triggering conditions to include leader changes and scopes evaluation to local leader partitions.
core/src/test/scala/unit/kafka/server/metadata/DisklessSwitchFlowTest.scala Adds coverage for leader failover re-drive and guards against redundant re-drive on same-leader changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/main/scala/kafka/server/ReplicaManager.scala Outdated
@giuseppelillo giuseppelillo force-pushed the giuseppelillo/init-diskless-control-plane-bug-fix branch from 2785e58 to 5b2004a Compare May 21, 2026 10:02
…nges

Currently diskless init on Control Plane is only executed by leaders
when they see a change in classicToDisklessStartOffset from <0 to >=0,
which means that the offset was just committed to the metadata log.
In case the init on control plane was not successful and a new leader
is elected, the new leader will not retry the init in cases where the
metadata record that committed classicToDisklessStartOffset was already
process previously by the new leader.
Change this behavior so that diskless init on Control Plane is done
also when there's a leader change.
@giuseppelillo giuseppelillo force-pushed the giuseppelillo/init-diskless-control-plane-bug-fix branch from 5b2004a to 68b64cb Compare May 21, 2026 11:40

@jeqo jeqo 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.

LGTM, just a couple of minor suggestions.

Comment thread core/src/main/scala/kafka/server/ReplicaManager.scala Outdated
Comment thread core/src/test/scala/unit/kafka/server/metadata/DisklessSwitchFlowTest.scala Outdated
Comment thread core/src/test/scala/unit/kafka/server/metadata/DisklessSwitchFlowTest.scala Outdated
@giuseppelillo giuseppelillo requested a review from jeqo May 21, 2026 13:15
@giuseppelillo giuseppelillo merged commit 590c479 into main May 21, 2026
4 checks passed
@giuseppelillo giuseppelillo deleted the giuseppelillo/init-diskless-control-plane-bug-fix branch May 21, 2026 13:37
giuseppelillo added a commit that referenced this pull request May 28, 2026
…nges (#603)

* fix(inkless:switch): Init Diskless Log on Control Plane on leader changes

Currently diskless init on Control Plane is only executed by leaders
when they see a change in classicToDisklessStartOffset from <0 to >=0,
which means that the offset was just committed to the metadata log.
In case the init on control plane was not successful and a new leader
is elected, the new leader will not retry the init in cases where the
metadata record that committed classicToDisklessStartOffset was already
process previously by the new leader.
Change this behavior so that diskless init on Control Plane is done
also when there's a leader change.

* Fix suggestions
giuseppelillo added a commit that referenced this pull request May 29, 2026
…nges (#603)

* fix(inkless:switch): Init Diskless Log on Control Plane on leader changes

Currently diskless init on Control Plane is only executed by leaders
when they see a change in classicToDisklessStartOffset from <0 to >=0,
which means that the offset was just committed to the metadata log.
In case the init on control plane was not successful and a new leader
is elected, the new leader will not retry the init in cases where the
metadata record that committed classicToDisklessStartOffset was already
process previously by the new leader.
Change this behavior so that diskless init on Control Plane is done
also when there's a leader change.

* Fix suggestions
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.

3 participants