提交 9b0e31e4 编写于 作者: J Jiang Haiting

1. fix initial value of physicRatio in...

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
上级 8e19069c
...@@ -636,7 +636,7 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement ...@@ -636,7 +636,7 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
} }
private String diskUtil() { private String diskUtil() {
double physicRatio = -1; double physicRatio = 100;
String storePath = this.brokerController.getMessageStoreConfig().getStorePathCommitLog(); String storePath = this.brokerController.getMessageStoreConfig().getStorePathCommitLog();
if (storePath.contains(MessageStoreConfig.MULTI_PATH_SPLITTER)) { if (storePath.contains(MessageStoreConfig.MULTI_PATH_SPLITTER)) {
String[] paths = storePath.trim().split(MessageStoreConfig.MULTI_PATH_SPLITTER); String[] paths = storePath.trim().split(MessageStoreConfig.MULTI_PATH_SPLITTER);
......
...@@ -785,14 +785,14 @@ public class DefaultMessageStore implements MessageStore { ...@@ -785,14 +785,14 @@ public class DefaultMessageStore implements MessageStore {
String commitLogStorePath = DefaultMessageStore.this.getMessageStoreConfig().getStorePathCommitLog(); String commitLogStorePath = DefaultMessageStore.this.getMessageStoreConfig().getStorePathCommitLog();
if (commitLogStorePath.contains(MessageStoreConfig.MULTI_PATH_SPLITTER)) { 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); String[] paths = commitLogStorePath.trim().split(MessageStoreConfig.MULTI_PATH_SPLITTER);
for (String clPath : paths) { for (String clPath : paths) {
double physicRatio = UtilAll.getDiskPartitionSpaceUsedPercent(clPath); double physicRatio = UtilAll.getDiskPartitionSpaceUsedPercent(clPath);
result.put(RunningStats.commitLogDiskRatio.name() + "_" + clPath, String.valueOf(physicRatio)); 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 { } else {
String storePathPhysic = DefaultMessageStore.this.getMessageStoreConfig().getStorePathCommitLog(); String storePathPhysic = DefaultMessageStore.this.getMessageStoreConfig().getStorePathCommitLog();
double physicRatio = UtilAll.getDiskPartitionSpaceUsedPercent(storePathPhysic); double physicRatio = UtilAll.getDiskPartitionSpaceUsedPercent(storePathPhysic);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册