[ 
https://issues.apache.org/jira/browse/ROCKETMQ-249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16175814#comment-16175814
 ] 

ASF GitHub Bot commented on ROCKETMQ-249:
-----------------------------------------

Github user dongeforever commented on a diff in the pull request:

    https://github.com/apache/incubator-rocketmq/pull/133#discussion_r140402195
  
    --- 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 --
    
    It is not safe to use == for float value. In this case, usageRatio < 0 is OK


> Attempt to clear disk even if disk store path is found
> ------------------------------------------------------
>
>                 Key: ROCKETMQ-249
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-249
>             Project: Apache RocketMQ
>          Issue Type: Bug
>            Reporter: Roman Shtykh
>            Assignee: Roman Shtykh
>
> If disk usage estimates fail because the disk store path is not found 
> (doesn't exist), message store falsely decides the disk is full and tries to 
> delete.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to