You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "lizhimins (via GitHub)" <gi...@apache.org> on 2023/06/15 05:49:07 UTC
[GitHub] [rocketmq] lizhimins commented on a diff in pull request #6903: [ISSUE #6904] fix fail to start broker if mapped file size is 0
lizhimins commented on code in PR #6903:
URL: https://github.com/apache/rocketmq/pull/6903#discussion_r1230464345
##########
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:
We should investigate why there are files with a length of 0. Is it caused by pre-allocation or file switching?
If any file has a length of zero, it can be considered as damaged, Not only the last one.
--
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-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org