Skip to content

KAFKA-20409: Don't expose internal group configs unless they are user-defined#22302

Merged
squah-confluent merged 2 commits into
apache:trunkfrom
majialoong:KAFKA-20409
May 21, 2026
Merged

KAFKA-20409: Don't expose internal group configs unless they are user-defined#22302
squah-confluent merged 2 commits into
apache:trunkfrom
majialoong:KAFKA-20409

Conversation

@majialoong
Copy link
Copy Markdown
Contributor

@majialoong majialoong commented May 17, 2026

Previously, internal group configs with a broker-level synonym were
always included in the group config map, exposing them even when the
user had never explicitly set them. This change skips such configs
unless the user has configured them either via the broker synonym or
directly at the group level.

Reviewers: Sean Quah squah@confluent.io

@github-actions github-actions Bot added triage PRs from the community core Kafka Broker group-coordinator small Small PRs labels May 17, 2026
@majialoong
Copy link
Copy Markdown
Contributor Author

This PR resolves the issue discussed here: #21926.

Apologies for the delay in getting this done!

@chia7712 @dajac @squah-confluent Could you please take a look and review it when you have a moment? Thanks!

Copy link
Copy Markdown
Contributor

@squah-confluent squah-confluent 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 addressing the bug!

@@ -634,8 +634,14 @@ public Long logRetentionTimeMillis() {

public Map<String, Object> extractGroupConfigMap() {
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.

Since the method no longer returns the full broker contribution to group configs, could we add a javadoc for this method explaining that it's only suitable for use by DescribeConfigs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, updated!

}

@Test
public void testInternalConfigWithDefaultSynonymIsSkipped() {
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.

Can we make it clear that these new methods test extractGroupConfigMap through the naming?

testExtractGroupConfigMapExcludesInternalConfigWithUnconfiguredBrokerSynonym?

}

@Test
public void testInternalConfigWithSetSynonymIsIncluded() {
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.

testExtractGroupConfigMapIncludesInternalConfigWithConfiguredBrokerSynonym?

}

@Test
public void testNonInternalConfigIsIncluded() {
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.

testExtractGroupConfigMapIncludesNonInternalConfig?

assertEquals("default-value", config.get(TEST_INTERNAL_GROUP_CONFIG));
}

private static Map<String, Object> mockInternalGroupConfigMap(Map<String, Object> overrides, boolean isInternal) {
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.

It wasn't clear to me that mockInternalGroupConfigMap returned the extracted group config. Perhaps we can rename it.

Suggested change
private static Map<String, Object> mockInternalGroupConfigMap(Map<String, Object> overrides, boolean isInternal) {
private static Map<String, Object> extractGroupConfigMap(Map<String, Object> brokerProps, boolean isInternal) {

@majialoong
Copy link
Copy Markdown
Contributor Author

Thanks for the review and suggestions, @squah-confluent ! I've made the updates. Please take another look when you have a chance.

@github-actions github-actions Bot removed the triage PRs from the community label May 19, 2026
Copy link
Copy Markdown
Contributor

@squah-confluent squah-confluent 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 updates!

@squah-confluent squah-confluent merged commit a7dfb89 into apache:trunk May 21, 2026
23 checks passed
JiayaoS pushed a commit to JiayaoS/kafka that referenced this pull request May 21, 2026
…-defined (apache#22302)

Previously, `internal group configs` with a `broker-level synonym` were
always included in the group config map, exposing them even when the
user had never explicitly set them. This change skips such configs
unless the user has configured them either via the broker synonym or
directly at the group level.

Reviewers: Sean Quah <squah@confluent.io>

AbstractKafkaConfig kafkaConfig = new AbstractKafkaConfig(configDef, new HashMap<>(brokerProps), Map.of(), false) {
@Override
public void addReconfigurable(Reconfigurable reconfigurable) { }
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.

@majialoong It seems the current abstraction is a bit suboptimal and forces unnecessary dummy implementation in tests. would you mind providing empty implementation for these two methods to clean up the codebase

@majialoong majialoong deleted the KAFKA-20409 branch May 23, 2026 07:33
chia7712 pushed a commit that referenced this pull request May 24, 2026
…d removeReconfigurable in AbstractKafkaConfig (#22342)

Ref: #22302 (comment).
Convert `addReconfigurable` and `removeReconfigurable` from abstract to
default no-op methods so tests no longer need to supply dummy overrides.

Reviewers: Ken Huang <s7133700@gmail.com>, Murali Basani
 <muralidhar.basani@aiven.io>, Chia-Ping Tsai <chia7712@gmail.com>
nileshkumar3 pushed a commit to nileshkumar3/kafka that referenced this pull request May 25, 2026
…d removeReconfigurable in AbstractKafkaConfig (apache#22342)

Ref: apache#22302 (comment).
Convert `addReconfigurable` and `removeReconfigurable` from abstract to
default no-op methods so tests no longer need to supply dummy overrides.

Reviewers: Ken Huang <s7133700@gmail.com>, Murali Basani
 <muralidhar.basani@aiven.io>, Chia-Ping Tsai <chia7712@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants