1996fanrui commented on code in PR #928:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/928#discussion_r1908565827


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/AbstractFlinkResourceReconciler.java:
##########
@@ -185,11 +185,26 @@ private Optional<String> 
getInitialSnapshotPath(AbstractFlinkSpec spec) {
 
     private void applyAutoscaler(FlinkResourceContext<CR> ctx) throws 
Exception {
         var autoScalerCtx = ctx.getJobAutoScalerContext();
+        var resource = ctx.getResource();
         boolean autoscalerEnabled =
-                ctx.getResource().getSpec().getJob() != null
+                resource.getSpec().getJob() != null
                         && 
ctx.getObserveConfig().getBoolean(AUTOSCALER_ENABLED);
         autoScalerCtx.getConfiguration().set(AUTOSCALER_ENABLED, 
autoscalerEnabled);
 
+        var reconStatus = resource.getStatus().getReconciliationStatus();
+        if (!reconStatus.isBeforeFirstDeployment() && autoscalerEnabled) {
+            var newResetNonce = 
resource.getSpec().getJob().getAutoscalerResetNonce();
+            // check if the nonce changed to a non-null value
+            if (newResetNonce != null
+                    && !newResetNonce.equals(
+                            reconStatus
+                                    .deserializeLastReconciledSpec()
+                                    .getJob()
+                                    .getAutoscalerResetNonce())) {
+                autoscaler.cleanup(autoScalerCtx.getJobKey());

Review Comment:
    I'm not sure do we need to clean up the ` 
PipelineOptions.PARALLELISM_OVERRIDES` from spec conf?
   
   Also, `JobAutoScalerImpl#cleanup` calls 
`AutoScalerStateStore#removeInfoFromCache`, so we only cleaned the cache, and 
the config map isn't cleaned, do we need to clean them from config map? 
(JdbcAutoScalerStateStore doesn't clean data from database as well.)



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

Reply via email to