From 311b831c0223c1c9a875a844e869e19b58dae297 Mon Sep 17 00:00:00 2001 From: Zhanhui Li Date: Wed, 6 Nov 2024 10:12:24 +0800 Subject: [PATCH] [ISSUE #8829] Keep data version while reload and XXXConfigManagerV2 turns off sync Signed-off-by: Li Zhanhui --- .../org/apache/rocketmq/broker/config/v2/ConfigStorage.java | 4 ++-- .../rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java | 2 +- .../rocketmq/broker/config/v2/TopicConfigManagerV2.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConfigStorage.java b/broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConfigStorage.java index a31b573daa7..6bc62957a86 100644 --- a/broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConfigStorage.java +++ b/broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConfigStorage.java @@ -87,8 +87,8 @@ protected void initOptions() { protected void initAbleWalWriteOptions() { this.ableWalWriteOptions = new WriteOptions(); - // For metadata, prioritize data integrity - this.ableWalWriteOptions.setSync(true); + // Given that fdatasync is kind of expensive, sync-WAL for every write cannot be afforded. + this.ableWalWriteOptions.setSync(false); // We need WAL for config changes this.ableWalWriteOptions.setDisableWAL(false); diff --git a/broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java b/broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java index f535fa195a9..dea8a2d2c17 100644 --- a/broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java +++ b/broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java @@ -72,7 +72,7 @@ private boolean loadSubscriptions() { while (iterator.isValid()) { SubscriptionGroupConfig subscriptionGroupConfig = parseSubscription(iterator.key(), iterator.value()); if (null != subscriptionGroupConfig) { - super.updateSubscriptionGroupConfigWithoutPersist(subscriptionGroupConfig); + super.putSubscriptionGroupConfig(subscriptionGroupConfig); } iterator.next(); } diff --git a/broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java b/broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java index b1a3d2d85ce..4e36b087275 100644 --- a/broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java +++ b/broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java @@ -76,7 +76,7 @@ private boolean loadTopicConfig() { byte[] value = iterator.value(); TopicConfig topicConfig = parseTopicConfig(key, value); if (null != topicConfig) { - super.updateSingleTopicConfigWithoutPersist(topicConfig); + super.putTopicConfig(topicConfig); } iterator.next(); }