This is an automated email from the ASF dual-hosted git repository.
dajac pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/3.3 by this push:
new 228a2de767a MINOR: Fix
testPreferredReplicaAsLeaderWhenSameRackFollowerIsOutOfIsr (#12982)
228a2de767a is described below
commit 228a2de767a54c145063f7500920dd04cabeb6f1
Author: Calvin Liu <[email protected]>
AuthorDate: Wed Dec 21 00:38:43 2022 -0800
MINOR: Fix testPreferredReplicaAsLeaderWhenSameRackFollowerIsOutOfIsr
(#12982)
Reviewers: David Jacot <[email protected]>
---
.../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 8c66c28103e..d6330eaf78d 100644
--- a/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
+++ b/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
@@ -1324,6 +1324,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")
@@ -1338,7 +1349,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