Zakelly commented on code in PR #25035:
URL: https://github.com/apache/flink/pull/25035#discussion_r1767916246


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/ttl/TtlValueState.java:
##########
@@ -32,7 +32,7 @@
  * @param <N> The type of the namespace
  * @param <T> Type of the user value of state with TTL
  */
-class TtlValueState<K, N, T>
+public class TtlValueState<K, N, T>

Review Comment:
   Why this is going public?



##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/StateSerializerProvider.java:
##########
@@ -303,8 +304,26 @@ public TypeSerializerSchemaCompatibility<T> 
registerNewSerializerForRestoredStat
                         "A serializer has already been registered for the 
state; re-registration is not allowed.");
             }
 
+            TypeSerializer<T> originalSerializer = newSerializer;
+            if (previousSerializerSnapshot != null) {
+                TypeSerializer<T> previousSerializer = 
previousSchemaSerializer();
+                if 
(TtlStateFactory.TtlSerializer.isMigrateFromDisablingToEnabling(
+                        previousSerializer, newSerializer)) {
+                    originalSerializer =
+                            (TypeSerializer<T>)
+                                    
TtlStateFactory.TtlSerializer.extractOriginalTypeSerializer(
+                                            newSerializer);
+                } else if 
(TtlStateFactory.TtlSerializer.isMigrateFromEnablingToDisabling(
+                        previousSerializer, newSerializer)) {
+                    previousSerializer =
+                            (TypeSerializer<T>)
+                                    
TtlStateFactory.TtlSerializer.extractOriginalTypeSerializer(
+                                            previousSerializer);
+                    previousSerializerSnapshot = 
previousSerializer.snapshotConfiguration();

Review Comment:
   IIUC, it's better not update the member `previousSerializerSnapshot` here?



##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/StateSerializerProvider.java:
##########
@@ -325,6 +344,12 @@ public TypeSerializerSchemaCompatibility<T> 
setPreviousSerializerSnapshotForRest
             throw new UnsupportedOperationException(
                     "The snapshot of the state's previous serializer has 
already been set; cannot reset.");
         }
+
+        private boolean isTtlMigration(TypeSerializer<T> newSerializer) {

Review Comment:
   Seems unused?



-- 
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]

Reply via email to