deniskuzZ commented on code in PR #6773:
URL: https://github.com/apache/hive/pull/6773#discussion_r4036785093


##########
packaging/src/kubernetes/src/java/org/apache/hive/kubernetes/operator/dependent/HiveDependentResource.java:
##########
@@ -186,21 +195,37 @@ protected Integer resolveReplicaCount(P primary, 
Context<P> context,
         return managed;
       }
       // Fallback: operator restarted and MANAGED_REPLICAS is empty — read 
current value
-      R resource = existing.get();
-      if (resource instanceof io.fabric8.kubernetes.api.model.apps.Deployment 
d) {
-        return d.getSpec() != null && d.getSpec().getReplicas() != null
-            ? d.getSpec().getReplicas() : initialReplicas;
-      }
-      if (resource instanceof io.fabric8.kubernetes.api.model.apps.StatefulSet 
s) {
-        return s.getSpec() != null && s.getSpec().getReplicas() != null
-            ? s.getSpec().getReplicas() : initialReplicas;
-      }
-      return initialReplicas;
+      Integer current = Workloads.replicas(existing.get());
+      return current != null ? current : initialReplicas;
     }
     // First creation: start at minReplicas.
     return initialReplicas;
   }
 
+  /**
+   * Emits an INFO line when the SSA about to run will actually change the 
workload's replica
+   * count. Silence means the count already matches, so no scale is happening. 
Without this,
+   * every scale of an HS2/Metastore Deployment reached the cluster silently 
(only the imperative
+   * LLAP path and the autoscaler logged); a bare "Reconciled" line said 
nothing about the size.
+   * Uses the same "Scaling ... A -> B" shape the imperative LLAP path emits.
+   */
+  private void logReplicaChange(P primary, Optional<R> existing, Integer 
desired) {
+    String component = getComponentName();
+    if (component == null || desired == null) {
+      return;
+    }
+    String ns = primary.getMetadata().getNamespace();
+    String name = existing.map(r -> 
r.getMetadata().getName()).orElse(component);
+    if (existing.isEmpty()) {
+      LOG.info("Creating {} {}/{} with {} replicas", component, ns, name, 
desired);
+      return;
+    }
+    Integer current = Workloads.replicas(existing.get());
+    if (current != null && !current.equals(desired)) {
+      LOG.info("Scaling {} {}/{}: {} -> {} replicas", component, ns, name, 
current, desired);

Review Comment:
   Maybe "Setting replica count for {} to {}?"



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