Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.apache.rocketmq.remoting.protocol.DataVersion;
import org.apache.rocketmq.remoting.protocol.RemotingSerializable;
import org.apache.rocketmq.remoting.protocol.subscription.SubscriptionGroupConfig;
import org.apache.rocketmq.store.config.BrokerRole;

public class SubscriptionGroupManager extends ConfigManager {
protected static final Logger log = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME);
Expand Down Expand Up @@ -155,11 +156,14 @@ public void updateSubscriptionGroupConfigWithoutPersist(SubscriptionGroupConfig
Map<String, String> newAttributes = request(config);
Map<String, String> currentAttributes = current(config.getGroupName());

Map<String, String> finalAttributes = AttributeUtil.alterCurrentAttributes(
this.subscriptionGroupTable.get(config.getGroupName()) == null,
SubscriptionGroupAttributes.ALL,
ImmutableMap.copyOf(currentAttributes),
ImmutableMap.copyOf(newAttributes));
Map<String, String> finalAttributes = newAttributes;
if (this.brokerController.getMessageStoreConfig().getBrokerRole() != BrokerRole.SLAVE) {
finalAttributes = AttributeUtil.alterCurrentAttributes(
this.subscriptionGroupTable.get(config.getGroupName()) == null,
SubscriptionGroupAttributes.ALL,
ImmutableMap.copyOf(currentAttributes),
ImmutableMap.copyOf(newAttributes));
}

config.setAttributes(finalAttributes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.apache.rocketmq.remoting.protocol.body.TopicConfigAndMappingSerializeWrapper;
import org.apache.rocketmq.remoting.protocol.body.TopicConfigSerializeWrapper;
import org.apache.rocketmq.remoting.protocol.statictopic.TopicQueueMappingInfo;
import org.apache.rocketmq.store.config.BrokerRole;
import org.apache.rocketmq.store.timer.TimerMessageStore;
import org.apache.rocketmq.tieredstore.TieredMessageStore;
import org.apache.rocketmq.tieredstore.metadata.MetadataStore;
Expand Down Expand Up @@ -504,11 +505,14 @@ public void updateSingleTopicConfigWithoutPersist(final TopicConfig topicConfig)
Map<String, String> newAttributes = request(topicConfig);
Map<String, String> currentAttributes = current(topicConfig.getTopicName());

Map<String, String> finalAttributes = AttributeUtil.alterCurrentAttributes(
this.topicConfigTable.get(topicConfig.getTopicName()) == null,
TopicAttributes.ALL,
ImmutableMap.copyOf(currentAttributes),
ImmutableMap.copyOf(newAttributes));
Map<String, String> finalAttributes = newAttributes;
if (this.brokerController.getMessageStoreConfig().getBrokerRole() != BrokerRole.SLAVE) {
finalAttributes = AttributeUtil.alterCurrentAttributes(
this.topicConfigTable.get(topicConfig.getTopicName()) == null,
TopicAttributes.ALL,
ImmutableMap.copyOf(currentAttributes),
ImmutableMap.copyOf(newAttributes));
}

topicConfig.setAttributes(finalAttributes);
updateTieredStoreTopicMetadata(topicConfig, newAttributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public void setUp() throws IOException {
File configStoreDir = tf.newFolder();
messageStoreConfig = new MessageStoreConfig();
messageStoreConfig.setStorePathRootDir(configStoreDir.getAbsolutePath());
Mockito.doReturn(messageStoreConfig).when(controller).getMessageStoreConfig();

configStorage = new ConfigStorage(messageStoreConfig);
configStorage.start();
subscriptionGroupManagerV2 = new SubscriptionGroupManagerV2(controller, configStorage);
Expand Down
Loading