Repository: kafka Updated Branches: refs/heads/trunk 0e2c90bad -> 0a1689a74
KAFKA-5175; Fix transient failure in ControllerIntegrationTest.testPreferredReplicaLeaderElection The transient failure came from the controller processing the preferred replica leader election before the restarted broker (the preferred replica leader) has joined isr, causing preferred replica leader election to fail and for the final zookeeper state validation to fail. Author: Onur Karaman <[email protected]> Reviewers: Ismael Juma <[email protected]> Closes #3067 from onurkaraman/KAFKA-5175 Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/0a1689a7 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/0a1689a7 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/0a1689a7 Branch: refs/heads/trunk Commit: 0a1689a749392d8de9dfbdc200ad9edce75024a1 Parents: 0e2c90b Author: Onur Karaman <[email protected]> Authored: Tue May 16 10:46:19 2017 +0100 Committer: Ismael Juma <[email protected]> Committed: Tue May 16 10:46:26 2017 +0100 ---------------------------------------------------------------------- .../scala/unit/kafka/controller/ControllerIntegrationTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/0a1689a7/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala ---------------------------------------------------------------------- diff --git a/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala b/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala index ec3a153..1837ba2 100644 --- a/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala +++ b/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala @@ -197,7 +197,7 @@ class ControllerIntegrationTest extends ZooKeeperTestHarness { waitForPartitionState(tp, KafkaController.InitialControllerEpoch, controllerId, LeaderAndIsr.initialLeaderEpoch + 1, "failed to get expected partition state upon broker shutdown") servers(otherBrokerId).startup() - TestUtils.waitUntilTrue(() => servers.forall(_.metadataCache.isBrokerAlive(otherBrokerId)), "broker join was not broadcasted to the cluster") + TestUtils.waitUntilTrue(() => zkUtils.getInSyncReplicasForPartition(tp.topic, tp.partition).toSet == assignment(tp.partition).toSet, "restarted broker failed to join in-sync replicas") zkUtils.createPersistentPath(ZkUtils.PreferredReplicaLeaderElectionPath, ZkUtils.preferredReplicaLeaderElectionZkData(Set(tp))) TestUtils.waitUntilTrue(() => !zkUtils.pathExists(ZkUtils.PreferredReplicaLeaderElectionPath), "failed to remove preferred replica leader election path after completion")
