异常信息:
disk space will be full soon, but delete file failed.
logics disk maybe full soon, so reclaim space, -1.0
begin to delete before 72 hours file. timeup: false spacefull: true manualDeleteFileSeveralTimes: 0 cleanAtOnce: false
注意:这个问题并不是说明磁盘空间不够,而是因为可能在检验中出现异常。
核心代码
参看RocketMQ源码:UtilAll、DefaultMessageStore
public static double getDiskPartitionSpaceUsedPercent(final String path) {
if (null == path || path.isEmpty()) {
log.error("Error when measuring disk space usage, path is null or empty, path : {}", path);
return -1;
}
try {
File file = new File(path);
if (!file.exists()) {
log.error("Error when measuring disk space usage, file doesn't exist on this path: {}", path);
return -1;
}
long totalSpace = file.getTotalSpace();
if (totalSpace > 0) {
long freeSpace = file.getFreeSpace();
long usedSpace = totalSpace - freeSpace;
return usedSpace / (double) totalSpace;
}
} catch (Exception e) {
log.error("Error when measuring disk space usage, got exception: :", e); return -1;
}
return -1;
}
解释:so reclaim space, -1.0,这里的-1是在上面方法校验中返回的,有如下异常情况可能:
- commitlog、consumequeue的变量不存在或者为空、或者consumequeue、commitlog文件实际不存在
- 或者在磁盘校验比对空间剩余大小出现异常情况
- 或者totalSpace计算出来<0的异常情况
正常是返回目前磁盘剩余空间的比例
参考:http://www.lpnote.com/2019/01/04/solve-a-disk-warning-illusion-caused-by-rocketmq/