ijuma commented on code in PR #18497:
URL: https://github.com/apache/kafka/pull/18497#discussion_r1921866074
##########
core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala:
##########
@@ -4843,53 +4599,39 @@ class ReplicaManagerTest {
try {
val brokerList = Seq[Integer](0, 1).asJava
val topicPartition = new TopicPartition(topic, 0)
- val topicPartitionFoo = new TopicPartition("foo", 0)
val topicPartitionFake = new TopicPartition("fakeTopic", 0)
val topicIds = Map(topic -> Uuid.ZERO_UUID, "foo" ->
Uuid.randomUuid()).asJava
val topicNames = topicIds.asScala.map(_.swap).asJava
- def leaderAndIsrRequest(epoch: Int, name: String, version: Short):
LeaderAndIsrRequest = LeaderAndIsrRequest.parse(
- new LeaderAndIsrRequest.Builder(version, 0, 0, brokerEpoch,
- Seq(new LeaderAndIsrPartitionState()
- .setTopicName(name)
- .setPartitionIndex(0)
- .setControllerEpoch(0)
- .setLeader(0)
- .setLeaderEpoch(epoch)
- .setIsr(brokerList)
- .setPartitionEpoch(0)
- .setReplicas(brokerList)
- .setIsNew(true)).asJava,
- topicIds,
- Set(new Node(0, "host1", 0), new Node(1, "host2",
1)).asJava).build().serialize(), version)
+ def leaderAndIsrRequest(epoch: Int, name: String): LeaderAndIsrRequest =
+ new LeaderAndIsrRequest.Builder(0, 0, brokerEpoch,
+ Seq(new LeaderAndIsrRequest.PartitionState()
+ .setTopicName(name)
+ .setPartitionIndex(0)
+ .setControllerEpoch(0)
+ .setLeader(0)
+ .setLeaderEpoch(epoch)
+ .setIsr(brokerList)
+ .setPartitionEpoch(0)
+ .setReplicas(brokerList)
+ .setIsNew(true)).asJava,
+ topicIds,
+ Set(new Node(0, "host1", 0), new Node(1, "host2", 1)).asJava).build()
// There is no file if the topic does not have an associated topic ID.
- val response = replicaManager.becomeLeaderOrFollower(0,
leaderAndIsrRequest(0, "fakeTopic", ApiKeys.LEADER_AND_ISR.latestVersion), (_,
_) => ())
+ val response = replicaManager.becomeLeaderOrFollower(0,
leaderAndIsrRequest(0, "fakeTopic"), (_, _) => ())
assertTrue(replicaManager.localLog(topicPartitionFake).isDefined)
val log = replicaManager.localLog(topicPartitionFake).get
assertFalse(log.partitionMetadataFile.get.exists())
assertEquals(Errors.NONE,
response.partitionErrors(topicNames).get(topicPartition))
// There is no file if the topic has the default UUID.
- val response2 = replicaManager.becomeLeaderOrFollower(0,
leaderAndIsrRequest(0, topic, ApiKeys.LEADER_AND_ISR.latestVersion), (_, _) =>
())
+ val response2 = replicaManager.becomeLeaderOrFollower(0,
leaderAndIsrRequest(0, topic), (_, _) => ())
assertTrue(replicaManager.localLog(topicPartition).isDefined)
val log2 = replicaManager.localLog(topicPartition).get
assertFalse(log2.partitionMetadataFile.get.exists())
assertEquals(Errors.NONE,
response2.partitionErrors(topicNames).get(topicPartition))
- // There is no file if the request an older version
Review Comment:
These removed lines are no longer relevant.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]