Github user shroman commented on a diff in the pull request: https://github.com/apache/incubator-rocketmq/pull/133#discussion_r140425575 --- Diff: store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java --- @@ -1509,65 +1514,62 @@ private boolean isTimeToDelete() { return false; } - private boolean isSpaceToDelete() { - double ratio = DefaultMessageStore.this.getMessageStoreConfig().getDiskMaxUsedSpaceRatio() / 100.0; + double getDiskUsageRatio() { + return UtilAll.getDiskPartitionSpaceUsedPercent( + DefaultMessageStore.this.getMessageStoreConfig().getStorePathCommitLog()); + } - cleanImmediately = false; + double getQueueSpace() { + return UtilAll.getDiskPartitionSpaceUsedPercent(StorePathConfigHelper + .getStorePathConsumeQueue(DefaultMessageStore.this.getMessageStoreConfig().getStorePathRootDir())); + } - { - String storePathPhysic = DefaultMessageStore.this.getMessageStoreConfig().getStorePathCommitLog(); - double physicRatio = UtilAll.getDiskPartitionSpaceUsedPercent(storePathPhysic); - if (physicRatio > diskSpaceWarningLevelRatio) { - boolean diskok = DefaultMessageStore.this.runningFlags.getAndMakeDiskFull(); - if (diskok) { - DefaultMessageStore.log.error("physic disk maybe full soon " + physicRatio + ", so mark disk full"); - } + /** + * Checks if cleaning on the disk is needed. + * + * @param usageRatio Usage ratio. + * @param allowedRatio Allowed ratio. + * @return <code>True</code> if cleaning is needed, otherwise <code>false</code>. + */ + private boolean needCleaning(double usageRatio, double allowedRatio) { + if (usageRatio == -1) --- End diff -- Thanks, fixed.
---