1996fanrui commented on code in PR #677: URL: https://github.com/apache/flink-kubernetes-operator/pull/677#discussion_r1333849523
########## flink-autoscaler/src/main/java/org/apache/flink/autoscaler/state/AutoScalerStateStore.java: ########## @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.autoscaler.state; + +import org.apache.flink.annotation.Experimental; +import org.apache.flink.autoscaler.JobAutoScalerContext; + +/** + * The state store is responsible for store all states during scaling. + * + * @param <KEY> The job key. + * @param <Context> Instance of JobAutoScalerContext. + */ +@Experimental +public interface AutoScalerStateStore<KEY, Context extends JobAutoScalerContext<KEY>> { + + void storeScalingHistory(Context jobContext, String scalingHistory); Review Comment: Hi @Samrat002 , thanks for your feedback! I have updated these method parameters of `AutoScalerStateStore` to the specific class instead of String, such as: `Map<JobVertexID, SortedMap<Instant, ScalingSummary>> scalingHistory`. ``` public interface AutoScalerStateStore<KEY, Context extends JobAutoScalerContext<KEY>> { void storeScalingHistory( Context jobContext, Map<JobVertexID, SortedMap<Instant, ScalingSummary>> scalingHistory); Optional<Map<JobVertexID, SortedMap<Instant, ScalingSummary>>> getScalingHistory( Context jobContext); void removeScalingHistory(Context jobContext); } ``` The PR has been updated as well. Do you think is it ok? It means the state store is responsible for how to serialize and deserialize, for example: - The default `KubernetesAutoScalerStateStore` will serialize all states to String inside of `KubernetesAutoScalerStateStore` - As you mentioned before: if there is any complex type in the future. Each state store to determine how to serialize them. Also, let me add a reason why update these parameters here: Currently, all states are stored at ConfigMap, and it has size limitation. The size limitation should just work with `KubernetesAutoScalerStateStore`, and size limitation is a part of serialization. So we should move the serialization and deserialization in the `AutoScalerStateStore`. -- 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]
