yuz10 commented on code in PR #6903:
URL: https://github.com/apache/rocketmq/pull/6903#discussion_r1232276196


##########
store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:
##########
@@ -247,11 +247,18 @@ public boolean doLoad(List<File> files) {
         // ascending order
         files.sort(Comparator.comparing(File::getName));
 
-        for (File file : files) {
+        for (int i = 0; i < files.size(); i++) {
+            File file = files.get(i);
             if (file.isDirectory()) {
                 continue;
             }
 
+            if (file.length() == 0 && i == files.size() - 1) {

Review Comment:
   The file is empty because broker exits after file created and before mmap, 
new RandomAccessFile will create an empty file.
   
   
![image](https://github.com/apache/rocketmq/assets/14816818/064d1053-eeea-496e-a5c7-da0fe7a722f6)
   



-- 
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: commits-unsubscr...@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to