Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions core/src/main/scala/kafka/raft/KafkaMetadataLog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ final class KafkaMetadataLog private (
if (expiredSnapshots.nonEmpty) {
scheduler.schedule(
"delete-snapshot-files",
KafkaMetadataLog.deleteSnapshotFiles(log.dir.toPath, expiredSnapshots),
KafkaMetadataLog.deleteSnapshotFiles(log.dir.toPath, expiredSnapshots, this),
fileDeleteDelayMs
)
}
Expand Down Expand Up @@ -443,11 +443,12 @@ object KafkaMetadataLog {

private def deleteSnapshotFiles(
logDir: Path,
expiredSnapshots: mutable.TreeMap[OffsetAndEpoch, Option[FileRawSnapshotReader]]
expiredSnapshots: mutable.TreeMap[OffsetAndEpoch, Option[FileRawSnapshotReader]],
logging: Logging
): () => Unit = () => {
expiredSnapshots.foreach { case (snapshotId, snapshotReader) =>
snapshotReader.foreach { reader =>
CoreUtils.swallow(reader.close(), this)
CoreUtils.swallow(reader.close(), logging)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an existing issue. But CoreUtils.swallow() doesn't seem to need logging.

}
Snapshots.deleteIfExists(logDir, snapshotId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void close() {
String.format(
"Unable to close snapshot reader %s at %s",
snapshotId,
fileRecords.file
fileRecords
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to define the toString() method for FileRecords so that it prints well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked. toString is defined for FileRecords. It looks like it has enough information to debug the issue.

),
e
);
Expand Down