junrao commented on code in PR #23316:
URL: https://github.com/apache/kafka/pull/23316#discussion_r3959013059


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java:
##########
@@ -766,19 +762,17 @@ public Optional<FileRecords.TimestampAndOffset> 
findOffsetByTimestamp(long times
      */
     @Override
     public void close() throws IOException {
-        if (maxTimestampAndOffsetSoFar != TimestampOffset.UNKNOWN)
-            Utils.swallow(LOGGER, Level.WARN, "maybeAppend", () -> 
timeIndex().maybeAppend(maxTimestampSoFar(), 
shallowOffsetOfMaxTimestampSoFar(), true));
         Utils.closeAll(lazyOffsetIndex, lazyTimeIndex, log, txnIndex);
     }
 
     /**
-     * Close file handlers used by the log segment but don't write to disk. 
This is used when the disk may have failed
+     * Close file handlers used by the log segment, swallowing any exceptions. 
This is used when the disk may have failed
      */
     void closeHandlers() {
-        Utils.swallow(LOGGER, Level.WARN, "offsetIndex", 
lazyOffsetIndex::closeHandler);
-        Utils.swallow(LOGGER, Level.WARN, "timeIndex", 
lazyTimeIndex::closeHandler);
-        Utils.swallow(LOGGER, Level.WARN, "log", log::closeHandlers);
-        Utils.closeQuietly(txnIndex, "txnIndex", LOGGER);
+        Utils.swallow(LOGGER, Level.WARN, "offsetIndex", 
lazyOffsetIndex::close);

Review Comment:
   It's probably better to rename closeHandlers to sth like silentClose? Ditto 
for LocalLog.



##########
storage/src/main/java/org/apache/kafka/storage/internals/log/LocalLog.java:
##########
@@ -309,7 +309,7 @@ public void updateLogEndOffset(long endOffset) {
     }
 
     /**
-     * Close file handlers used by log but don't write to disk.
+     * Close file handlers used by log, swallowing any exceptions.

Review Comment:
   isMemoryMappedBufferClosed is now a bit weird. We probably want to rename it 
to sth like isClosed(). Ditto for checkIfMemoryMappedBufferClosed().



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

Reply via email to