From 9b0e31e4692a92cb6998f8b7c1454e216e73734c Mon Sep 17 00:00:00 2001 From: Jiang Haiting Date: Thu, 16 Sep 2021 11:04:25 +0800 Subject: [PATCH] 1. fix initial value of physicRatio in org.apache.rocketmq.broker.processor.SendMessageProcessor#diskUtil 2. use minPhysicsUsedRatio instead of max in org.apache.rocketmq.store.DefaultMessageStore#getRuntimeInfo --- .../rocketmq/broker/processor/SendMessageProcessor.java | 2 +- .../java/org/apache/rocketmq/store/DefaultMessageStore.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java b/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java index 9c42c808..1c7f860b 100644 --- a/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java +++ b/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java @@ -636,7 +636,7 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement } private String diskUtil() { - double physicRatio = -1; + double physicRatio = 100; String storePath = this.brokerController.getMessageStoreConfig().getStorePathCommitLog(); if (storePath.contains(MessageStoreConfig.MULTI_PATH_SPLITTER)) { String[] paths = storePath.trim().split(MessageStoreConfig.MULTI_PATH_SPLITTER); diff --git a/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java b/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java index 942c10b7..0af4c3c0 100644 --- a/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java +++ b/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java @@ -785,14 +785,14 @@ public class DefaultMessageStore implements MessageStore { String commitLogStorePath = DefaultMessageStore.this.getMessageStoreConfig().getStorePathCommitLog(); if (commitLogStorePath.contains(MessageStoreConfig.MULTI_PATH_SPLITTER)) { - double maxValue = Double.MIN_VALUE; + double minPhysicsUsedRatio = Double.MAX_VALUE; String[] paths = commitLogStorePath.trim().split(MessageStoreConfig.MULTI_PATH_SPLITTER); for (String clPath : paths) { double physicRatio = UtilAll.getDiskPartitionSpaceUsedPercent(clPath); result.put(RunningStats.commitLogDiskRatio.name() + "_" + clPath, String.valueOf(physicRatio)); - maxValue = Math.max(maxValue, physicRatio); + minPhysicsUsedRatio = Math.min(minPhysicsUsedRatio, physicRatio); } - result.put(RunningStats.commitLogDiskRatio.name(), String.valueOf(maxValue)); + result.put(RunningStats.commitLogDiskRatio.name(), String.valueOf(minPhysicsUsedRatio)); } else { String storePathPhysic = DefaultMessageStore.this.getMessageStoreConfig().getStorePathCommitLog(); double physicRatio = UtilAll.getDiskPartitionSpaceUsedPercent(storePathPhysic); -- GitLab