dhruvilshah3 commented on a change in pull request #10388:
URL: https://github.com/apache/kafka/pull/10388#discussion_r601867171



##########
File path: core/src/main/scala/kafka/log/LogSegment.scala
##########
@@ -322,17 +323,14 @@ class LogSegment private[log] (val log: FileRecords,
      offsetIndex.fetchUpperBoundOffset(startOffsetPosition, 
fetchSize).map(_.offset)
 
   /**
-   * Run recovery on the given segment. This will rebuild the index from the 
log file and lop off any invalid bytes
-   * from the end of the log and index.
+   * Ensure batches in the segment are valid and rebuild all corresponding 
indices.
    *
-   * @param producerStateManager Producer state corresponding to the segment's 
base offset. This is needed to recover
-   *                             the transaction index.
-   * @param leaderEpochCache Optionally a cache for updating the leader epoch 
during recovery.
-   * @return The number of bytes truncated from the log
+   * @param batchCallbackOpt Optional callback invoked for all valid batches 
in segment
+   * @return The number of invalid bytes at the end of the segment
    * @throws LogSegmentOffsetOverflowException if the log segment contains an 
offset that causes the index offset to overflow
    */
   @nonthreadsafe
-  def recover(producerStateManager: ProducerStateManager, leaderEpochCache: 
Option[LeaderEpochFileCache] = None): Int = {
+  def validateSegmentAndRebuildIndices(batchCallbackOpt: 
Option[FileChannelRecordBatch => Unit] = None) : Int = {

Review comment:
       Good catch, I added that.




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


Reply via email to