mxm commented on code in PR #710:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/710#discussion_r1392789442


##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/JobAutoScalerImpl.java:
##########
@@ -121,37 +120,10 @@ public void cleanup(KEY jobKey) {
     }
 
     private void clearStatesAfterAutoscalerDisabled(Context ctx) throws 
Exception {
-        var needFlush = false;
-        var parallelismOverrides = stateStore.getParallelismOverrides(ctx);
-        if (!parallelismOverrides.isEmpty()) {
-            needFlush = true;
-            stateStore.removeParallelismOverrides(ctx);
-        }
-
-        var collectedMetrics = stateStore.getCollectedMetrics(ctx);
-        if (!collectedMetrics.isEmpty()) {
-            needFlush = true;
-            stateStore.removeCollectedMetrics(ctx);
-        }
-
-        var scalingHistory = stateStore.getScalingHistory(ctx);
-        if (!scalingHistory.isEmpty()) {
-            var trimmedScalingHistory =
-                    trimScalingHistory(clock.instant(), 
ctx.getConfiguration(), scalingHistory);
-            if (trimmedScalingHistory.isEmpty()) {
-                // All scaling histories are trimmed.
-                needFlush = true;
-                stateStore.removeScalingHistory(ctx);
-            } else if (!scalingHistory.equals(trimmedScalingHistory)) {
-                // Some scaling histories are trimmed.
-                needFlush = true;
-                stateStore.storeScalingHistory(ctx, trimmedScalingHistory);
-            }
-        }
-
-        if (needFlush) {
-            stateStore.flush(ctx);
-        }
+        stateStore.removeParallelismOverrides(ctx);
+        stateStore.removeCollectedMetrics(ctx);
+        stateStore.removeScalingHistory(ctx);
+        stateStore.flush(ctx);

Review Comment:
   Done.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to