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


##########
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:
   The rationale here is that state transitions (STs) from secondary top state 
to top state are already prioritized by recovery rebalance, so this metadata 
becomes redundant for those transitions.
   
   That said, I don't see any issues with adding this metadata for the current 
transition logic. We're simply indicating how many replicas are active at any 
given point in time. However, I'm concerned that surfacing this metadata for 
state transitions that aren't part of load balancing could create confusion.
   
   Would it make sense to scope this metadata only to load balance-related 
transitions to maintain clarity? I can update the comments in this case to add 
clarity.



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