flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] tzulitai commented on a change in pull request #6467: [FLINK-9887] Ensure serializer upgrades work with timer service remake
Date Thu, 02 Aug 2018 09:47:46 GMT
tzulitai commented on a change in pull request #6467: [FLINK-9887] Ensure serializer upgrades
work with timer service remake
URL: https://github.com/apache/flink/pull/6467#discussion_r207165014
 
 

 ##########
 File path: flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java
 ##########
 @@ -2668,23 +2668,54 @@ public static RocksIteratorWrapper getRocksIterator(
 			@Nonnull String stateName,
 			@Nonnull TypeSerializer<T> byteOrderedElementSerializer) {
 
-			final PriorityComparator<T> priorityComparator =
-				PriorityComparator.forPriorityComparableObjects();
-
-			Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase> entry =
+			Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase> metaInfoTuple =
 				kvStateInformation.get(stateName);
 
-			if (entry == null) {
+			if (metaInfoTuple == null) {
+				final ColumnFamilyHandle columnFamilyHandle = createColumnFamily(stateName);
+
 				RegisteredPriorityQueueStateBackendMetaInfo<T> metaInfo =
 					new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer);
 
-				final ColumnFamilyHandle columnFamilyHandle = createColumnFamily(stateName);
+				metaInfoTuple = new Tuple2<>(columnFamilyHandle, metaInfo);
+				kvStateInformation.put(stateName, metaInfoTuple);
+			} else {
+				// TODO we implement the simple way of supporting the current functionality, mimicking
keyed state
+				// because this should be reworked in FLINK-9376 and then we should have a common algorithm
over
+				// StateMetaInfoSnapshot that avoids this code duplication.
+				StateMetaInfoSnapshot restoredMetaInfoSnapshot = restoredKvStateMetaInfos.get(stateName);
+
+				Preconditions.checkState(
+					restoredMetaInfoSnapshot != null,
+					"Requested to check compatibility of a restored RegisteredKeyedBackendStateMetaInfo,"
+
+						" but its corresponding restored snapshot cannot be found.");
+
+				StateMetaInfoSnapshot.CommonSerializerKeys serializerKey =
+					StateMetaInfoSnapshot.CommonSerializerKeys.VALUE_SERIALIZER;
+
+				TypeSerializer<?> metaInfoTypeSerializer = restoredMetaInfoSnapshot.getTypeSerializer(serializerKey);
+
+				if (metaInfoTypeSerializer != byteOrderedElementSerializer) {
+					CompatibilityResult<T> compatibilityResult = CompatibilityUtil.resolveCompatibilityResult(
+						metaInfoTypeSerializer,
+						null,
+						restoredMetaInfoSnapshot.getTypeSerializerConfigSnapshot(serializerKey),
+						byteOrderedElementSerializer);
+
+					if (compatibilityResult.isRequiresMigration()) {
+						throw new FlinkRuntimeException(
+							new StateMigrationException("Migration is currently not supported."));
 
 Review comment:
   nit: `"State migreation is currently not supported!"` just for the sake of consistency.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message