Skip to content

MINOR: Refactor GroupCoordinator write path #19290

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

Merged
merged 2 commits into from
Mar 27, 2025

Conversation

dajac
Copy link
Member

@dajac dajac commented Mar 26, 2025

This patch addresses a weirdness on the GroupCoordinator write path. The CoordinatorPartitionWriter uses the ReplicaManager#appendRecords method with acks=1 and it expects it to completes immediately/synchronously. It works because this is effectively what the method does with acks=1. The issue is that fundamentally the method is asynchronous so the contract is really fragile. This patch changes it by introducing new method ReplicaManager.appendRecordsToLeader, which is synchronous. It also refactors ReplicaManager#appendRecords to use ReplicaManager.appendRecordsToLeader so we can benefits from all the existing tests.

Reviewers: Fred Zheng [email protected], Jeff Kim [email protected]

@github-actions github-actions bot added the core Kafka Broker label Mar 26, 2025
@dajac
Copy link
Member Author

dajac commented Mar 26, 2025

I still need to add a unit tests for the new method.

Copy link

@zhengyd2014 zhengyd2014 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the PR.

Copy link
Contributor

@jeffkbkim jeffkbkim left a comment

Choose a reason for hiding this comment

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

LGTM. thanks!

@dajac dajac merged commit 28de78b into apache:trunk Mar 27, 2025
26 checks passed
@dajac dajac deleted the minor-refactor-coordinator-write-path branch March 27, 2025 15:58
dajac added a commit that referenced this pull request Mar 31, 2025
This is a small follow-up of #19290.
The `actionQueue` argument is only used by the
`CoordinatorPartitionWriter` so we can remove it from the other methods
now.

Reviewers: Jeff Kim <[email protected]>
janchilling pushed a commit to janchilling/kafka that referenced this pull request Apr 4, 2025
This patch addresses a weirdness on the GroupCoordinator write path. The
`CoordinatorPartitionWriter` uses the `ReplicaManager#appendRecords`
method with `acks=1` and it expects it to completes
immediately/synchronously. It works because this is effectively what the
method does with `acks=1`. The issue is that fundamentally the method is
asynchronous so the contract is really fragile. This patch changes it by
introducing new method `ReplicaManager.appendRecordsToLeader`, which is
synchronous. It also refactors `ReplicaManager#appendRecords` to use
`ReplicaManager.appendRecordsToLeader` so we can benefits from all the
existing tests.

Reviewers: Fred Zheng <[email protected]>, Jeff Kim <[email protected]>
janchilling pushed a commit to janchilling/kafka that referenced this pull request Apr 4, 2025
This is a small follow-up of apache#19290.
The `actionQueue` argument is only used by the
`CoordinatorPartitionWriter` so we can remove it from the other methods
now.

Reviewers: Jeff Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Kafka Broker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants