dajac commented on a change in pull request #8672: URL: https://github.com/apache/kafka/pull/8672#discussion_r453642510
########## File path: core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala ########## @@ -2058,13 +2070,37 @@ class ReplicaManagerTest { val partition = replicaManager.createPartition(tp0) partition.createLogIfNotExists(isNew = false, isFutureReplica = false, offsetCheckpoints) + val logDirFailureChannel = new LogDirFailureChannel(replicaManager.config.logDirs.size) + val logDir = partition.log.get.parentDirFile + + def readRecoveryPointCheckpoint(): Map[TopicPartition, Long] = { + new OffsetCheckpointFile(new File(logDir, LogManager.RecoveryPointCheckpointFile), + logDirFailureChannel).read() + } + + def readLogStartOffsetCheckpoint(): Map[TopicPartition, Long] = { + new OffsetCheckpointFile(new File(logDir, LogManager.LogStartOffsetCheckpointFile), + logDirFailureChannel).read() + } + val becomeLeaderRequest = new LeaderAndIsrRequest.Builder(ApiKeys.LEADER_AND_ISR.latestVersion, 0, 0, brokerEpoch, Seq(leaderAndIsrPartitionState(tp0, 1, 0, Seq(0, 1), true)).asJava, Set(new Node(0, "host1", 0), new Node(1, "host2", 1)).asJava ).build() replicaManager.becomeLeaderOrFollower(1, becomeLeaderRequest, (_, _) => ()) + val batch = TestUtils.records(records = List( + new SimpleRecord(10, "k1".getBytes, "v1".getBytes), + new SimpleRecord(11, "k2".getBytes, "v2".getBytes))) + partition.appendRecordsToLeader(batch, AppendOrigin.Client, requiredAcks = 0) + partition.log.get.updateHighWatermark(2L) + partition.log.get.maybeIncrementLogStartOffset(1L, LeaderOffsetIncremented) + replicaManager.logManager.checkpointLogRecoveryOffsets() + replicaManager.logManager.checkpointLogStartOffsets() + assertTrue(readRecoveryPointCheckpoint().contains(tp0)) + assertTrue(readLogStartOffsetCheckpoint().contains(tp0)) Review comment: Sure. ########## File path: core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala ########## @@ -2058,13 +2070,37 @@ class ReplicaManagerTest { val partition = replicaManager.createPartition(tp0) partition.createLogIfNotExists(isNew = false, isFutureReplica = false, offsetCheckpoints) + val logDirFailureChannel = new LogDirFailureChannel(replicaManager.config.logDirs.size) + val logDir = partition.log.get.parentDirFile + + def readRecoveryPointCheckpoint(): Map[TopicPartition, Long] = { + new OffsetCheckpointFile(new File(logDir, LogManager.RecoveryPointCheckpointFile), + logDirFailureChannel).read() + } + + def readLogStartOffsetCheckpoint(): Map[TopicPartition, Long] = { + new OffsetCheckpointFile(new File(logDir, LogManager.LogStartOffsetCheckpointFile), + logDirFailureChannel).read() + } + val becomeLeaderRequest = new LeaderAndIsrRequest.Builder(ApiKeys.LEADER_AND_ISR.latestVersion, 0, 0, brokerEpoch, Seq(leaderAndIsrPartitionState(tp0, 1, 0, Seq(0, 1), true)).asJava, Set(new Node(0, "host1", 0), new Node(1, "host2", 1)).asJava ).build() replicaManager.becomeLeaderOrFollower(1, becomeLeaderRequest, (_, _) => ()) + val batch = TestUtils.records(records = List( + new SimpleRecord(10, "k1".getBytes, "v1".getBytes), + new SimpleRecord(11, "k2".getBytes, "v2".getBytes))) + partition.appendRecordsToLeader(batch, AppendOrigin.Client, requiredAcks = 0) + partition.log.get.updateHighWatermark(2L) + partition.log.get.maybeIncrementLogStartOffset(1L, LeaderOffsetIncremented) + replicaManager.logManager.checkpointLogRecoveryOffsets() + replicaManager.logManager.checkpointLogStartOffsets() + assertTrue(readRecoveryPointCheckpoint().contains(tp0)) Review comment: Sure. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org