yx9o commented on code in PR #11440:
URL: https://github.com/apache/rocketmq/pull/11440#discussion_r4599023265
##########
store/src/main/java/org/apache/rocketmq/store/kv/CompactionLog.java:
##########
@@ -678,8 +680,20 @@ protected void putEndMessage(MappedFileQueue
mappedFileQueue) {
}
}
+ /**
+ * The scratch folders are only cleaned by a round that runs to completion
({@code replaceFiles} followed by
+ * {@code TopicPartitionLog#clean}). A round interrupted in between leaves
its files behind, and the next round
+ * reopens the very same file name at offset 0, so the stale bytes beyond
the new content would be carried into
+ * the live compaction log by {@code replaceFiles}. Start every round from
an empty scratch folder.
+ */
+ protected static void cleanScratchFolder(TopicPartitionLog scratch) {
+ UtilAll.deleteFile(new File(scratch.getLog().getStorePath()));
Review Comment:
`UtilAll.deleteFile()` ignores deletion failures, so a stale scratch segment
can still be reopened and its old tail moved into the live log. Could we abort
the round if either scratch directory cannot be cleared?
--
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]