Repository: kafka Updated Branches: refs/heads/0.9.0 3ded81192 -> 98124930f
TRIVIAL: provide clearer error in describe group when group is inactive Author: Jason Gustafson <[email protected]> Reviewers: Guozhang Wang Closes #502 from hachikuji/trivial-consumer-groups-fix (cherry picked from commit d9a455243e2350a18b5c734f0a6edaeb74ac6698) Signed-off-by: Guozhang Wang <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/98124930 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/98124930 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/98124930 Branch: refs/heads/0.9.0 Commit: 98124930f39ca85fce79e79eaf4ad6687ba14143 Parents: 3ded811 Author: Jason Gustafson <[email protected]> Authored: Thu Nov 12 09:13:51 2015 -0800 Committer: Guozhang Wang <[email protected]> Committed: Thu Nov 12 09:13:58 2015 -0800 ---------------------------------------------------------------------- core/src/main/scala/kafka/admin/AdminClient.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/98124930/core/src/main/scala/kafka/admin/AdminClient.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/kafka/admin/AdminClient.scala b/core/src/main/scala/kafka/admin/AdminClient.scala index 28f3cda..ff1d3fe 100644 --- a/core/src/main/scala/kafka/admin/AdminClient.scala +++ b/core/src/main/scala/kafka/admin/AdminClient.scala @@ -155,8 +155,11 @@ class AdminClient(val time: Time, def describeConsumerGroup(groupId: String): List[ConsumerSummary] = { val group = describeGroup(groupId) + if (group.state == "Dead") + return List.empty[ConsumerSummary] + if (group.protocolType != ConsumerProtocol.PROTOCOL_TYPE) - throw new IllegalArgumentException(s"Group ${groupId} is not a valid kafka consumer group but belongs to ${if (!group.protocolType.isEmpty) group.protocolType else "not exist"}") + throw new IllegalArgumentException(s"Group ${groupId} with protocol type '${group.protocolType}' is not a valid consumer group") group.members.map { case member =>
