Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-18308; Update CoordinatorSerde #18455

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Conversation

dajac
Copy link
Member

@dajac dajac commented Jan 9, 2025

This patch updates the GroupCoordinatorSerde and the ShareGroupCoordinatorSerde to leverage the CoordinatorRecordType to deserialize records. With this, newly added record are automatically picked up. In other words, the serdes work with all defined records without doing anything.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@github-actions github-actions bot added KIP-932 Queues for Kafka generator RPC and Record code generator labels Jan 9, 2025
Copy link
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

record.key().message()
);
}

@Override
protected ApiMessage apiMessageKeyFor(short recordVersion) {
Copy link
Member

Choose a reason for hiding this comment

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

Personally, I would take this opportunity to stop using "recordVersion" as the variable name here. Really, it has become record type, which happened to be implemented as a version number.

@@ -43,7 +43,7 @@ public abstract class CoordinatorRecordSerde implements Serializer<CoordinatorRe
@Override
public byte[] serializeKey(CoordinatorRecord record) {
// Record does not accept a null key.
return MessageUtil.toVersionPrefixedBytes(
return MessageUtil.toCoordinatorTypePrefixedBytes(
Copy link
Member

Choose a reason for hiding this comment

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

So, it seems to me that toCoordinatorTypePrefixedBytes fixes the version of the key schema as 0, but using toVersionPrefixedBytes permits other versions of the record schemas. However, if I understand correctly, we do not want to use record schemas above 0 and prefer tagged fields for new fields added to records. What is the correct way to version records in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator RPC and Record code generator KIP-932 Queues for Kafka
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants