Skip to content

KAFKA-20563: Fix flaky ShareConsumerRackAwareTest#22268

Open
AndrewJSchofield wants to merge 1 commit into
apache:trunkfrom
AndrewJSchofield:KAFKA-20563
Open

KAFKA-20563: Fix flaky ShareConsumerRackAwareTest#22268
AndrewJSchofield wants to merge 1 commit into
apache:trunkfrom
AndrewJSchofield:KAFKA-20563

Conversation

@AndrewJSchofield
Copy link
Copy Markdown
Member

@AndrewJSchofield AndrewJSchofield commented May 12, 2026

ShareConsumerRackAwareTest is very slightly flaky. This is caused by the
fact that the assignor it uses is very particular about the combination
of members, assigned partitions and rack IDs. Because the assignment can
be performed at unpredictable points during the test, it is possible
that the set of members is incomplete when the assignment is calculated.
If any of the racks has no members, the assignor throws an exception and
the test then fails.

The PR makes the assignor tolerant of when there are no members for a
rack, just picking a random member to assign.

Reviewers: Sean Quah squah@confluent.io

@AndrewJSchofield AndrewJSchofield requested a review from smjn May 12, 2026 20:00
@github-actions github-actions Bot added tests Test fixes (including flaky tests) clients small Small PRs labels May 12, 2026
@AndrewJSchofield AndrewJSchofield added the KIP-932 Queues for Kafka label May 12, 2026
Comment on lines +84 to +85
// No rack-local member found, which can be transiently true as membership changes. Pick any member for now.
assignedRack = rackIdToMemberId.keySet().iterator().next();
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.

Thanks for deflaking the test!

Is leaving the partition unassigned an option? And would it be less confusing to folks debugging the test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients KIP-932 Queues for Kafka small Small PRs tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants