rkhachatryan commented on code in PR #19679:
URL: https://github.com/apache/flink/pull/19679#discussion_r935686510
##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java:
##########
@@ -658,8 +685,6 @@ public void notifyCheckpointAborted(long checkpointId)
throws Exception {
stateDesc, snapshotTransformFactory,
newMetaInfo.getStateSerializer());
newMetaInfo.updateSnapshotTransformFactory(wrappedSnapshotTransformFactory);
- ttlCompactFiltersManager.configCompactFilter(stateDesc,
newMetaInfo.getStateSerializer());
Review Comment:
Could you explain why ths call was removed?
##########
flink-state-backends/flink-statebackend-changelog/src/test/java/org/apache/flink/state/changelog/ChangelogStateBackendMigrationTest.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.contrib.streaming.state.EmbeddedRocksDBStateBackend;
+import org.apache.flink.runtime.state.AbstractStateBackend;
+import org.apache.flink.runtime.state.CheckpointStorage;
+import org.apache.flink.runtime.state.StateBackendMigrationTestBase;
+import org.apache.flink.runtime.state.hashmap.HashMapStateBackend;
+import org.apache.flink.runtime.state.storage.JobManagerCheckpointStorage;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Supplier;
+
+/** Tests for the partitioned state part of {@link ChangelogStateBackend}. */
+@RunWith(Parameterized.class)
+public class ChangelogStateBackendMigrationTest
+ extends StateBackendMigrationTestBase<ChangelogStateBackend> {
+
+ @Parameterized.Parameters
+ public static List<Supplier<AbstractStateBackend>> modes() {
+ return Arrays.asList(
+ HashMapStateBackend::new,
+ () -> new EmbeddedRocksDBStateBackend(false),
+ () -> new EmbeddedRocksDBStateBackend(true));
+ }
+
+ @Parameterized.Parameter public Supplier<AbstractStateBackend>
delegatedStateBackendSupplier;
+
+ @Override
+ protected ChangelogStateBackend getStateBackend() throws Exception {
+ return new ChangelogStateBackend(delegatedStateBackendSupplier.get());
+ }
+
+ @Override
+ protected CheckpointStorage getCheckpointStorage() {
+ return new JobManagerCheckpointStorage();
+ }
+
+ @Override
+ public void testStateBackendRestoreFailsIfNewKeySerializerIsIncompatible()
{}
+
+ @Override
+ public void
testStateBackendRestoreFailsIfNewKeySerializerRequiresMigration() {}
+
+ @Override
+ public void
testStateBackendRestoreSucceedsIfNewKeySerializerRequiresReconfiguration() {}
Review Comment:
Could you explain (in the comments) why are these tests ignored?
Could you also add `@Ignore` for clarity?
##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java:
##########
@@ -825,6 +841,38 @@ public <N, SV, SEV, S extends State, IS extends S> IS
createInternalState(
@Nonnull StateDescriptor<S, SV> stateDesc,
@Nonnull StateSnapshotTransformFactory<SEV>
snapshotTransformFactory)
throws Exception {
+ Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N,
SV>> registerResult =
+ tryRegisterKvStateInformation(
+ stateDesc, namespaceSerializer,
snapshotTransformFactory, false);
+ ttlCompactFiltersManager.configCompactFilter(
+ stateDesc, registerResult.f1.getStateSerializer());
+
+ return createState(stateDesc, registerResult);
Review Comment:
Currently, this class implements all `KeyedStateFactory.createInternalState`
overloaded alternatives, which adds duplication and complexity.
Is it possible to call one `createInternalState()` from the other, passing
some default arguments (e.g. `allowFutureMetadataUpdates=false`)?
##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyedStateFactory.java:
##########
@@ -66,4 +66,32 @@ <N, SV, SEV, S extends State, IS extends S> IS
createInternalState(
@Nonnull StateDescriptor<S, SV> stateDesc,
@Nonnull StateSnapshotTransformFactory<SEV>
snapshotTransformFactory)
throws Exception;
+
+ /**
+ * Creates and returns a new {@link InternalKvState}.
+ *
+ * @param namespaceSerializer TypeSerializer for the state namespace.
+ * @param stateDesc The {@code StateDescriptor} that contains the name of
the state.
+ * @param snapshotTransformFactory factory of state snapshot transformer.
+ * @param allowFutureMetadataUpdates whether allow metadata to update in
the future or not.
+ * @param <N> The type of the namespace.
+ * @param <SV> The type of the stored state value.
+ * @param <SEV> The type of the stored state value or entry for collection
types (list or map).
+ * @param <S> The type of the public API state.
+ * @param <IS> The type of internal state.
+ */
+ @Nonnull
+ default <N, SV, SEV, S extends State, IS extends S> IS createInternalState(
Review Comment:
This method has createOrUpdate semantics, right?
(as well as the methods down the call chain)
If so, do you think they should be named accordingly?
##########
flink-state-backends/flink-statebackend-changelog/src/main/java/org/apache/flink/state/changelog/ChangelogKeyGroupedPriorityQueue.java:
##########
@@ -133,11 +133,25 @@ public StateChangeApplier
getChangeApplier(ChangelogApplierFactory factory) {
return factory.forPriorityQueue(delegatedPriorityQueue, serializer);
}
+ @Override
+ @SuppressWarnings("unchecked")
+ public <IS> void setDelegatedState(IS state) {
+ this.delegatedPriorityQueue = (KeyGroupedInternalPriorityQueue<T>)
checkNotNull(state);
+ }
+
+ public StateChangeLogger<T, Void> getStateChangeLogger() {
+ return logger;
+ }
+
@Override
public void resetWritingMetaFlag() {
logger.resetWritingMetaFlag();
}
+ public TypeSerializer<T> getSerializer() {
+ return serializer;
+ }
+
Review Comment:
I couldn't find any usages of this 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]