liyangbing commented on issue #288: mutiple master cluster, delete topic on one 
broker, but  topic route not update on namesrv
URL: https://github.com/apache/rocketmq/issues/288#issuecomment-398261934
 
 
   @zhouxinyu 
   i view the namesrv code,advise add removeDeletedTopicQueueData code
   
   RouteInfoMansger.registerBroker()
   
   if (tcTable != null) {
   for (String topic : tcTable.keySet()) {
   TopicConfig topicConfig = tcTable.get(topic);
   this.createAndUpdateQueueData(brokerName, topicConfig);
   }
   }
   
   //add code
   removeDeletedTopicQueueData(brokerName, tcTable);
   
   // add code
   private void removeDeletedTopicQueueData(String brokerName,
   ConcurrentHashMap<String, TopicConfig> tcTable) {
   Iterator<Entry<String, List<QueueData>>> itMap =
   this.topicQueueTable.entrySet().iterator();
   while (itMap.hasNext()) {
   Entry<String, List<QueueData>> entry = itMap.next();
   
   String topic = entry.getKey();
   List<QueueData> queueDataList = entry.getValue();
   Iterator<QueueData> it = queueDataList.iterator();
   while (it.hasNext()) {
   QueueData qd = it.next();
   if (qd.getBrokerName().equals(brokerName)) {
   if (!tcTable.contains(topic)) {
   log.info("removeDeletedTopic, remove one broker's
   topic {} {}", topic, qd);
   it.remove();
   }
   }
   }
   }
   }

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to