xyuanlu commented on code in PR #3043:
URL: https://github.com/apache/helix/pull/3043#discussion_r2165651555


##########
helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java:
##########
@@ -250,17 +262,40 @@ private void generateMessage(final Resource resource, 
final BaseControllerDataPr
                     pendingMessage, manager, resource, partition, 
sessionIdMap, instanceName,
                     stateModelDef, cancellationMessage, isCancellationEnabled);
           } else {
+            // Set currentActiveReplicaNumber to provide metadata for 
potential message prioritization by
+            // participant.
+            // Assign the current active replica count to all qualifying 
upward transitions for this
+            // partition.
+            // This ensures consistent prioritization metadata across 
concurrent state transitions.
+            int currentActiveReplicaNumber = -1; // -1 indicates no 
prioritization metadata, for eg:
+                                           // Downward ST messages get a -1.
+
+            /*
+              Assign currentActiveReplicaNumber for qualifying upward state 
transitions.
+              Criteria for assignment:
+              - Must be an upward state transition according to state model
+              - Current state must not be considered active (according to 
state model type)
+              - Target state must be considered active (according to state 
model type)
+             */
+            if (stateModelDef.isUpwardStateTransition(currentState, nextState)
+                && !isStateActive(currentState, stateModelDef)

Review Comment:
   Why we want to filter out secondary top state to top state?  Would it cause 
a problem?
   I think if we are not introducing this metadata to all upward state 
transition might be confusing. 



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

Reply via email to