RocketMQ报错提示logics disk maybe full soon, so reclaim space, -1.0

异常信息:

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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值