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



##########
File path: 
helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java
##########
@@ -220,7 +220,8 @@ private void generateMessage(final Resource resource, final 
BaseControllerDataPr
                 generateCancellationMessageForPendingMessage(desiredState, 
currentState, nextState, pendingMessage,
                     manager, resource, partition, sessionIdMap, instanceName, 
stateModelDef,
                     cancellationMessage, isCancellationEnabled);
-          } else {
+          }
+          if (pendingMessage == null || 
currentState.equalsIgnoreCase(pendingMessage.getToState())) {

Review comment:
       Actually if looking at the generateCancellationMessageForPendingMessage 
logic, there is
   
   `else if (currentState.equalsIgnoreCase(pendingState)) {
           LogUtil.logInfo(logger, _eventId,
               "Message hasn't been removed for " + instanceName + " to transit 
" + resource
                   .getResourceName() + "." + partition.getPartitionName() + " 
to "
                   + pendingState + ", desiredState: " + desiredState + ", 
isRelay: " + pendingMessage.isRelayMessage());
         }`
   
   So actually when currentState equals pendingState, there is no cancellation 
message generated.
   

##########
File path: 
helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java
##########
@@ -220,7 +220,8 @@ private void generateMessage(final Resource resource, final 
BaseControllerDataPr
                 generateCancellationMessageForPendingMessage(desiredState, 
currentState, nextState, pendingMessage,
                     manager, resource, partition, sessionIdMap, instanceName, 
stateModelDef,
                     cancellationMessage, isCancellationEnabled);
-          } else {
+          }
+          if (pendingMessage == null || 
currentState.equalsIgnoreCase(pendingMessage.getToState())) {

Review comment:
       GenerateCancellationMessageForPendingMessage is used in different 
places. Doesn't look good to move that function back. We can guard it with 
"message == null" for now.




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