Skip to content

KAFKA-18303; Update ShareCoordinator to use new record format#18396

Merged
dajac merged 4 commits intoapache:trunkfrom
dajac:KAFKA-18303
Jan 7, 2025
Merged

KAFKA-18303; Update ShareCoordinator to use new record format#18396
dajac merged 4 commits intoapache:trunkfrom
dajac:KAFKA-18303

Conversation

@dajac
Copy link
Copy Markdown
Member

@dajac dajac commented Jan 6, 2025

Following #18261, this patch updates the Share Coordinator to use the new record format.

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 core Kafka Broker KIP-932 Queues for Kafka build Gradle build or GitHub Actions small Small PRs labels Jan 6, 2025
short SHARE_SNAPSHOT_RECORD_KEY_VERSION = 0;
short SHARE_SNAPSHOT_RECORD_VALUE_VERSION = 0;
short SHARE_UPDATE_RECORD_KEY_VERSION = 1;
short SHARE_UPDATE_RECORD_VALUE_VERSION = 1;
Copy link
Copy Markdown
Member Author

@dajac dajac Jan 6, 2025

Choose a reason for hiding this comment

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

This is a bug. The version of the update value record must be 0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@AndrewJSchofield Is this something that we want to fix in 4.0?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pardon me, why not fix it for 4.0? I assume it would be an issue to 4.1 in reading the records having incorrect version.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't support migration of the share-group state topic data from 4.0 to 4.1, so not strictly necessary. But really, it is not ideal. Probably should fix it. I'll open an issue.

// Noop
}
} catch (UnsupportedVersionException ex) {
// Ignore
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I ignore unknown records to follow the current implementation.

.setDeliveryState(batch.deliveryState()))
.collect(Collectors.toList())),
ShareCoordinator.SHARE_SNAPSHOT_RECORD_VALUE_VERSION)
(short) 0)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is better to hardcode the version here in order to avoid using the wrong ones as it was the case.

protected ApiMessage apiMessageKeyFor(short recordVersion) {
switch (recordVersion) {
case ShareCoordinator.SHARE_SNAPSHOT_RECORD_KEY_VERSION:
case 0:
Copy link
Copy Markdown
Member Author

@dajac dajac Jan 6, 2025

Choose a reason for hiding this comment

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

This is a temporary step backward. I will rework it in https://issues.apache.org/jira/browse/KAFKA-18308.

@github-actions github-actions Bot removed the small Small PRs label Jan 6, 2025
Copy link
Copy Markdown
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. Handling the records in this way is much nicer.

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

LGTM

handleShareUpdate((ShareUpdateKey) key.message(), (ShareUpdateValue) messageOrNull(value));
break;
default:
// Noop
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe we can use java 17 enhanced switch to eliminate unnecessary default branch.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There is a separate PR for doing this.

@dajac dajac merged commit 7b6e946 into apache:trunk Jan 7, 2025
@dajac dajac deleted the KAFKA-18303 branch January 7, 2025 07:59
ijuma added a commit to ijuma/kafka that referenced this pull request Jan 8, 2025
…og-compaction-write-record-v2

* apache-github/trunk: (34 commits)
  MINOR: Bump year to 2025 in NOTICE file (apache#18427)
  KAFKA-18411 Remove ZkProducerIdManager (apache#18413)
  KAFKA-18408 tweak the 'tag' field for BrokerHeartbeatRequest.json, BrokerRegistrationChangeRecord.json and RegisterBrokerRecord.json (apache#18421)
  KAFKA-18414 Remove KRaftRegistrationResult (apache#18401)
  KAFKA-17921 Support SASL_PLAINTEXT protocol with java.security.auth.login.config (apache#17671)
  KAFKA-18384 Remove ZkAlterPartitionManager (apache#18364)
  KAFKA-10790: Add deadlock detection to producer#flush (apache#17946)
  KAFKA-18412: Remove EmbeddedZookeeper (apache#18399)
  MINOR : Improve Exception log in NotEnoughReplicasException(apache#12394)
  MINOR: Improve PlaintextAdminIntegrationTest#testConsumerGroups (apache#18409)
  MINOR: Remove unused local variable (apache#18410)
  MINOR: Remove RaftManager.maybeDeleteMetadataLogDir and AutoTopicCreationManagerTest.scala (apache#17365)
  KAFKA-18368 Remove TestUtils#MockZkConnect and remove zkConnect from TestUtils#createBrokerConfig (apache#18352)
  MINOR: Update Consumer group timeout default to 30 sec (apache#16406)
  MINOR: Fix typo in CommitRequestManager (apache#18407)
  MINOR: cleanup JavaDocs for deprecation warnings (apache#18402)
  KAFKA-18303; Update ShareCoordinator to use new record format (apache#18396)
  MINOR: Update Consumer and Producer JavaDocs for committing offsets (apache#18336)
  KAFKA-16446: Improve controller event duration logging (apache#15622)
  KAFKA-18388 test-kraft-server-start.sh should use log4j2.yaml (apache#18370)
  ...
manoj-mathivanan pushed a commit to manoj-mathivanan/kafka that referenced this pull request Feb 19, 2025
…#18396)

Following apache#18261, this patch updates the Share Coordinator to use the new record format.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Andrew Schofield <aschofield@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Gradle build or GitHub Actions core Kafka Broker KIP-932 Queues for Kafka tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants