You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/05/27 04:03:54 UTC
[GitHub] [rocketmq] vongosling commented on a change in pull request #1985: [ISSUE 1976] system topic should not be create or delete by user
vongosling commented on a change in pull request #1985:
URL: https://github.com/apache/rocketmq/pull/1985#discussion_r430128884
##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
##########
@@ -285,7 +273,19 @@ private synchronized RemotingCommand updateAndCreateTopic(ChannelHandlerContext
this.brokerController.registerIncrementBrokerData(topicConfig, this.brokerController.getTopicConfigManager().getDataVersion());
- return null;
+ response.setCode(ResponseCode.SUCCESS);
+ return response;
+ }
+
+ private boolean isSystemTopic(RemotingCommand response, String topic) {
+ if (this.brokerController.getTopicConfigManager().isSystemTopic(topic)) {
+ String errorMsg = "The topic[" + topic + "] is conflict with system reserved words.";
Review comment:
String errorMsg = "The topic[" + topic + "] is conflict with system reserved words.";
The reminder info(reserved words should update system topic )is not uniform with your modification.
##########
File path: broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java
##########
@@ -124,6 +124,14 @@ public TopicConfigManager(BrokerController brokerController) {
topicConfig.setWriteQueueNums(1);
this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig);
}
+ {
+ String topic = MixAll.SCHEDULE_TOPIC;
+ TopicConfig topicConfig = new TopicConfig(topic);
+ this.systemTopicList.add(topic);
+ topicConfig.setReadQueueNums(18);
+ topicConfig.setWriteQueueNums(18);
Review comment:
Should use static number while not a special number 18
##########
File path: broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java
##########
@@ -124,6 +124,14 @@ public TopicConfigManager(BrokerController brokerController) {
topicConfig.setWriteQueueNums(1);
this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig);
}
+ {
+ String topic = MixAll.SCHEDULE_TOPIC;
+ TopicConfig topicConfig = new TopicConfig(topic);
Review comment:
SCHEDULE_TOPIC is a special system topic? IMO, we should refactor this naming logic here.
##########
File path: common/src/main/java/org/apache/rocketmq/common/MixAll.java
##########
@@ -56,6 +56,7 @@
//http://jmenv.tbsite.net:8080/rocketmq/nsaddr
//public static final String WS_ADDR = "http://" + WS_DOMAIN_NAME + ":8080/rocketmq/" + WS_DOMAIN_SUBGROUP;
public static final String AUTO_CREATE_TOPIC_KEY_TOPIC = "TBW102"; // Will be created at broker when isAutoCreateTopicEnable
+ public static final String SCHEDULE_TOPIC = "SCHEDULE_TOPIC_XXXX";
Review comment:
MixAll class should not inflate continue. could you help to move the system topic related logic to a new class, such as TopicValidator or TopicChecker?
##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
##########
@@ -285,7 +273,19 @@ private synchronized RemotingCommand updateAndCreateTopic(ChannelHandlerContext
this.brokerController.registerIncrementBrokerData(topicConfig, this.brokerController.getTopicConfigManager().getDataVersion());
- return null;
+ response.setCode(ResponseCode.SUCCESS);
+ return response;
+ }
+
+ private boolean isSystemTopic(RemotingCommand response, String topic) {
+ if (this.brokerController.getTopicConfigManager().isSystemTopic(topic)) {
Review comment:
It is a good time to arrange the optimization for system topic or special inner topic globally in this pr.
##########
File path: store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java
##########
@@ -383,7 +384,7 @@ public PutMessageResult putMessage(final MessageExtBrokerInner msg) {
msg.setDelayTimeLevel(this.defaultMessageStore.getScheduleMessageService().getMaxDelayLevel());
}
- topic = ScheduleMessageService.SCHEDULE_TOPIC;
+ topic = MixAll.SCHEDULE_TOPIC;
Review comment:
I don't like to see many MixAll scatter in so many places:-)
##########
File path: broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
##########
@@ -285,7 +273,19 @@ private synchronized RemotingCommand updateAndCreateTopic(ChannelHandlerContext
this.brokerController.registerIncrementBrokerData(topicConfig, this.brokerController.getTopicConfigManager().getDataVersion());
- return null;
+ response.setCode(ResponseCode.SUCCESS);
+ return response;
+ }
+
+ private boolean isSystemTopic(RemotingCommand response, String topic) {
+ if (this.brokerController.getTopicConfigManager().isSystemTopic(topic)) {
Review comment:
It is a good time to arrange the optimization for system topic or special inner topic globally in this pr.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org