csudharsanan commented on code in PR #3043:
URL: https://github.com/apache/helix/pull/3043#discussion_r2109939894
##########
helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java:
##########
@@ -250,17 +260,32 @@ private void generateMessage(final Resource resource,
final BaseControllerDataPr
pendingMessage, manager, resource, partition,
sessionIdMap, instanceName,
stateModelDef, cancellationMessage, isCancellationEnabled);
} else {
+ // Default currentReplicaNumber is -1 (no prioritization)
+ int currentReplicaNumber = -1;
+ // Check if this is an upward state transition from non-second top
state to second top
+ // or top state
+ if (isUpwardStateTransition(currentState, nextState, stateModelDef)
+ && !stateModelDef.getSecondTopStates().contains(currentState)
+ && (isSecondTopState(nextState, stateModelDef)
+ || isTopState(nextState, stateModelDef))
+ && !isInPendingMessages(resourceName, partition, instanceName,
currentState,
+ nextState, pendingUpwardStateTransitionMessages)) {
+
+ // Assign the replica number for prioritization
+ currentReplicaNumber = initialReplicaNumber--;
+ }
+
// Create new state transition message
message = MessageUtil
.createStateTransitionMessage(manager.getInstanceName(),
manager.getSessionId(),
resource, partition.getPartitionName(), instanceName,
currentState, nextState,
- sessionIdMap.get(instanceName), stateModelDef.getId());
+ sessionIdMap.get(instanceName), stateModelDef.getId(),
currentReplicaNumber);
Review Comment:
This field is only set for upward state transitions from non-second-top
states to second-top or top states. Regular transitions have replica number -1.
I've updated the JavaDoc in Message.java where we set the currentReplicaNumber
to reflect this. Hopefully that clarifies it for the user.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]