提交 a64ad010 编写于 作者: D dongeforever

Add some notes, and revert the id map, set the globalId first

上级 7707275e
...@@ -63,13 +63,13 @@ public class TopicQueueMappingDetail extends TopicQueueMappingInfo { ...@@ -63,13 +63,13 @@ public class TopicQueueMappingDetail extends TopicQueueMappingInfo {
&& items.size() >= 1) { && items.size() >= 1) {
LogicQueueMappingItem curr = items.get(items.size() - 1); LogicQueueMappingItem curr = items.get(items.size() - 1);
if (bname.equals(curr.getBname())) { if (bname.equals(curr.getBname())) {
tmpIdMap.put(curr.getQueueId(), globalId); tmpIdMap.put(globalId, curr.getQueueId());
} }
} else if (level == LEVEL_1 } else if (level == LEVEL_1
&& items.size() >= 2) { && items.size() >= 2) {
LogicQueueMappingItem prev = items.get(items.size() - 1); LogicQueueMappingItem prev = items.get(items.size() - 1);
if (bname.equals(prev.getBname())) { if (bname.equals(prev.getBname())) {
tmpIdMap.put(prev.getQueueId(), globalId); tmpIdMap.put(globalId, prev.getQueueId());
} }
} }
} }
......
...@@ -29,9 +29,9 @@ public class TopicQueueMappingInfo extends RemotingSerializable { ...@@ -29,9 +29,9 @@ public class TopicQueueMappingInfo extends RemotingSerializable {
int totalQueues; int totalQueues;
String bname; //identify the hosted broker name String bname; //identify the hosted broker name
//register to broker to construct the route //register to broker to construct the route
ConcurrentMap<Integer, Integer> currIdMap = new ConcurrentHashMap<Integer, Integer>(); ConcurrentMap<Integer/*logicId*/, Integer/*physicalId*/> currIdMap = new ConcurrentHashMap<Integer, Integer>();
//register to broker to help detect remapping failure //register to broker to help detect remapping failure
protected ConcurrentMap<Integer, Integer> prevIdMap = new ConcurrentHashMap<Integer, Integer>(); ConcurrentMap<Integer/*logicId*/, Integer/*physicalId*/> prevIdMap = new ConcurrentHashMap<Integer, Integer>();
public TopicQueueMappingInfo(String topic, int totalQueues, String bname) { public TopicQueueMappingInfo(String topic, int totalQueues, String bname) {
this.topic = topic; this.topic = topic;
......
...@@ -33,7 +33,8 @@ public class TopicRouteData extends RemotingSerializable { ...@@ -33,7 +33,8 @@ public class TopicRouteData extends RemotingSerializable {
private List<QueueData> queueDatas; private List<QueueData> queueDatas;
private List<BrokerData> brokerDatas; private List<BrokerData> brokerDatas;
private HashMap<String/* brokerAddr */, List<String>/* Filter Server */> filterServerTable; private HashMap<String/* brokerAddr */, List<String>/* Filter Server */> filterServerTable;
private Map<String, TopicQueueMappingInfo> topicQueueMappingByBroker; //It could be null or empty
private Map<String/*brokerName*/, TopicQueueMappingInfo> topicQueueMappingByBroker;
public TopicRouteData() { public TopicRouteData() {
} }
......
...@@ -163,7 +163,7 @@ public class RouteInfoManager { ...@@ -163,7 +163,7 @@ public class RouteInfoManager {
TopicConfigAndMappingSerializeWrapper mappingSerializeWrapper = TopicConfigAndMappingSerializeWrapper.from(topicConfigWrapper); TopicConfigAndMappingSerializeWrapper mappingSerializeWrapper = TopicConfigAndMappingSerializeWrapper.from(topicConfigWrapper);
Map<String, TopicQueueMappingInfo> topicQueueMappingInfoMap = mappingSerializeWrapper.getTopicQueueMappingInfoMap(); Map<String, TopicQueueMappingInfo> topicQueueMappingInfoMap = mappingSerializeWrapper.getTopicQueueMappingInfoMap();
//the topicQueueMappingInfoMap should never be null, but can be empty
for (Map.Entry<String, TopicQueueMappingInfo> entry : topicQueueMappingInfoMap.entrySet()) { for (Map.Entry<String, TopicQueueMappingInfo> entry : topicQueueMappingInfoMap.entrySet()) {
if (!topicQueueMappingInfoTable.containsKey(entry.getKey())) { if (!topicQueueMappingInfoTable.containsKey(entry.getKey())) {
topicQueueMappingInfoTable.put(entry.getKey(), new HashMap<String, TopicQueueMappingInfo>()); topicQueueMappingInfoTable.put(entry.getKey(), new HashMap<String, TopicQueueMappingInfo>());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册