Myasuka commented on code in PR #19142:
URL: https://github.com/apache/flink/pull/19142#discussion_r855747431
##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/AbstractKeyedStateBackend.java:
##########
@@ -155,6 +155,25 @@ public AbstractKeyedStateBackend(
this.keySelectionListeners = new ArrayList<>(1);
}
+ // Copy constructor
+ public AbstractKeyedStateBackend(AbstractKeyedStateBackend<K>
abstractKeyedStateBackend) {
Review Comment:
Can we introduce a `protected` contructor here, and let all contructors
leverage same private base contructor?
By doing so, we can then introduce another innner class within
`ChangelogMigrationRestoreTarget` which also extends for
`AbstractKeyedStateBackend`.
##########
flink-state-backends/flink-statebackend-changelog/src/main/java/org/apache/flink/state/changelog/DeactivatedChangelogStateBackend.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.state.changelog;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.runtime.execution.Environment;
+import org.apache.flink.runtime.state.CheckpointableKeyedStateBackend;
+import org.apache.flink.runtime.state.KeyGroupRange;
+import org.apache.flink.runtime.state.StateBackend;
+import org.apache.flink.runtime.state.changelog.ChangelogStateBackendHandle;
+import org.apache.flink.runtime.state.ttl.TtlTimeProvider;
+import
org.apache.flink.state.changelog.restore.ChangelogBackendRestoreOperation;
+import
org.apache.flink.state.changelog.restore.ChangelogBackendRestoreOperation.BaseBackendBuilder;
+import
org.apache.flink.state.changelog.restore.ChangelogMigrationRestoreTarget;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+/**
+ * This state backend use delegatedStateBackend and State changes to restore
to the
+ * delegatedStateBackend which used in switching Changelog from enabled to
disabled.
Review Comment:
```suggestion
* delegatedStateBackend in which switching Changelog from enabled to
disabled.
```
##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/metadata/MetadataV2V3SerializerBase.java:
##########
@@ -117,6 +117,8 @@ public abstract class MetadataV2V3SerializerBase {
private static final byte INCREMENTAL_KEY_GROUPS_HANDLE_V2 = 11;
// KEY_GROUPS_HANDLE_V2 is introduced to add new field of stateHandleId.
private static final byte KEY_GROUPS_HANDLE_V2 = 12;
+ private static final byte CHANGELOG_HANDLE_V2 = 13;
+ private static final byte CHANGELOG_FILE_INCREMENT_HANDLE_V2 = 14;
Review Comment:
Can we add descriptions in the code why we need to introduce these two new
flags here?
##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/changelog/StateChangelogStorageLoader.java:
##########
@@ -99,4 +101,24 @@ public static StateChangelogStorage<?> load(
return factory.createStorage(configuration, metricGroup);
}
}
+
+ @Nonnull
+ public static StateChangelogStorageView<?> load(ChangelogStateHandle
changelogStateHandle)
Review Comment:
Can we use a different name to distinguish this method with above `load`
method?
--
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]