chia7712 commented on code in PR #19924: URL: https://github.com/apache/kafka/pull/19924#discussion_r2134799824
########## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ########## @@ -4155,23 +4147,7 @@ class ReplicaManagerTest { try { val offsetCheckpoints = new LazyOffsetCheckpoints(replicaManager.highWatermarkCheckpoints.asJava) replicaManager.createPartition(tp0).createLogIfNotExists(isNew = false, isFutureReplica = false, offsetCheckpoints, None) - val partition0Replicas = Seq[Integer](0, 1).asJava val topicIds = Map(tp0.topic -> topicId).asJava Review Comment: Could you please remove this local variable and use class variable `topicIds` instead? ########## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ########## @@ -451,20 +451,21 @@ class ReplicaManagerTest { partition.createLogIfNotExists(isNew = false, isFutureReplica = false, new LazyOffsetCheckpoints(rm.highWatermarkCheckpoints.asJava), None) // Make this replica the leader. - val leaderAndIsrRequest1 = new LeaderAndIsrRequest.Builder(0, 0, brokerEpoch, - Seq(new LeaderAndIsrRequest.PartitionState() - .setTopicName(topic) - .setPartitionIndex(0) - .setControllerEpoch(0) - .setLeader(0) - .setLeaderEpoch(0) - .setIsr(brokerList) - .setPartitionEpoch(0) - .setReplicas(brokerList) - .setIsNew(false)).asJava, - topicIds, - Set(new Node(0, "host1", 0), new Node(1, "host2", 1)).asJava).build() - rm.becomeLeaderOrFollower(0, leaderAndIsrRequest1, (_, _) => ()) + val delta = new TopicsDelta(TopicsImage.EMPTY) + delta.replay(new TopicRecord().setName(topic).setTopicId(topicIds.get(topic))) + val record = new PartitionRecord() + .setPartitionId(0) + .setTopicId(topicIds.get(topic)) + .setReplicas(brokerList) + .setIsr(brokerList) + .setRemovingReplicas(util.List.of()) Review Comment: this is a redundant assignment, right? ########## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ########## @@ -474,20 +475,21 @@ class ReplicaManagerTest { } // Make this replica the follower - val leaderAndIsrRequest2 = new LeaderAndIsrRequest.Builder(0, 0, brokerEpoch, - Seq(new LeaderAndIsrRequest.PartitionState() - .setTopicName(topic) - .setPartitionIndex(0) - .setControllerEpoch(0) - .setLeader(1) - .setLeaderEpoch(1) - .setIsr(brokerList) - .setPartitionEpoch(0) - .setReplicas(brokerList) - .setIsNew(false)).asJava, - topicIds, - Set(new Node(0, "host1", 0), new Node(1, "host2", 1)).asJava).build() - rm.becomeLeaderOrFollower(1, leaderAndIsrRequest2, (_, _) => ()) + val delta1 = new TopicsDelta(TopicsImage.EMPTY) + delta1.replay(new TopicRecord().setName(topic).setTopicId(topicIds.get(topic))) + val record1 = new PartitionRecord() + .setPartitionId(0) + .setTopicId(topicIds.get(topic)) + .setReplicas(brokerList) + .setIsr(brokerList) + .setRemovingReplicas(util.List.of()) Review Comment: ditto -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org