tzulitai commented on a change in pull request #8565: [FLINK-11947] Support
MapState value schema evolution for RocksDB
URL: https://github.com/apache/flink/pull/8565#discussion_r289756359
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendMigrationTestBase.java
##########
@@ -303,6 +308,165 @@ private void testKeyedListStateUpgrade(
}
}
+ //
-------------------------------------------------------------------------------
+ // Tests for keyed MapState
+ //
-------------------------------------------------------------------------------
+
+ @Test
+ public void testKeyedMapStateAsIs() throws Exception {
+ final String stateName = "test-name";
+
+ testKeyedMapStateUpgrade(
+ new MapStateDescriptor<>(
+ stateName,
+ IntSerializer.INSTANCE,
+ new TestType.V1TestTypeSerializer()),
+ new MapStateDescriptor<>(
+ stateName,
+ IntSerializer.INSTANCE,
+ new TestType.V1TestTypeSerializer()));
+ }
+
+ @Test
+ public void testKeyedMapStateStateMigration() throws Exception {
+ final String stateName = "test-name";
+
+ testKeyedMapStateUpgrade(
+ new MapStateDescriptor<>(
+ stateName,
+ IntSerializer.INSTANCE,
+ new TestType.V1TestTypeSerializer()),
+ new MapStateDescriptor<>(
+ stateName,
+ IntSerializer.INSTANCE,
+ // restore with a V2 serializer that has a
different schema
+ new TestType.V2TestTypeSerializer()));
+ }
+
+ @Test
+ public void testKeyedMapStateSerializerReconfiguration() throws
Exception {
+ final String stateName = "test-name";
+
+ testKeyedMapStateUpgrade(
+ new MapStateDescriptor<>(
+ stateName,
+ IntSerializer.INSTANCE,
+ new TestType.V1TestTypeSerializer()),
+ new MapStateDescriptor<>(
+ stateName,
+ IntSerializer.INSTANCE,
+ // restore with a V2 serializer that has a
different schema
+ new
TestType.ReconfigurationRequiringTestTypeSerializer()));
+ }
+
+ @Test
+ public void
testKeyedMapStateRegistrationFailsIfNewStateSerializerIsIncompatible() {
+ final String stateName = "test-name";
+
+ try {
+ testKeyedMapStateUpgrade(new
MapStateDescriptor<>(stateName,
Review comment:
The line break / indentations are not consistent at all, making this very
hard to read.
Please follow the indentation pattern from lines 351-359.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services