Skip to content

MINOR: Share group tidying#21711

Merged
AndrewJSchofield merged 2 commits intoapache:trunkfrom
AndrewJSchofield:MINOR-share-fix
Mar 13, 2026
Merged

MINOR: Share group tidying#21711
AndrewJSchofield merged 2 commits intoapache:trunkfrom
AndrewJSchofield:MINOR-share-fix

Conversation

@AndrewJSchofield
Copy link
Copy Markdown
Member

@AndrewJSchofield AndrewJSchofield commented Mar 11, 2026

Minor tidying up of share group code, mainly fixing compiler warnings.
Also fixed three flaky tests, all of which were failing occasionally
because of impatience.

Reviewers: Manikumar Reddy manikumar.reddy@gmail.com

Copy link
Copy Markdown
Contributor

@omkreddy omkreddy left a comment

Choose a reason for hiding this comment

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

LGTM

@AndrewJSchofield
Copy link
Copy Markdown
Member Author

I'll do a follow-on PR to tidy up ShareConsumerTest a bit. There's some duplication of logic.

@AndrewJSchofield AndrewJSchofield merged commit 84d4f35 into apache:trunk Mar 13, 2026
24 checks passed
@AndrewJSchofield AndrewJSchofield deleted the MINOR-share-fix branch March 13, 2026 12:20
DL1231 pushed a commit to DL1231/kafka that referenced this pull request Mar 15, 2026
Minor tidying up of share group code, mainly fixing compiler warnings.
Also fixed three flaky tests, all of which were failing occasionally
because of impatience.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
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.

@AndrewJSchofield @omkreddy Sorry for the late noise! Left some minor comments for better decoration 😄

Config config = adminClient.describeConfigs(List.of(groupConfigResource)).all().get().get(groupConfigResource);
ConfigEntry entry = config.get(GroupConfig.SHARE_DELIVERY_COUNT_LIMIT_CONFIG);
return entry != null && entry.value().equals(newValue);
} catch (Exception e) {
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.

nit: We don't need to catch the exception here, as TestUtils.waitForCondition already handle it

private void alterShareDeliveryCountLimit(String groupId, String newValue) {
alterShareGroupConfig(groupId, GroupConfig.SHARE_DELIVERY_COUNT_LIMIT_CONFIG, newValue);

// This config is changed dynamically in tests, and we need it to have propagated before the test proceeds.
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.

Should we add this wait to alterShareGroupConfig so that all dynamic updates can benefit from it?

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.

Yes, I have this on my to-do list.

acquireAndEnsureOpen();
try {
return Collections.unmodifiableSet(subscriptions.subscription());
return Set.copyOf(subscriptions.subscription());
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.

Should we apply this change to AsyncKafkaConsumer#subscription for the sake of consistency?

@Override
public Map<MetricName, ? extends Metric> metrics() {
return Collections.unmodifiableMap(metrics.metrics());
return Map.copyOf(metrics.metrics());
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.

unlike subscription, which is always a snapshot of the current state, metrics.metrics() returns the underlying collection. This change would shift the returned metrics from a live view to a static snapshot. While this behavior is currently undocumented, it would be good to align it with other client components for the consistency

AndrewJSchofield added a commit that referenced this pull request Mar 20, 2026
Resolves a couple of review comments from
#21711. The remaining comments are
in `ShareConsumerTest` and will be addressed separately.

Reviewers: Lianet Magrans <lmagrans@confluent.io>, Viktor Somogyi-Vass
 <viktorsomogyi@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
chia7712 pushed a commit that referenced this pull request Mar 20, 2026
Resolves a couple of review comments from
#21711. The remaining comments are
in `ShareConsumerTest` and will be addressed separately.

Reviewers: Lianet Magrans <lmagrans@confluent.io>, Viktor Somogyi-Vass
 <viktorsomogyi@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants