dajac commented on code in PR #18666:
URL: https://github.com/apache/kafka/pull/18666#discussion_r1925424095


##########
core/src/test/scala/kafka/server/LocalLeaderEndPointTest.scala:
##########
@@ -106,12 +125,11 @@ class LocalLeaderEndPointTest extends Logging {
       .onFire(response => assertEquals(Errors.NONE, response.error))
     assertEquals(new OffsetAndEpoch(0L, 0), 
endPoint.fetchEarliestOffset(topicPartition, currentLeaderEpoch = 0))
 
-    val leaderAndIsrRequest = buildLeaderAndIsrRequest(leaderEpoch = 4)
-    replicaManager.becomeLeaderOrFollower(0, leaderAndIsrRequest, (_, _) => ())
+    bumpLeaderEpoch()
     appendRecords(replicaManager, topicPartition, records)
       .onFire(response => assertEquals(Errors.NONE, response.error))
     replicaManager.deleteRecords(timeout = 1000L, Map(topicPartition -> 3), _ 
=> ())
-    assertEquals(new OffsetAndEpoch(3L, 4), 
endPoint.fetchEarliestOffset(topicPartition, currentLeaderEpoch = 7))
+    assertEquals(new OffsetAndEpoch(3L, 1), 
endPoint.fetchEarliestOffset(topicPartition, currentLeaderEpoch = 7))

Review Comment:
   Correct. We cannot set the leader epoch explicitly with kraft. The leader 
epoch is bumped when a partition change record with a leader different than -1 
is replayed. In one of the test, I dump it twice because it was required to 
have a hole. For the others, I figured that using 1 seems to achieve the same 
goal. 



-- 
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

Reply via email to