You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2022/12/21 08:44:28 UTC
[kafka] branch 3.4 updated: MINOR: Fix testPreferredReplicaAsLeaderWhenSameRackFollowerIsOutOfIsr (#12982)
This is an automated email from the ASF dual-hosted git repository.
dajac pushed a commit to branch 3.4
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/3.4 by this push:
new 5c29566bca3 MINOR: Fix testPreferredReplicaAsLeaderWhenSameRackFollowerIsOutOfIsr (#12982)
5c29566bca3 is described below
commit 5c29566bca36c9aaf884c69d8249dbd197cc829f
Author: Calvin Liu <83...@users.noreply.github.com>
AuthorDate: Wed Dec 21 00:38:43 2022 -0800
MINOR: Fix testPreferredReplicaAsLeaderWhenSameRackFollowerIsOutOfIsr (#12982)
Reviewers: David Jacot <dj...@confluent.io>
---
.../test/scala/unit/kafka/server/ReplicaManagerTest.scala | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala b/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
index 3273824ffa4..e623816c397 100644
--- a/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
+++ b/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
@@ -1323,6 +1323,17 @@ class ReplicaManagerTest {
replicaManager.becomeLeaderOrFollower(2, leaderAndIsrRequest, (_, _) => ())
+ appendRecords(replicaManager, tp0, TestUtils.singletonRecords(s"message".getBytes)).onFire { response =>
+ assertEquals(Errors.NONE, response.error)
+ }
+ // Fetch as follower to initialise the log end offset of the replica
+ fetchPartitionAsFollower(
+ replicaManager,
+ new TopicIdPartition(topicId, new TopicPartition(topic, 0)),
+ new PartitionData(Uuid.ZERO_UUID, 0, 0, 100000, Optional.empty()),
+ replicaId = 1
+ )
+
val metadata = new DefaultClientMetadata("rack-b", "client-id",
InetAddress.getByName("localhost"), KafkaPrincipal.ANONYMOUS, "default")
@@ -1337,7 +1348,7 @@ class ReplicaManagerTest {
assertTrue(consumerResult.hasFired)
// PartitionView passed to ReplicaSelector should not contain the follower as it's not in the ISR
- val expectedReplicaViews = Set(new DefaultReplicaView(leaderNode, 0, 0))
+ val expectedReplicaViews = Set(new DefaultReplicaView(leaderNode, 1, 0))
val partitionView = replicaManager.replicaSelectorOpt.get
.asInstanceOf[MockReplicaSelector].getPartitionViewArgument