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/10/10 23:19:02 UTC
[kafka] branch 2.4 updated: MINOR:
ListPartitionReassignmentsResponse should not be entirely failed when a
topic-partition does not exist (#7486)
This is an automated email from the ASF dual-hosted git repository.
cmccabe pushed a commit to branch 2.4
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/2.4 by this push:
new 2f01a43 MINOR: ListPartitionReassignmentsResponse should not be entirely failed when a topic-partition does not exist (#7486)
2f01a43 is described below
commit 2f01a43575dc3f5a6250547382c5bb090a295d0f
Author: David Jacot <dj...@confluent.io>
AuthorDate: Fri Oct 11 00:12:14 2019 +0200
MINOR: ListPartitionReassignmentsResponse should not be entirely failed when a topic-partition does not exist (#7486)
Reviewers: Colin P. McCabe <cm...@apache.org>
(cherry picked from commit fa2a9f09e4042f821d7373e2d9e01b21aede775a)
---
core/src/main/scala/kafka/controller/KafkaController.scala | 5 +----
.../integration/kafka/api/AdminClientIntegrationTest.scala | 14 ++++++++++++++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/core/src/main/scala/kafka/controller/KafkaController.scala b/core/src/main/scala/kafka/controller/KafkaController.scala
index e4679d3..91c4534 100644
--- a/core/src/main/scala/kafka/controller/KafkaController.scala
+++ b/core/src/main/scala/kafka/controller/KafkaController.scala
@@ -1821,10 +1821,7 @@ class KafkaController(val config: KafkaConfig,
partitionsToList.foreach { tp =>
val assignment = controllerContext.partitionFullReplicaAssignment(tp)
- if (assignment.replicas.isEmpty) {
- callback(Right(new ApiError(Errors.UNKNOWN_TOPIC_OR_PARTITION)))
- return
- } else if (assignment.isBeingReassigned) {
+ if (assignment.isBeingReassigned) {
results += tp -> assignment
}
}
diff --git a/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala b/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
index c419436..f2e7af6 100644
--- a/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
+++ b/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
@@ -1820,6 +1820,20 @@ class AdminClientIntegrationTest extends IntegrationTestHarness with Logging {
}
@Test
+ def testListReassignmentsDoesNotShowDeletedPartitions(): Unit = {
+ client = AdminClient.create(createConfig())
+
+ val topic = "list-reassignments-no-reassignments"
+ val tp = new TopicPartition(topic, 0)
+
+ val reassignmentsMap = client.listPartitionReassignments(Set(tp).asJava).reassignments().get()
+ assertEquals(0, reassignmentsMap.size())
+
+ val allReassignmentsMap = client.listPartitionReassignments().reassignments().get()
+ assertEquals(0, allReassignmentsMap.size())
+ }
+
+ @Test
def testValidIncrementalAlterConfigs(): Unit = {
client = AdminClient.create(createConfig)