KAFKA-20111: Handle pre-4.1 brokers in kafka-configs.sh for groups#21385
Open
AndrewJSchofield wants to merge 5 commits intoapache:trunkfrom
Open
KAFKA-20111: Handle pre-4.1 brokers in kafka-configs.sh for groups#21385AndrewJSchofield wants to merge 5 commits intoapache:trunkfrom
AndrewJSchofield wants to merge 5 commits intoapache:trunkfrom
Conversation
chia7712
reviewed
Feb 4, 2026
Member
chia7712
left a comment
There was a problem hiding this comment.
@AndrewJSchofield thanks for this fix
| case GroupType => | ||
| adminClient.listGroups().all.get.asScala.map(_.groupId).toSet ++ | ||
| adminClient.listConfigResources(java.util.Set.of(ConfigResource.Type.GROUP), new ListConfigResourcesOptions).all().get().asScala.map(_.name).toSet | ||
| adminClient.listGroups().all.get.asScala.map(_.groupId).toSet ++ listGroupConfigResources(adminClient).map(resources => resources.asScala.map(_.name).toSet).getOrElse(Set() ++ entityName) |
Member
There was a problem hiding this comment.
entityName is None, so Set() ++ entityName could be replaced by Set.empty
| } | ||
|
|
||
| private def listGroupConfigResources(adminClient: Admin): Option[java.util.Collection[ConfigResource]] = { | ||
| try { |
Member
There was a problem hiding this comment.
try {
Some(adminClient.listConfigResources(java.util.Set.of(ConfigResource.Type.GROUP), new ListConfigResourcesOptions).all.get)
} catch {
// (KIP-1142) 4.1+ admin client vs older broker: treat UnsupportedVersion as None
case e: ExecutionException if e.getCause.isInstanceOf[UnsupportedVersionException] => None
}| public ListConfigResourcesResult listConfigResources(Set<ConfigResource.Type> configResourceTypes, ListConfigResourcesOptions options) { | ||
| ConfigResource.Type type = configResourceTypes.iterator().next(); | ||
| assertEquals(ConfigResource.Type.GROUP, type); | ||
| future.completeExceptionally(new UnsupportedVersionException("The v0 ListConfigResources only supports CLIENT_METRICS")); |
Member
There was a problem hiding this comment.
Should we add a test case for other exceptions to ensure they are propagated correctly and not swallowed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KIP-1142 introduced
Admin.listConfigResources()for listing resourceswhich have configurations, but which may not actually exist as run-time
entities such as consumer groups which have not yet had any members.
Internally, this works by using v1 of the
LIST_CONFIG_RESOURCESRPCwhich is only supported in AK 4.1 and later. As a result, if you try to
describe the config for groups with older brokers, they do not support
v1 of the RPC and fail with
UnsupportedVersionException. This PRhandles the exception in the config tool since the exception is harmless
and gives the same behaviour as we used to get with earlier versions.