dongeforever commented on code in PR #4383:
URL: https://github.com/apache/rocketmq/pull/4383#discussion_r916507881
##########
common/src/main/java/org/apache/rocketmq/common/protocol/RequestCode.java:
##########
@@ -194,4 +194,5 @@ public class RequestCode {
public static final int GET_ALL_PRODUCER_INFO = 328;
public static final int DELETE_EXPIRED_COMMITLOG = 329;
+
}
Review Comment:
remove these trivial changes.
##########
broker/src/main/java/org/apache/rocketmq/broker/plugin/MessageStoreFactory.java:
##########
@@ -1,45 +1,45 @@
-/*
Review Comment:
Why this file is labeled as changed?
Maybe some newline delimiter conflicts.
##########
common/src/main/java/org/apache/rocketmq/common/protocol/route/BrokerData.java:
##########
@@ -29,17 +29,18 @@ public class BrokerData implements Comparable<BrokerData> {
private String cluster;
private String brokerName;
private HashMap<Long/* brokerId */, String/* broker address */>
brokerAddrs;
-
+ private String zoneName;
private final Random random = new Random();
public BrokerData() {
}
- public BrokerData(String cluster, String brokerName, HashMap<Long, String>
brokerAddrs) {
Review Comment:
Keep the old constructor, and let it be compatible.
##########
common/src/main/java/org/apache/rocketmq/common/rpchook/DynamicalExtFieldRPCHook.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.common.rpchook;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.rocketmq.common.MixAll;
+import org.apache.rocketmq.remoting.RPCHook;
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+
+public class DynamicalExtFieldRPCHook implements RPCHook {
+
+ @Override
+ public void doBeforeRequest(String remoteAddr, RemotingCommand request) {
+ String zoneName = System.getProperty(MixAll.ROCKETMQ_ZONE_PROPERTY,
System.getenv(MixAll.ROCKETMQ_ZONE_ENV));
+ if (StringUtils.isNotBlank(zoneName)) {
+ request.addExtField(MixAll.ZONE_NAME,
System.getProperty(MixAll.ROCKETMQ_ZONE_PROPERTY,
System.getenv(MixAll.ROCKETMQ_ZONE_ENV)));
Review Comment:
use zoneName instead of duplicated getting code.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]