Copilot commented on code in PR #6814:
URL: https://github.com/apache/hive/pull/6814#discussion_r4077799032


##########
packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/autoscaling/HiveClusterAutoscaler.java:
##########
@@ -81,6 +81,14 @@ public static void setManagedReplicas(String namespace, 
String clusterName,
     MANAGED_REPLICAS.put(cacheKey(namespace, clusterName, component), 
replicas);
   }
 
+  /**
+   * Removes the autoscaler-managed replica count for a component. Used when 
autoscaling is disabled so
+   * a pre-existing in-memory scale decision if any is cleared up.
+   */
+  public static void cleanupManagedReplicas(String namespace, String 
clusterName, String component) {
+    MANAGED_REPLICAS.remove(cacheKey(namespace, clusterName, component));

Review Comment:
   This only removes the value from `MANAGED_REPLICAS`, but disabling a 
component can leave a pending two-phase scale-down in `pendingScaleDowns` (and 
stale `ComponentAutoscaler` stabilization state) in the same autoscaler 
instance. If autoscaling is re-enabled before that pending entry is consumed, 
`evaluate()` can apply the old target before evaluating the new configuration, 
overriding the static replica count or new limits. Clear/cancel the component's 
pending and decision state as part of disabling it, not just the managed value.



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