jiajunwang commented on a change in pull request #1124:
URL: https://github.com/apache/helix/pull/1124#discussion_r457691122



##########
File path: 
helix-core/src/main/java/org/apache/helix/common/caches/InstanceMessagesCache.java
##########
@@ -151,6 +155,25 @@ public boolean refresh(HelixDataAccessor accessor, 
Map<String, LiveInstance> liv
     return true;
   }
 
+  // filter stale message cache by message cache to remove deleted messages
+  public Map<String, Map<String, Message>> getStaleMessageCache() {
+    for (String instanceName : _staleMessageCache.keySet()) {

Review comment:
       I think you can do this when the _messageCache is refreshed in refresh() 
method.
   1. changing values in a get method is not a good style. We want to be able 
to call get any time, but if it has a side effect then the callers need to 
review the detail of the method every time if they want to use it.
   2. This is for cleaning up and prevent memory leakage only, so clean up when 
refresh is done at the beginning of the pipeline is enough, I think.




----------------------------------------------------------------
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]

Reply via email to