From 8e19069c98b7dc366adc551b5c3f448c6722a046 Mon Sep 17 00:00:00 2001 From: Jiang Haiting Date: Thu, 16 Sep 2021 10:55:14 +0800 Subject: [PATCH] fix test error --- .../rocketmq/broker/processor/SendMessageProcessor.java | 2 +- .../java/org/apache/rocketmq/store/MappedFileQueue.java | 6 +++--- .../org/apache/rocketmq/store/MultiPathMappedFileQueue.java | 1 - .../apache/rocketmq/store/config/MessageStoreConfig.java | 3 --- .../apache/rocketmq/store/MultiPathMappedFileQueueTest.java | 2 +- 5 files changed, 5 insertions(+), 9 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 a11fb6cc..9c42c808 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 @@ -637,7 +637,7 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement private String diskUtil() { double physicRatio = -1; - String storePath =this.brokerController.getMessageStoreConfig().getStorePathCommitLog(); + String storePath = this.brokerController.getMessageStoreConfig().getStorePathCommitLog(); if (storePath.contains(MessageStoreConfig.MULTI_PATH_SPLITTER)) { String[] paths = storePath.trim().split(MessageStoreConfig.MULTI_PATH_SPLITTER); for (String storePathPhysic : paths) { diff --git a/store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java b/store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java index be29e6cb..9a531881 100644 --- a/store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java +++ b/store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java @@ -411,7 +411,7 @@ public class MappedFileQueue { destroy = maxOffsetInLogicQueue < offset; if (destroy) { log.info("physic min offset " + offset + ", logics in current mappedFile max offset " - + maxOffsetInLogicQueue + ", delete it"); + + maxOffsetInLogicQueue + ", delete it"); } } else if (!mappedFile.isAvailable()) { // Handle hanged file. log.warn("Found a hanged consume queue file, attempting to delete it."); @@ -479,7 +479,7 @@ public class MappedFileQueue { if (firstMappedFile != null && lastMappedFile != null) { if (offset < firstMappedFile.getFileFromOffset() || offset >= lastMappedFile.getFileFromOffset() + this.mappedFileSize) { LOG_ERROR.warn("Offset not matched. Request offset: {}, firstOffset: {}, lastOffset: {}, mappedFileSize: {}, mappedFiles count: {}", - offset, + offset, firstMappedFile.getFileFromOffset(), lastMappedFile.getFileFromOffset() + this.mappedFileSize, this.mappedFileSize, @@ -493,7 +493,7 @@ public class MappedFileQueue { } if (targetFile != null && offset >= targetFile.getFileFromOffset() - && offset < targetFile.getFileFromOffset() + this.mappedFileSize) { + && offset < targetFile.getFileFromOffset() + this.mappedFileSize) { return targetFile; } diff --git a/store/src/main/java/org/apache/rocketmq/store/MultiPathMappedFileQueue.java b/store/src/main/java/org/apache/rocketmq/store/MultiPathMappedFileQueue.java index d7a41322..a81fc499 100644 --- a/store/src/main/java/org/apache/rocketmq/store/MultiPathMappedFileQueue.java +++ b/store/src/main/java/org/apache/rocketmq/store/MultiPathMappedFileQueue.java @@ -18,7 +18,6 @@ package org.apache.rocketmq.store; import java.util.Arrays; -import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.function.Supplier; diff --git a/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java b/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java index 113fba09..d26577dc 100644 --- a/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java +++ b/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java @@ -17,9 +17,6 @@ package org.apache.rocketmq.store.config; import java.io.File; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; import org.apache.rocketmq.common.annotation.ImportantField; import org.apache.rocketmq.store.ConsumeQueue; diff --git a/store/src/test/java/org/apache/rocketmq/store/MultiPathMappedFileQueueTest.java b/store/src/test/java/org/apache/rocketmq/store/MultiPathMappedFileQueueTest.java index d299df15..628ad2d9 100644 --- a/store/src/test/java/org/apache/rocketmq/store/MultiPathMappedFileQueueTest.java +++ b/store/src/test/java/org/apache/rocketmq/store/MultiPathMappedFileQueueTest.java @@ -73,7 +73,7 @@ public class MultiPathMappedFileQueueTest { mappedFileQueue.load(); - assertThat(mappedFileQueue.mappedFiles.size()).isEqualTo(1025); + assertThat(mappedFileQueue.mappedFiles.size()).isEqualTo(1024); mappedFileQueue.destroy(); } -- GitLab