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


##########
helix-core/src/main/java/org/apache/helix/controller/stages/MessageGenerationPhase.java:
##########
@@ -250,17 +267,31 @@ private void generateMessage(final Resource resource, 
final BaseControllerDataPr
                     pendingMessage, manager, resource, partition, 
sessionIdMap, instanceName,
                     stateModelDef, cancellationMessage, isCancellationEnabled);
           } else {
+          // Set currentReplicaNumber to provide metadata for potential 
message prioritization by participant
+            int currentReplicaNumber = -1; // -1 by default
+
+            // Check if this is an upward state transition from non-second top 
state to second top
+            // or top state
+            if (stateModelDef.isUpwardStateTransition(currentState, nextState)
+                && !stateModelDef.getSecondTopStates().contains(currentState)
+                && (isSecondTopState(nextState, stateModelDef)
+                    || stateModelDef.getTopState().contains(nextState))) {
+
+              // Assign the replica number for prioritization
+              currentReplicaNumber = replicaNumberCounter--;

Review Comment:
   I actually think a bit different. when we tell user the current replica 
number count.
   It should be the current up running replica - replicas will be gone in the 
future. Meaning if we are starting 3 replicas,  and there is no replica for the 
partition,  they all have '0' for currentReplicaNumber. 



-- 
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: reviews-unsubscr...@helix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org
For additional commands, e-mail: reviews-h...@helix.apache.org

Reply via email to