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



##########
File path: 
helix-core/src/main/java/org/apache/helix/common/caches/InstanceMessagesCache.java
##########
@@ -151,6 +153,13 @@ public boolean refresh(HelixDataAccessor accessor, 
Map<String, LiveInstance> liv
     return true;
   }
 
+  public Map<String, Map<String, Message>> getStaleMessageCache() {
+    return _staleMessageCache;
+  }
+
+  public void setStaleMessageCache(Map<String, Map<String, Message>> 
staleMessageMap) {

Review comment:
       So it's used by this way:
   Map<String, Map<String, Message>> existingStaleMessages = 
cache.getStaleMessages();
   currentStateOutput.setStaleMessageMap(existingStaleMessages);
   
   So when the currentStateOutput's stale message gets updated, the instance 
cache should also be updated, right? as it's just shallow copy. Let me know if 
you think differently.

##########
File path: 
helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java
##########
@@ -344,6 +367,13 @@ private void schedulePendingMessageCleanUp(
             if (accessor.removeProperty(msg.getKey(accessor.keyBuilder(), 
instanceName))) {
               LogUtil.logInfo(logger, _eventId, String
                   .format("Deleted message %s from instance %s", 
msg.getMsgId(), instanceName));
+              if (staleMessageMap != null && 
staleMessageMap.containsKey(msg.getTgtName())
+                  && 
staleMessageMap.get(msg.getTgtName()).containsKey(msg.getMsgId())) {

Review comment:
       Please take a look at the updated one. I believe it's safe.




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