Skip to content

feat(inkless): implement InitDisklessLog Controller API#531

Merged
jeqo merged 6 commits intomainfrom
giuseppelillo/push-diskless-start-offset-to-controller
Mar 12, 2026
Merged

feat(inkless): implement InitDisklessLog Controller API#531
jeqo merged 6 commits intomainfrom
giuseppelillo/push-diskless-start-offset-to-controller

Conversation

@giuseppelillo
Copy link
Copy Markdown
Contributor

@giuseppelillo giuseppelillo commented Mar 10, 2026

Persist disklessStartOffset and producer states into KRaft metadata.
Only the leader is allowed to call InitDisklessLog.
To avoid conflicts with upstream changes to the metadata records, new metadata fields are written directly in the unknown tagged fields.
New fields are also persisted in the KRaft snapshots through PartitionRegistration.

@giuseppelillo giuseppelillo force-pushed the giuseppelillo/push-diskless-start-offset-to-controller branch 2 times, most recently from 959f497 to 5e0d79a Compare March 10, 2026 15:10
Persist disklessStartOffset and producer states into KRaft metadata.
Only the leader is allowed to call InitDisklessLog.
New fields are also persisted in the KRaft snapshots through
PartitionRegistration.
To avoid conflicts with upstream changes to the metadata records,
new metadata fields are written directly in the unknown tagged fields
of PartitionRecord and PartitionChangeRecord.
@giuseppelillo giuseppelillo force-pushed the giuseppelillo/push-diskless-start-offset-to-controller branch from 5e0d79a to 4573f9f Compare March 10, 2026 16:01
@giuseppelillo giuseppelillo marked this pull request as ready for review March 10, 2026 16:01
viktorsomogyi
viktorsomogyi previously approved these changes Mar 11, 2026
Copy link
Copy Markdown
Contributor

@viktorsomogyi viktorsomogyi left a comment

Choose a reason for hiding this comment

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

LGTM

int partitionId,
long disklessStartOffset,
int leaderEpoch,
List<ProducerState> producerStates
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.

Does ProducerState need to be persisted on KRaft? I wonder if it could be sent from the leader to DisklessController directly

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.

Yes it needs to be because it might happen that the broker that is able to successfully call InitDisklessLog on the controller (so the real leader) is not the same that calls the Diskless Controller (it might be another one, even a zombie leader in a split brain scenario). To keep this protocol 100% safe without any other step involved we also need to "commit" the producer state, so that once InitDisklessLog controller API is called the partition state is completely frozen.

Copy link
Copy Markdown
Contributor

@jeqo jeqo left a comment

Choose a reason for hiding this comment

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

Looking good. Couple more suggestions

buf.putLong(s.assignedOffset());
buf.putLong(s.batchMaxTimestamp());
}
buf.flip();
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.

nit: can be dropped as the backing array doesn't care about position

@jeqo jeqo merged commit 0070155 into main Mar 12, 2026
4 checks passed
@jeqo jeqo deleted the giuseppelillo/push-diskless-start-offset-to-controller branch March 12, 2026 14:33
AnatolyPopov pushed a commit that referenced this pull request Mar 23, 2026
* feat(inkless): implement InitDisklessLog Controller API

Persist disklessStartOffset and producer states into KRaft metadata.
Only the leader is allowed to call InitDisklessLog.
New fields are also persisted in the KRaft snapshots through
PartitionRegistration.
To avoid conflicts with upstream changes to the metadata records,
new metadata fields are written directly in the unknown tagged fields
of PartitionRecord and PartitionChangeRecord.

(cherry picked from commit 0070155)

# Conflicts:
#	metadata/src/main/java/org/apache/kafka/metadata/PartitionRegistration.java
jeqo pushed a commit that referenced this pull request Mar 23, 2026
* feat(inkless): implement InitDisklessLog Controller API

Persist disklessStartOffset and producer states into KRaft metadata.
Only the leader is allowed to call InitDisklessLog.
New fields are also persisted in the KRaft snapshots through
PartitionRegistration.
To avoid conflicts with upstream changes to the metadata records,
new metadata fields are written directly in the unknown tagged fields
of PartitionRecord and PartitionChangeRecord.
jeqo pushed a commit that referenced this pull request Mar 23, 2026
* feat(inkless): implement InitDisklessLog Controller API

Persist disklessStartOffset and producer states into KRaft metadata.
Only the leader is allowed to call InitDisklessLog.
New fields are also persisted in the KRaft snapshots through
PartitionRegistration.
To avoid conflicts with upstream changes to the metadata records,
new metadata fields are written directly in the unknown tagged fields
of PartitionRecord and PartitionChangeRecord.

(cherry picked from commit 0070155)

# Conflicts:
#	metadata/src/main/java/org/apache/kafka/metadata/PartitionRegistration.java
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