You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by cm...@apache.org on 2019/03/23 19:14:48 UTC
[kafka] branch trunk updated: MINOR: fix message protocol help text
for ElectPreferredLeadersResult (#6479)
This is an automated email from the ASF dual-hosted git repository.
cmccabe pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new f304667 MINOR: fix message protocol help text for ElectPreferredLeadersResult (#6479)
f304667 is described below
commit f304667df089b9e39850fe401ddfd0c457b1bb67
Author: Colin Patrick McCabe <co...@cmccabe.xyz>
AuthorDate: Sat Mar 23 12:14:35 2019 -0700
MINOR: fix message protocol help text for ElectPreferredLeadersResult (#6479)
Reviewers: Jun Rao <ju...@gmail.com>
---
.../apache/kafka/clients/admin/ElectPreferredLeadersResult.java | 8 +++++---
.../resources/common/message/ElectPreferredLeadersResponse.json | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/ElectPreferredLeadersResult.java b/clients/src/main/java/org/apache/kafka/clients/admin/ElectPreferredLeadersResult.java
index c76336a..963c5f1 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/ElectPreferredLeadersResult.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/ElectPreferredLeadersResult.java
@@ -62,10 +62,12 @@ public class ElectPreferredLeadersResult {
result.completeExceptionally(new UnknownTopicOrPartitionException(
"Preferred leader election for partition \"" + partition +
"\" was not attempted"));
+ } else if (partitions == null && topicPartitions.isEmpty()) {
+ // If partitions is null, we requested information about all partitions. In
+ // that case, if topicPartitions is empty, that indicates a
+ // CLUSTER_AUTHORIZATION_FAILED error.
+ result.completeExceptionally(Errors.CLUSTER_AUTHORIZATION_FAILED.exception());
} else {
- if (partitions == null && topicPartitions.isEmpty()) {
- result.completeExceptionally(Errors.CLUSTER_AUTHORIZATION_FAILED.exception());
- }
ApiException exception = topicPartitions.get(partition).exception();
if (exception == null) {
result.complete(null);
diff --git a/clients/src/main/resources/common/message/ElectPreferredLeadersResponse.json b/clients/src/main/resources/common/message/ElectPreferredLeadersResponse.json
index f34599c..491bd03 100644
--- a/clients/src/main/resources/common/message/ElectPreferredLeadersResponse.json
+++ b/clients/src/main/resources/common/message/ElectPreferredLeadersResponse.json
@@ -22,7 +22,7 @@
{ "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
"about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." },
{ "name": "ReplicaElectionResults", "type": "[]ReplicaElectionResult", "versions": "0+",
- "about": "The error code, or 0 if there was no error.", "fields": [
+ "about": "The election results, or an empty array if the requester did not have permission and the request asks for all partitions.", "fields": [
{ "name": "Topic", "type": "string", "versions": "0+",
"about": "The topic name" },
{ "name": "PartitionResult", "type": "[]PartitionResult", "versions": "0+",
@@ -36,4 +36,4 @@
]}
]}
]
-}
\ No newline at end of file
+}