-
Notifications
You must be signed in to change notification settings - Fork 34
[Node Mgr] Suppot Node-MQ Topic Mapping #532
Conversation
|
|
||
| @Override | ||
| public void addNodeInfo(NodeInfo nodeInfo) throws Exception { | ||
| nodeInfoCache.addNodeInfo(nodeInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to cache all the fields of NodeInfo here?
| nodeInfo = nodeInfoCache.get(nodeIp); | ||
| assert nodeInfo != null; | ||
| } catch (Exception e) { | ||
| NodeInfo newNodeInfo = nodeManagerRestClient.getNodeInfo(nodeIp).getNodeInfo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newNodeInfo may be null here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A NodeInfoNotFound Exception has been added here.
| } | ||
|
|
||
| @DurationStatistics | ||
| public synchronized void addNodeInfo(NodeInfo nodeInfo) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need synchronized here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have remove it.
| } | ||
|
|
||
| for (String hostIp : hostIps) { | ||
| String groupTopic = localCache.getNodeInfo(hostIp).getGroupTopic(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localCache.getNodeInfo(hostIp) may rerturn null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Exception has been added here.
| throw new ParameterNullOrEmptyException(""); | ||
| } | ||
| try { | ||
| nodeService.createNodeInfo(nodeInfoJson); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateNodeInfo()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed this bug.
| throw new ParameterNullOrEmptyException(""); | ||
| } | ||
| try { | ||
| nodeService.createNodeInfo(nodeInfoJson); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleteNodeInfo()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed this bug.
| public void createNodeInfoBulk(BulkNodeInfoJson bulkNodeInfoJson) throws Exception { | ||
| List<NodeInfo> nodeInfos = bulkNodeInfoJson.getNodeInfos(); | ||
| for (NodeInfo nodeInfo : nodeInfos) { | ||
| localCache.addNodeInfo(nodeInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localCache should support batch operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addNodeInfoBulk method has been added to LocalCache
| @DurationStatistics | ||
| public void createNodeInfo(@RequestBody NodeInfoJson nodeInfoJson) throws Exception { | ||
| if (nodeInfoJson == null) { | ||
| throw new ParameterNullOrEmptyException(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More checks need to be done here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More checks have been added here.
Codecov Report
@@ Coverage Diff @@
## master #532 +/- ##
============================================
- Coverage 35.20% 34.78% -0.43%
- Complexity 1234 1241 +7
============================================
Files 491 502 +11
Lines 12157 12373 +216
Branches 1545 1557 +12
============================================
+ Hits 4280 4304 +24
- Misses 7303 7489 +186
- Partials 574 580 +6
Continue to review full report at Codecov.
|
|
LGTM |
|
@xieus Excuse me. I wonder whether this PR is ready for merge |
xieus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Implement #490 as Port Manager style and there still be a problem to solve.