Browse Source

MINOR: Improve group metadata unknown key version exception message (#7006)

The patch clarifies the exception message for unknown key versions when loading from the group metadata topic. The patch also makes a trivial change in `KafkaAdminClient` to use `Map.computeIfAbsent`. 

Reviewers: Viktor Somogyi <viktorsomogyi@gmail.com>, Jason Gustafson <jason@confluent.io>
pull/6420/merge
Kamal Chandraprakash 5 years ago committed by Jason Gustafson
parent
commit
3750898e20
  1. 7
      clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
  2. 2
      core/src/main/scala/kafka/coordinator/group/GroupMetadataManager.scala

7
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java

@ -273,12 +273,7 @@ public class KafkaAdminClient extends AdminClient {
* @return The list value. * @return The list value.
*/ */
static <K, V> List<V> getOrCreateListValue(Map<K, List<V>> map, K key) { static <K, V> List<V> getOrCreateListValue(Map<K, List<V>> map, K key) {
List<V> list = map.get(key); return map.computeIfAbsent(key, k -> new LinkedList<>());
if (list != null)
return list;
list = new LinkedList<>();
map.put(key, list);
return list;
} }
/** /**

2
core/src/main/scala/kafka/coordinator/group/GroupMetadataManager.scala

@ -1078,7 +1078,7 @@ object GroupMetadataManager {
val schemaOpt = MESSAGE_TYPE_SCHEMAS.get(version) val schemaOpt = MESSAGE_TYPE_SCHEMAS.get(version)
schemaOpt match { schemaOpt match {
case Some(schema) => schema case Some(schema) => schema
case _ => throw new KafkaException("Unknown offset schema version " + version) case _ => throw new KafkaException("Unknown message key schema version " + version)
} }
} }

Loading…
Cancel
Save