tang7526 commented on a change in pull request #10534: URL: https://github.com/apache/kafka/pull/10534#discussion_r637506676
########## File path: core/src/main/scala/kafka/log/LogSegment.scala ########## @@ -162,15 +162,43 @@ class LogSegment private[log] (val log: FileRecords, // append the messages val appendedBytes = log.append(records) trace(s"Appended $appendedBytes to ${log.file} at end offset $largestOffset") + + + def appendIndex(): Unit = { + var validBytes = 0 + var maxTimestampSoFarTmp = RecordBatch.NO_TIMESTAMP + var offsetOfMaxTimestampSoFarTmp = 0L + var lastIndexEntry = 0 + val originalLastOffset = offsetIndex.lastOffset + + for (batch <- log.batches.asScala) { + batch.ensureValid() + ensureOffsetInRange(batch.lastOffset) + + if (batch.maxTimestamp > maxTimestampSoFarTmp) { Review comment: You mean remove line 178? -- 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