MarkGaox commented on code in PR #2595:
URL: https://github.com/apache/helix/pull/2595#discussion_r1298685175


##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/util/DelayedRebalanceUtil.java:
##########
@@ -129,15 +129,25 @@ private static Set<String> getActiveNodes(Set<String> 
allNodes, Set<String> live
   }
 
   /**
-   * @return The time when an offline or disabled instance should be treated 
as inactive.
-   * Return -1 if it is inactive now.
+   * Return the time when an offline or disabled instance should be treated as 
inactive. Return -1
+   * if it is inactive now or forced to be rebalanced by an on-demand 
rebalance.
+   *
+   * @return A timestamp that represents the expected inactive time of a node.
    */
   private static long getInactiveTime(String instance, Set<String> 
liveInstances, Long offlineTime,
       long delay, InstanceConfig instanceConfig, ClusterConfig clusterConfig) {
     long inactiveTime = Long.MAX_VALUE;
+    long lastOnDemandRebalanceTime = 
clusterConfig.getLastOnDemandRebalanceTimestamp();
 
-    // check the time instance went offline.
+    // Check if the given instance is offline
     if (!liveInstances.contains(instance)) {
+      // Check if the offline instance is forced to be rebalanced by an 
on-demand rebalance.
+      // If so, return it as an inactive instance.
+      if (isInstanceForcedToBeRebalanced(offlineTime, delay, 
lastOnDemandRebalanceTime)) {
+        return -1L;
+      }
+
+      // Check the time instance went offline.
       if (offlineTime != null && offlineTime > 0 && offlineTime + delay < 
inactiveTime) {
         inactiveTime = offlineTime + delay;
       }

Review Comment:
   Discussed offline. Will open a new PR to address this and the `static` 
keyword issue. 



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