From 91d8ee16a008a6e8a24cd302148407b0dc01f2ec Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 12 Jun 2023 13:59:11 +0800 Subject: [PATCH] [ISSUE #6800] Change the config variable isEnableBatchPush to enableBatchPush (#6801) * fix: wrong setter for config isEnableBatchPush Change-Id: I1ebf4748c26c42efb058c11a8b5084b69213892c * fix: change isEnableBatchPush to enableBatchPush Change-Id: I13db49a30841fe5ff9a548f02afa0cc272ba027d --- .../rocketmq/store/config/MessageStoreConfig.java | 6 +++--- .../rocketmq/store/DefaultMessageStoreTest.java | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) 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 099be93051f..d7b7b8c0873 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 @@ -235,7 +235,7 @@ public class MessageStoreConfig { private String dLegerPeers; private String dLegerSelfId; private String preferredLeaderId; - private boolean isEnableBatchPush = false; + private boolean enableBatchPush = false; private boolean enableScheduleMessageStats = true; @@ -1132,11 +1132,11 @@ public void setPreferredLeaderId(String preferredLeaderId) { } public boolean isEnableBatchPush() { - return isEnableBatchPush; + return enableBatchPush; } public void setEnableBatchPush(boolean enableBatchPush) { - isEnableBatchPush = enableBatchPush; + this.enableBatchPush = enableBatchPush; } public boolean isEnableScheduleMessageStats() { diff --git a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java index 151bfa8f047..12d1e5723c8 100644 --- a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java +++ b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java @@ -37,6 +37,7 @@ import java.util.Map; import java.util.Random; import java.util.UUID; +import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; @@ -48,6 +49,7 @@ import org.apache.rocketmq.common.message.MessageExt; import org.apache.rocketmq.common.message.MessageExtBatch; import org.apache.rocketmq.common.message.MessageExtBrokerInner; +import org.apache.rocketmq.common.MixAll; import org.apache.rocketmq.store.config.BrokerRole; import org.apache.rocketmq.store.config.FlushDiskType; import org.apache.rocketmq.store.config.MessageStoreConfig; @@ -941,6 +943,15 @@ public void testCleanUnusedTopic() { Assert.assertEquals(resultSet, consumeQueueTable.keySet()); } + @Test + public void testChangeStoreConfig() { + Properties properties = new Properties(); + properties.setProperty("enableBatchPush", "true"); + MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); + MixAll.properties2Object(properties, messageStoreConfig); + assertThat(messageStoreConfig.isEnableBatchPush()).isTrue(); + } + private class MyMessageArrivingListener implements MessageArrivingListener { @Override public void arriving(String topic, int queueId, long logicOffset, long tagsCode, long msgStoreTime,