Skip to content

MINOR: kafka-stream-groups.sh should fail quickly if the partition leader is unavailable#20271

Merged
lucasbru merged 4 commits into
apache:trunkfrom
JimmyWang6:KAFKA-16717-3
Aug 26, 2025
Merged

MINOR: kafka-stream-groups.sh should fail quickly if the partition leader is unavailable#20271
lucasbru merged 4 commits into
apache:trunkfrom
JimmyWang6:KAFKA-16717-3

Conversation

@JimmyWang6

@JimmyWang6 JimmyWang6 commented Jul 31, 2025

Copy link
Copy Markdown
Contributor

Refer to: #20168 and
#20235 This PR applies
the same partition leader check for StreamsGroupCommand as
ShareGroupCommand and ConsumerGroupCommand to aviod the command
execution timeout.

Reviewers: Lucas Brutschy lucasbru@apache.org

@github-actions github-actions Bot added triage PRs from the community tools small Small PRs labels Jul 31, 2025
@TaiJuWu

TaiJuWu commented Jul 31, 2025

Copy link
Copy Markdown
Collaborator

Could you add test case for this behaviour?

@JimmyWang6

Copy link
Copy Markdown
Contributor Author

Could you add test case for this behaviour?

Sure, thanks for your comments!

@github-actions

github-actions Bot commented Aug 8, 2025

Copy link
Copy Markdown

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

@JimmyWang6

Copy link
Copy Markdown
Contributor Author

@TaiJuWu Sorry for the late response, I have updated the PR, please take a look when available, thanks~

@github-actions

Copy link
Copy Markdown

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

@JimmyWang6

Copy link
Copy Markdown
Contributor Author

Hi @aliehsaeedii @chia7712 @lucasbru , I was wondering if you could take a look at it when you get a chance. Thanks~

@github-actions

Copy link
Copy Markdown

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

@lucasbru

Copy link
Copy Markdown
Member

@JimmyWang6 Thanks for the PR! There are test failures. Could you take a look?

@lucasbru
lucasbru requested a review from Copilot August 25, 2025 06:38

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 adds partition leader validation to the StreamsGroupCommand to avoid command execution timeouts when partition leaders are unavailable, aligning with similar checks already implemented in ShareGroupCommand and ConsumerGroupCommand.

  • Adds partition validation check in getPartitionsToReset() method
  • Includes test case for handling non-existent partitions
  • Fixes a minor typo in ShareGroupCommandTest

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java Adds partition leader validation call to prevent timeouts
tools/src/test/java/org/apache/kafka/tools/streams/StreamsGroupCommandTest.java Adds test case and imports for partition validation scenario
tools/src/test/java/org/apache/kafka/tools/consumer/group/ShareGroupCommandTest.java Fixes typo in test method name

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@JimmyWang6

Copy link
Copy Markdown
Contributor Author

@lucasbru Thanks for your reply! I haved fixed the failure test, PTAL.

@github-actions github-actions Bot removed needs-attention triage PRs from the community labels Aug 26, 2025

@lucasbru lucasbru left a comment

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.

LGTM, thanks!

@lucasbru
lucasbru merged commit d2f162a into apache:trunk Aug 26, 2025
23 checks passed
@lucasbru lucasbru added the KIP-1071 PRs related to KIP-1071 label Oct 23, 2025
eduwercamacaro pushed a commit to littlehorse-enterprises/kafka that referenced this pull request Nov 12, 2025
…ader is unavailable (apache#20271)

This PR applies the same partition leader check for `StreamsGroupCommand` as
`ShareGroupCommand`  and `ConsumerGroupCommand` to avoid the command
execution timeout.

Reviewers: Lucas Brutschy <lucasbru@apache.org>
gaurav-narula pushed a commit to gaurav-narula/kafka that referenced this pull request Jul 20, 2026
…ader is unavailable (apache#20271)

This PR applies the same partition leader check for `StreamsGroupCommand` as
`ShareGroupCommand`  and `ConsumerGroupCommand` to avoid the command
execution timeout.

Reviewers: Lucas Brutschy <lucasbru@apache.org>
fvaleri pushed a commit to showuon/kafka that referenced this pull request Jul 20, 2026
* Revert "Merge pull request #161 from showuon/cl3_ut"

This reverts commit 55efc8d, reversing
changes made to 1c8b6d3.

* Revert "Merge pull request #155 from showuon/cl3_share_auto_create"

This reverts commit 05f8874, reversing
changes made to 143e6cc.

* MINOR: Cleanups in Tools Module (3/n) (apache#20332)

This PR aims at cleaning up the tools module further by getting rid of
some extra code which can be replaced by `record`

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>

* MINOR: kafka-stream-groups.sh should fail quickly if the partition leader is unavailable (apache#20271)

This PR applies the same partition leader check for `StreamsGroupCommand` as
`ShareGroupCommand`  and `ConsumerGroupCommand` to avoid the command
execution timeout.

Reviewers: Lucas Brutschy <lucasbru@apache.org>

* KAFKA-19662: Allow resetting offset for unsubscribed topic in kafka-share-groups.sh (apache#20453)

The `kafka-share-groups.sh` tool checks whether a topic already has a
start-offset in the share group when resetting offsets. This is not
necessary. By removing the check, it is possible to set a start offset
for a topic which has not yet but will be subscribed in the future, thus
initialising the consumption point.

There is still a small piece of outstanding work to do with resetting
the offset for a non-existent group which should also create the group.
A subsequent PR will be used to address that.

Reviewers: Jimmy Wang <48462172+JimmyWang6@users.noreply.github.com>,
Lan Ding <isDing_L@163.com>, Apoorv Mittal <apoorvmittal10@gmail.com>

* KAFKA-19662: Reset share group offsets for unsubscribed topics (apache#20708)

This PR allows the kafka-share-groups.sh --reset-offsets tool to be used
to set offsets for topics which are not currently subscribed in a share
group. It also works if the share group does not yet exist. This brings
the capability in line with the equivalent function in
Kafka-consumer-groups.sh. The primary purpose is to allow offsets to be
set before the share group is first used as a way of initialising in a
known state.

Reviewers: Jimmy Wang <48462172+JimmyWang6@users.noreply.github.com>,
 Kuan-Po Tseng <brandboat@gmail.com>, Apoorv Mittal
 <apoorvmittal10@gmail.com>

---------

Co-authored-by: Sanskar Jhajharia <sjhajharia@confluent.io>
Co-authored-by: jimmy <wangzhiwang611@gmail.com>
Co-authored-by: Andrew Schofield <aschofield@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved KIP-1071 PRs related to KIP-1071 small Small PRs tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants