提交 1a80c5ba 编写于 作者: D dongeforever

Trivial pilishment for acl and msg_trace

上级 06da1045
...@@ -43,7 +43,7 @@ import org.apache.rocketmq.logging.InternalLoggerFactory; ...@@ -43,7 +43,7 @@ import org.apache.rocketmq.logging.InternalLoggerFactory;
public class PlainPermissionLoader { public class PlainPermissionLoader {
private static final InternalLogger log = InternalLoggerFactory.getLogger(LoggerName.ACL_PLUG_LOGGER_NAME); private static final InternalLogger log = InternalLoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME);
private static final String DEFAULT_PLAIN_ACL_FILE = "/conf/plain_acl.yml"; private static final String DEFAULT_PLAIN_ACL_FILE = "/conf/plain_acl.yml";
......
...@@ -27,7 +27,7 @@ import org.apache.rocketmq.logging.InternalLoggerFactory; ...@@ -27,7 +27,7 @@ import org.apache.rocketmq.logging.InternalLoggerFactory;
public class RemoteAddressStrategyFactory { public class RemoteAddressStrategyFactory {
private static final InternalLogger log = InternalLoggerFactory.getLogger(LoggerName.ACL_PLUG_LOGGER_NAME); private static final InternalLogger log = InternalLoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME);
public static final NullRemoteAddressStrategy NULL_NET_ADDRESS_STRATEGY = new NullRemoteAddressStrategy(); public static final NullRemoteAddressStrategy NULL_NET_ADDRESS_STRATEGY = new NullRemoteAddressStrategy();
......
...@@ -228,14 +228,6 @@ public class AdminBrokerProcessor implements NettyRequestProcessor { ...@@ -228,14 +228,6 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response; return response;
} }
if (this.brokerController.getBrokerConfig().isAutoTraceBrokerEnable()) {
String errorMsg = "the topic[" + requestHeader.getTopic() + "] is user self defined topic and this node is trace broker!";
log.warn(errorMsg);
response.setCode(ResponseCode.SYSTEM_ERROR);
response.setRemark(errorMsg);
return response;
}
try { try {
response.setCode(ResponseCode.SUCCESS); response.setCode(ResponseCode.SUCCESS);
response.setOpaque(request.getOpaque()); response.setOpaque(request.getOpaque());
......
...@@ -125,7 +125,6 @@ public class TopicConfigManager extends ConfigManager { ...@@ -125,7 +125,6 @@ public class TopicConfigManager extends ConfigManager {
this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig); this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig);
} }
{ {
if (this.brokerController.getBrokerConfig().isAutoTraceBrokerEnable()) {
String topic = this.brokerController.getBrokerConfig().getMsgTraceTopicName(); String topic = this.brokerController.getBrokerConfig().getMsgTraceTopicName();
TopicConfig topicConfig = new TopicConfig(topic); TopicConfig topicConfig = new TopicConfig(topic);
this.systemTopicList.add(topic); this.systemTopicList.add(topic);
...@@ -134,7 +133,6 @@ public class TopicConfigManager extends ConfigManager { ...@@ -134,7 +133,6 @@ public class TopicConfigManager extends ConfigManager {
this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig); this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig);
} }
} }
}
public boolean isSystemTopic(final String topic) { public boolean isSystemTopic(final String topic) {
return this.systemTopicList.contains(topic); return this.systemTopicList.contains(topic);
...@@ -164,10 +162,6 @@ public class TopicConfigManager extends ConfigManager { ...@@ -164,10 +162,6 @@ public class TopicConfigManager extends ConfigManager {
if (topicConfig != null) if (topicConfig != null)
return topicConfig; return topicConfig;
if (this.brokerController.getBrokerConfig().isAutoTraceBrokerEnable()) {
return topicConfig;
}
TopicConfig defaultTopicConfig = this.topicConfigTable.get(defaultTopic); TopicConfig defaultTopicConfig = this.topicConfigTable.get(defaultTopic);
if (defaultTopicConfig != null) { if (defaultTopicConfig != null) {
if (defaultTopic.equals(MixAll.AUTO_CREATE_TOPIC_KEY_TOPIC)) { if (defaultTopic.equals(MixAll.AUTO_CREATE_TOPIC_KEY_TOPIC)) {
......
...@@ -758,8 +758,4 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume ...@@ -758,8 +758,4 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
public TraceDispatcher getTraceDispatcher() { public TraceDispatcher getTraceDispatcher() {
return traceDispatcher; return traceDispatcher;
} }
public void setTraceDispatcher(TraceDispatcher traceDispatcher) {
this.traceDispatcher = traceDispatcher;
}
} }
...@@ -850,7 +850,4 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer { ...@@ -850,7 +850,4 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
return traceDispatcher; return traceDispatcher;
} }
public void setTraceDispatcher(TraceDispatcher traceDispatcher) {
this.traceDispatcher = traceDispatcher;
}
} }
...@@ -52,8 +52,6 @@ public class BrokerConfig { ...@@ -52,8 +52,6 @@ public class BrokerConfig {
private boolean autoCreateSubscriptionGroup = true; private boolean autoCreateSubscriptionGroup = true;
private String messageStorePlugIn = ""; private String messageStorePlugIn = "";
@ImportantField @ImportantField
private boolean autoTraceBrokerEnable = false;
@ImportantField
private String msgTraceTopicName = MixAll.RMQ_SYS_TRACE_TOPIC; private String msgTraceTopicName = MixAll.RMQ_SYS_TRACE_TOPIC;
/** /**
* thread numbers for send message thread pool, since spin lock will be used by default since 4.0.x, the default * thread numbers for send message thread pool, since spin lock will be used by default since 4.0.x, the default
...@@ -751,14 +749,6 @@ public class BrokerConfig { ...@@ -751,14 +749,6 @@ public class BrokerConfig {
this.waitTimeMillsInTransactionQueue = waitTimeMillsInTransactionQueue; this.waitTimeMillsInTransactionQueue = waitTimeMillsInTransactionQueue;
} }
public boolean isAutoTraceBrokerEnable() {
return autoTraceBrokerEnable;
}
public void setAutoTraceBrokerEnable(boolean autoTraceBrokerEnable) {
this.autoTraceBrokerEnable = autoTraceBrokerEnable;
}
public String getMsgTraceTopicName() { public String getMsgTraceTopicName() {
return msgTraceTopicName; return msgTraceTopicName;
} }
......
...@@ -82,7 +82,6 @@ public class MixAll { ...@@ -82,7 +82,6 @@ public class MixAll {
public static final long CURRENT_JVM_PID = getPID(); public static final long CURRENT_JVM_PID = getPID();
public static final String RETRY_GROUP_TOPIC_PREFIX = "%RETRY%"; public static final String RETRY_GROUP_TOPIC_PREFIX = "%RETRY%";
public static final String TRACE_BROKER_NAME_SUFFIX = "trace";
public static final String DLQ_GROUP_TOPIC_PREFIX = "%DLQ%"; public static final String DLQ_GROUP_TOPIC_PREFIX = "%DLQ%";
public static final String SYSTEM_TOPIC_PREFIX = "rmq_sys_"; public static final String SYSTEM_TOPIC_PREFIX = "rmq_sys_";
......
...@@ -37,5 +37,4 @@ public class LoggerName { ...@@ -37,5 +37,4 @@ public class LoggerName {
public static final String PROTECTION_LOGGER_NAME = "RocketmqProtection"; public static final String PROTECTION_LOGGER_NAME = "RocketmqProtection";
public static final String WATER_MARK_LOGGER_NAME = "RocketmqWaterMark"; public static final String WATER_MARK_LOGGER_NAME = "RocketmqWaterMark";
public static final String FILTER_LOGGER_NAME = "RocketmqFilter"; public static final String FILTER_LOGGER_NAME = "RocketmqFilter";
public static final String ACL_PLUG_LOGGER_NAME = "RocketmqAclPlug";
} }
...@@ -33,7 +33,6 @@ public class BrokerConfigTest { ...@@ -33,7 +33,6 @@ public class BrokerConfigTest {
BrokerConfig brokerConfig = new BrokerConfig(); BrokerConfig brokerConfig = new BrokerConfig();
brokerConfig.setNamesrvAddr("127.0.0.1:9876"); brokerConfig.setNamesrvAddr("127.0.0.1:9876");
brokerConfig.setAutoCreateTopicEnable(false); brokerConfig.setAutoCreateTopicEnable(false);
brokerConfig.setAutoTraceBrokerEnable(true);
brokerConfig.setBrokerName("broker-a"); brokerConfig.setBrokerName("broker-a");
brokerConfig.setBrokerId(0); brokerConfig.setBrokerId(0);
brokerConfig.setBrokerClusterName("DefaultCluster"); brokerConfig.setBrokerClusterName("DefaultCluster");
...@@ -44,7 +43,5 @@ public class BrokerConfigTest { ...@@ -44,7 +43,5 @@ public class BrokerConfigTest {
assertThat(brokerConfig.getBrokerId()).isEqualTo(0); assertThat(brokerConfig.getBrokerId()).isEqualTo(0);
assertThat(brokerConfig.getBrokerName()).isEqualTo("broker-a"); assertThat(brokerConfig.getBrokerName()).isEqualTo("broker-a");
assertThat(brokerConfig.isAutoCreateTopicEnable()).isEqualTo(false); assertThat(brokerConfig.isAutoCreateTopicEnable()).isEqualTo(false);
assertThat(brokerConfig.isAutoTraceBrokerEnable()).isEqualTo(true);
} }
} }
\ No newline at end of file
...@@ -19,4 +19,3 @@ deleteWhen=04 ...@@ -19,4 +19,3 @@ deleteWhen=04
fileReservedTime=48 fileReservedTime=48
brokerRole=ASYNC_MASTER brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH flushDiskType=ASYNC_FLUSH
autoTraceBrokerEnable=false
\ No newline at end of file
...@@ -19,4 +19,3 @@ deleteWhen=04 ...@@ -19,4 +19,3 @@ deleteWhen=04
fileReservedTime=48 fileReservedTime=48
brokerRole=ASYNC_MASTER brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH flushDiskType=ASYNC_FLUSH
autoTraceBrokerEnable=false
\ No newline at end of file
...@@ -21,4 +21,3 @@ deleteWhen=04 ...@@ -21,4 +21,3 @@ deleteWhen=04
fileReservedTime=48 fileReservedTime=48
brokerRole=ASYNC_MASTER brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH flushDiskType=ASYNC_FLUSH
autoTraceBrokerEnable=true
\ No newline at end of file
...@@ -20,5 +20,3 @@ deleteWhen = 04 ...@@ -20,5 +20,3 @@ deleteWhen = 04
fileReservedTime = 48 fileReservedTime = 48
brokerRole = ASYNC_MASTER brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH flushDiskType = ASYNC_FLUSH
enableAcl=true
namesrvAddr=127.0.0.1:9876
...@@ -24,7 +24,6 @@ import org.apache.log4j.Logger; ...@@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import org.apache.rocketmq.broker.BrokerController; import org.apache.rocketmq.broker.BrokerController;
import org.apache.rocketmq.common.MQVersion; import org.apache.rocketmq.common.MQVersion;
import org.apache.rocketmq.namesrv.NamesrvController; import org.apache.rocketmq.namesrv.NamesrvController;
import org.apache.rocketmq.remoting.netty.TlsSystemConfig;
import org.apache.rocketmq.remoting.protocol.RemotingCommand; import org.apache.rocketmq.remoting.protocol.RemotingCommand;
import org.apache.rocketmq.test.client.rmq.RMQAsyncSendProducer; import org.apache.rocketmq.test.client.rmq.RMQAsyncSendProducer;
import org.apache.rocketmq.test.client.rmq.RMQNormalConsumer; import org.apache.rocketmq.test.client.rmq.RMQNormalConsumer;
......
...@@ -132,7 +132,7 @@ public class MQAdminStartup { ...@@ -132,7 +132,7 @@ public class MQAdminStartup {
System.setProperty(MixAll.NAMESRV_ADDR_PROPERTY, namesrvAddr); System.setProperty(MixAll.NAMESRV_ADDR_PROPERTY, namesrvAddr);
} }
cmd.execute(commandLine, options, getAclRPCHook(commandLine)); cmd.execute(commandLine, options, getAclRPCHook());
} else { } else {
System.out.printf("The sub command %s not exist.%n", args[0]); System.out.printf("The sub command %s not exist.%n", args[0]);
} }
...@@ -246,7 +246,7 @@ public class MQAdminStartup { ...@@ -246,7 +246,7 @@ public class MQAdminStartup {
subCommandList.add(command); subCommandList.add(command);
} }
public static RPCHook getAclRPCHook(CommandLine commandLine) { public static RPCHook getAclRPCHook() {
String fileHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV)); String fileHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV));
String fileName = "/conf/tools.yml"; String fileName = "/conf/tools.yml";
JSONObject yamlDataObject = AclUtils.getYamlDataObject(fileHome + fileName , JSONObject yamlDataObject = AclUtils.getYamlDataObject(fileHome + fileName ,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册