HIVE-30033: Hive K8s operator: log replica changes - #6773
abstractdog wants to merge 2 commits into
Conversation
5959b04 to
28daa2a
Compare
28daa2a to
5e88135
Compare
|
| } | ||
| Integer current = Workloads.replicas(existing.get()); | ||
| if (current != null && !current.equals(desired)) { | ||
| LOG.info("Scaling {} {}/{}: {} -> {} replicas", component, ns, name, current, desired); |
There was a problem hiding this comment.
Maybe "Setting replica count for {} to {}?" maybe we can join both crate and scale ?
| Optional<R> existing = getSecondaryResource(primary, context); | ||
| Integer resolved = computeReplicaCount(primary, existing, autoscaling, | ||
| staticReplicas, initialReplicas); | ||
| logReplicaChange(primary, existing, resolved); |
There was a problem hiding this comment.
do we log even when existing is empty? log on boostrap, first creation ?
| ? s.getSpec().getReplicas() : initialReplicas; | ||
| } | ||
| return initialReplicas; | ||
| Integer current = Workloads.replicas(existing.get()); |
There was a problem hiding this comment.
can the current be null if existing.isPresent()?
| */ | ||
| private void logReplicaChange(P primary, Optional<R> existing, Integer desired) { | ||
| String component = getComponentName(); | ||
| if (component == null || desired == null) { |
| @@ -208,17 +208,22 @@ public static PodDisruptionBudget buildPdb(HiveCluster hc, LlapSpec llap) { | |||
|
|
|||
| /** TezAM Deployment/Service name for a specific LLAP cluster. */ | |||
There was a problem hiding this comment.
For TezAM we have statefullset, not deployment, no? That actually makes me wonder why we have deployment for LLAP that doesn't allow parallel botstrap and rolling upgrade is sequential
| * operator was doing nothing. Read failures are swallowed at DEBUG: the SSA below runs either | ||
| * way, and a missing pre-scale line is not worth failing the reconcile over. | ||
| */ | ||
| private void logReplicaChange(KubernetesClient client, String ns, String workloadName, |
There was a problem hiding this comment.
can we generalize log method or need both?
| * Returns spec.replicas from a Deployment or StatefulSet, or null when the resource is | ||
| * absent, has no spec, or the field is unset. A non-workload resource returns null too. | ||
| */ | ||
| public static Integer replicas(HasMetadata resource) { |
There was a problem hiding this comment.
iDK, should it be optional? replicas can't be null unless deployment/sts not running



What changes were proposed in this pull request?
Log an INFO line in the reconciler whenever a HiveCluster component is created or scaled to a different replica count. Covers LLAP, TezAM, HiveServer2 and Metastore.
Why are the changes needed?
Scales driven by an SSA on the CR (helm upgrade,
kubectl edit, a tool changing.spec.*.replicas) reached the workload silently — only the autoscaler path logged. On a scale that didn't converge you couldn't tell from the operator log whether the reconciler had seen the change at all.Does this PR introduce any user-facing change?
Operator log only. Example:
INFO HiveDependentResource: Scaling hiveserver2 lbodor-perf/hive-hiveserver2: 2 -> 1 replicas
INFO HiveDependentResource: Scaling metastore lbodor-perf/hive-metastore: 2 -> 1 replicas
INFO HiveClusterReconciler: Scaling llap lbodor-perf/hive-llap0: 12 -> 15 replicas
Silence still means "no change" — the log fires only on a real delta.
How was this patch tested?
Manually on an EKS cluster: scaled HS2, Metastore and LLAP up and down; confirmed the "Scaling …: A -> B replicas" line on each real change and no line when the count already matched.