kaisun2000 commented on a change in pull request #1532:
URL: https://github.com/apache/helix/pull/1532#discussion_r541348445
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/stages/MessageOutput.java
##########
@@ -64,6 +64,18 @@ public void addMessages(String resourceName, Partition
partition,
return Collections.emptyList();
}
+ public Map<Partition, List<Message>> getResourceMessages(String
resourceName) {
+ Map<Partition, List<Message>> map = _messagesMap.get(resourceName);
+ if (map != null) {
+ return map;
+ }
+ return Collections.emptyMap();
+ }
+
+ public void addResourceMessages(String resourceName, Map<Partition,
List<Message>> resourceMessages) {
Review comment:
The usage is like this.
```
MessageOutput output = new MessageOutput();
...
try {
Map<Partition, List<Message>> resourceMessages =
computePerReplicaPartitionState(idealState, currentStateOutput,
selectedMessage.getResourceMessages(resourceName),
resourceMap.get(resourceName),
bestPossibleStateOutput, dataCache,
throttleController, retracedPartitionsState,
throttledRecoveryMsg, throttledLoadMsg);
output.addResourceMessages(resourceName, resourceMessages);
retracedResourceStateMap.setState(resourceName,
retracedPartitionsState);
```
if we remove this one, we have to expand this line
`output.addResourceMessages(resourceName, resourceMessages);` to a loop, which
would be less efficient.
This is pipeline core logic, saving a few cpu cycle seems to me is worthy.
Let me know what is your take?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]