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

Trivial pilishment for acl and msg_trace

上级 06da1045
......@@ -43,7 +43,7 @@ import org.apache.rocketmq.logging.InternalLoggerFactory;
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";
......
......@@ -27,7 +27,7 @@ import org.apache.rocketmq.logging.InternalLoggerFactory;
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();
......
......@@ -228,14 +228,6 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
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 {
response.setCode(ResponseCode.SUCCESS);
response.setOpaque(request.getOpaque());
......
......@@ -125,14 +125,12 @@ public class TopicConfigManager extends ConfigManager {
this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig);
}
{
if (this.brokerController.getBrokerConfig().isAutoTraceBrokerEnable()) {
String topic = this.brokerController.getBrokerConfig().getMsgTraceTopicName();
TopicConfig topicConfig = new TopicConfig(topic);
this.systemTopicList.add(topic);
topicConfig.setReadQueueNums(1);
topicConfig.setWriteQueueNums(1);
this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig);
}
String topic = this.brokerController.getBrokerConfig().getMsgTraceTopicName();
TopicConfig topicConfig = new TopicConfig(topic);
this.systemTopicList.add(topic);
topicConfig.setReadQueueNums(1);
topicConfig.setWriteQueueNums(1);
this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig);
}
}
......@@ -164,10 +162,6 @@ public class TopicConfigManager extends ConfigManager {
if (topicConfig != null)
return topicConfig;
if (this.brokerController.getBrokerConfig().isAutoTraceBrokerEnable()) {
return topicConfig;
}
TopicConfig defaultTopicConfig = this.topicConfigTable.get(defaultTopic);
if (defaultTopicConfig != null) {
if (defaultTopic.equals(MixAll.AUTO_CREATE_TOPIC_KEY_TOPIC)) {
......
......@@ -758,8 +758,4 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
public TraceDispatcher getTraceDispatcher() {
return traceDispatcher;
}
public void setTraceDispatcher(TraceDispatcher traceDispatcher) {
this.traceDispatcher = traceDispatcher;
}
}
......@@ -850,7 +850,4 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
return traceDispatcher;
}
public void setTraceDispatcher(TraceDispatcher traceDispatcher) {
this.traceDispatcher = traceDispatcher;
}
}
......@@ -52,8 +52,6 @@ public class BrokerConfig {
private boolean autoCreateSubscriptionGroup = true;
private String messageStorePlugIn = "";
@ImportantField
private boolean autoTraceBrokerEnable = false;
@ImportantField
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
......@@ -751,14 +749,6 @@ public class BrokerConfig {
this.waitTimeMillsInTransactionQueue = waitTimeMillsInTransactionQueue;
}
public boolean isAutoTraceBrokerEnable() {
return autoTraceBrokerEnable;
}
public void setAutoTraceBrokerEnable(boolean autoTraceBrokerEnable) {
this.autoTraceBrokerEnable = autoTraceBrokerEnable;
}
public String getMsgTraceTopicName() {
return msgTraceTopicName;
}
......
......@@ -82,8 +82,7 @@ public class MixAll {
public static final long CURRENT_JVM_PID = getPID();
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 SYSTEM_TOPIC_PREFIX = "rmq_sys_";
public static final String UNIQUE_MSG_QUERY_FLAG = "_UNIQUE_KEY_QUERY";
......
......@@ -37,5 +37,4 @@ public class LoggerName {
public static final String PROTECTION_LOGGER_NAME = "RocketmqProtection";
public static final String WATER_MARK_LOGGER_NAME = "RocketmqWaterMark";
public static final String FILTER_LOGGER_NAME = "RocketmqFilter";
public static final String ACL_PLUG_LOGGER_NAME = "RocketmqAclPlug";
}
......@@ -33,7 +33,6 @@ public class BrokerConfigTest {
BrokerConfig brokerConfig = new BrokerConfig();
brokerConfig.setNamesrvAddr("127.0.0.1:9876");
brokerConfig.setAutoCreateTopicEnable(false);
brokerConfig.setAutoTraceBrokerEnable(true);
brokerConfig.setBrokerName("broker-a");
brokerConfig.setBrokerId(0);
brokerConfig.setBrokerClusterName("DefaultCluster");
......@@ -44,7 +43,5 @@ public class BrokerConfigTest {
assertThat(brokerConfig.getBrokerId()).isEqualTo(0);
assertThat(brokerConfig.getBrokerName()).isEqualTo("broker-a");
assertThat(brokerConfig.isAutoCreateTopicEnable()).isEqualTo(false);
assertThat(brokerConfig.isAutoTraceBrokerEnable()).isEqualTo(true);
}
}
\ No newline at end of file
......@@ -19,4 +19,3 @@ deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
autoTraceBrokerEnable=false
\ No newline at end of file
......@@ -19,4 +19,3 @@ deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
autoTraceBrokerEnable=false
\ No newline at end of file
......@@ -21,4 +21,3 @@ deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
autoTraceBrokerEnable=true
\ No newline at end of file
......@@ -20,5 +20,3 @@ deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
enableAcl=true
namesrvAddr=127.0.0.1:9876
......@@ -35,8 +35,8 @@ public class ServerUtil {
new Option("n", "namesrvAddr", true,
"Name server address list, eg: 192.168.0.1:9876;192.168.0.2:9876");
opt.setRequired(false);
options.addOption(opt);
options.addOption(opt);
return options;
}
......
......@@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import org.apache.rocketmq.broker.BrokerController;
import org.apache.rocketmq.common.MQVersion;
import org.apache.rocketmq.namesrv.NamesrvController;
import org.apache.rocketmq.remoting.netty.TlsSystemConfig;
import org.apache.rocketmq.remoting.protocol.RemotingCommand;
import org.apache.rocketmq.test.client.rmq.RMQAsyncSendProducer;
import org.apache.rocketmq.test.client.rmq.RMQNormalConsumer;
......
......@@ -132,7 +132,7 @@ public class MQAdminStartup {
System.setProperty(MixAll.NAMESRV_ADDR_PROPERTY, namesrvAddr);
}
cmd.execute(commandLine, options, getAclRPCHook(commandLine));
cmd.execute(commandLine, options, getAclRPCHook());
} else {
System.out.printf("The sub command %s not exist.%n", args[0]);
}
......@@ -246,7 +246,7 @@ public class MQAdminStartup {
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 fileName = "/conf/tools.yml";
JSONObject yamlDataObject = AclUtils.getYamlDataObject(fileHome + fileName ,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册