[GitHub] vongosling commented on issue #205: [ROCKETMQ-319] Improve broker register performance and reduce memory usage

2018-03-05 Thread GitBox
vongosling commented on issue #205: [ROCKETMQ-319] Improve broker register 
performance and reduce memory usage  
URL: https://github.com/apache/rocketmq/pull/205#issuecomment-370689595
 
 
   Good catch for the improvement of the heartbeat and meta-data register 
logic, hoping more english comments exist in the commits, although they are 
broken english :-)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] fuyou001 commented on a change in pull request #205: [ROCKETMQ-319] Improve broker register performance and reduce memory usage

2018-03-05 Thread GitBox
fuyou001 commented on a change in pull request #205: [ROCKETMQ-319] Improve 
broker register performance and reduce memory usage  
URL: https://github.com/apache/rocketmq/pull/205#discussion_r172425447
 
 

 ##
 File path: 
broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
 ##
 @@ -231,6 +259,72 @@ public void unregisterBroker(
 throw new MQBrokerException(response.getCode(), response.getRemark());
 }
 
+public List needRegister(
+final String clusterName,
+final String brokerAddr,
+final String brokerName,
+final long brokerId,
+final TopicConfigSerializeWrapper topicConfigWrapper,
+final int timeoutMills) {
+final List changedList = new CopyOnWriteArrayList<>();
+List nameServerAddressList = 
this.remotingClient.getNameServerAddressList();
+if (nameServerAddressList != null && nameServerAddressList.size() > 0) 
{
+final CountDownLatch countDownLatch = new 
CountDownLatch(nameServerAddressList.size());
+for (final String namesrvAddr : nameServerAddressList) {
+brokerOuterExecutor.execute(new Runnable() {
+@Override
+public void run() {
+try {
+QueryDataVersionRequestHeader requestHeader = new 
QueryDataVersionRequestHeader();
+requestHeader.setBrokerAddr(brokerAddr);
+requestHeader.setBrokerId(brokerId);
+requestHeader.setBrokerName(brokerName);
+requestHeader.setClusterName(clusterName);
+RemotingCommand request = 
RemotingCommand.createRequestCommand(RequestCode.QUERY_DATA_VERSION, 
requestHeader);
+
request.setBody(topicConfigWrapper.getDataVersion().encode());
+RemotingCommand response = 
remotingClient.invokeSync(namesrvAddr, request, timeoutMills);
+DataVersion nameServerDataVersion = null;
+assert response != null;
 
 Review comment:
   done


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] vongosling commented on a change in pull request #221: [ROCKETMQ-359] Replace slf4j api used in RocketMQ with InternalLogger

2018-03-05 Thread GitBox
vongosling commented on a change in pull request #221: [ROCKETMQ-359] Replace 
slf4j api used in RocketMQ with InternalLogger
URL: https://github.com/apache/rocketmq/pull/221#discussion_r172425109
 
 

 ##
 File path: 
remoting/src/main/java/org/apache/rocketmq/remoting/common/ServiceThread.java
 ##
 @@ -16,14 +16,15 @@
  */
 package org.apache.rocketmq.remoting.common;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import org.apache.rocketmq.logging.InternalLogger;
 
 Review comment:
   Manual replace?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] vongosling commented on issue #231: [ROCKETMQ-375] Fix typo in MQClientInstance?s log message

2018-03-05 Thread GitBox
vongosling commented on issue #231: [ROCKETMQ-375] Fix typo in 
MQClientInstance?s log message
URL: https://github.com/apache/rocketmq/pull/231#issuecomment-370683576
 
 
   Well done. Next, 2 hints for works. Please transfer your PR to RocketMQ 
develop branch while not master. Another, Could you tell us why do you use our 
template for pr?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] fuyou001 commented on a change in pull request #205: [ROCKETMQ-319] Improve broker register performance and reduce memory usage

2018-03-05 Thread GitBox
fuyou001 commented on a change in pull request #205: [ROCKETMQ-319] Improve 
broker register performance and reduce memory usage  
URL: https://github.com/apache/rocketmq/pull/205#discussion_r172424249
 
 

 ##
 File path: 
broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
 ##
 @@ -231,6 +259,72 @@ public void unregisterBroker(
 throw new MQBrokerException(response.getCode(), response.getRemark());
 }
 
+public List needRegister(
+final String clusterName,
+final String brokerAddr,
+final String brokerName,
+final long brokerId,
+final TopicConfigSerializeWrapper topicConfigWrapper,
+final int timeoutMills) {
+final List changedList = new CopyOnWriteArrayList<>();
+List nameServerAddressList = 
this.remotingClient.getNameServerAddressList();
+if (nameServerAddressList != null && nameServerAddressList.size() > 0) 
{
+final CountDownLatch countDownLatch = new 
CountDownLatch(nameServerAddressList.size());
+for (final String namesrvAddr : nameServerAddressList) {
+brokerOuterExecutor.execute(new Runnable() {
+@Override
+public void run() {
+try {
+QueryDataVersionRequestHeader requestHeader = new 
QueryDataVersionRequestHeader();
+requestHeader.setBrokerAddr(brokerAddr);
+requestHeader.setBrokerId(brokerId);
+requestHeader.setBrokerName(brokerName);
+requestHeader.setClusterName(clusterName);
+RemotingCommand request = 
RemotingCommand.createRequestCommand(RequestCode.QUERY_DATA_VERSION, 
requestHeader);
+
request.setBody(topicConfigWrapper.getDataVersion().encode());
+RemotingCommand response = 
remotingClient.invokeSync(namesrvAddr, request, timeoutMills);
+DataVersion nameServerDataVersion = null;
+assert response != null;
+Boolean changed = false;
+switch (response.getCode()) {
+case ResponseCode.SUCCESS: {
+QueryDataVersionResponseHeader 
queryDataVersionResponseHeader =
+(QueryDataVersionResponseHeader) 
response.decodeCommandCustomHeader(QueryDataVersionResponseHeader.class);
+changed = 
queryDataVersionResponseHeader.getChanged();
+byte[] body = response.getBody();
+if (body != null) {
+nameServerDataVersion = 
DataVersion.decode(body, DataVersion.class);
+if 
(!topicConfigWrapper.getDataVersion().equals(nameServerDataVersion)) {
+changed = true;
+}
+}
+if (changed == null || changed) {
+changedList.add(Boolean.TRUE);
+}
+}
+default:
+break;
+}
+log.warn("query data version from name server {} 
OK,changed {}, broker {},name server {}", namesrvAddr, changed, 
topicConfigWrapper.getDataVersion(), nameServerDataVersion == null ? "" : 
nameServerDataVersion);
 
 Review comment:
   done


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] vongosling commented on a change in pull request #205: [ROCKETMQ-319] improve broker register performance and reduce memory usage

2018-03-05 Thread GitBox
vongosling commented on a change in pull request #205: [ROCKETMQ-319] improve 
broker register performance and reduce memory usage  
URL: https://github.com/apache/rocketmq/pull/205#discussion_r172421354
 
 

 ##
 File path: 
broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
 ##
 @@ -52,6 +62,8 @@
 private final RemotingClient remotingClient;
 private final TopAddressing topAddressing = new 
TopAddressing(MixAll.getWSAddr());
 private String nameSrvAddr = null;
+private BrokerFixedThreadPoolExecutor brokerOuterExecutor = new 
BrokerFixedThreadPoolExecutor(4, 10, 1, TimeUnit.MINUTES,
+new ArrayBlockingQueue(32), new 
ThreadFactoryImpl("brokerOutApi_thread_", true));
 
 Review comment:
   Why is 32 while not other value, Could you give us some explanation here?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lindzh commented on a change in pull request #205: [ROCKETMQ-319] improve broker register performance and reduce memory usage

2018-03-05 Thread GitBox
lindzh commented on a change in pull request #205: [ROCKETMQ-319] improve 
broker register performance and reduce memory usage  
URL: https://github.com/apache/rocketmq/pull/205#discussion_r172398547
 
 

 ##
 File path: 
broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
 ##
 @@ -52,6 +62,8 @@
 private final RemotingClient remotingClient;
 private final TopAddressing topAddressing = new 
TopAddressing(MixAll.getWSAddr());
 private String nameSrvAddr = null;
+private BrokerFixedThreadPoolExecutor brokerOuterExecutor = new 
BrokerFixedThreadPoolExecutor(4, 10, 1, TimeUnit.MINUTES,
+new ArrayBlockingQueue(32), new 
ThreadFactoryImpl("brokeroutapi_thread_"));
 
 Review comment:
   ThreadNme should like brokerOutapiThread_ rather than brokeroutapi_thread_


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services