mimaison commented on code in PR #23316:
URL: https://github.com/apache/kafka/pull/23316#discussion_r3960467991
##########
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:
Thanks. I've used `closeQuietly()` as it's already a name we use in other
places.
--
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]