rkhachatryan commented on code in PR #20313:
URL: https://github.com/apache/flink/pull/20313#discussion_r934545515


##########
flink-runtime/src/test/java/org/apache/flink/runtime/state/SharedStateRegistryTest.java:
##########
@@ -182,20 +194,113 @@ public void testRegisterChangelogStateBackendHandles() 
throws InterruptedExcepti
     }
 
     @Test
-    public void testUnregisterUnusedState() {
+    public void testUnregisterUnusedSavepointState() {
         SharedStateRegistry sharedStateRegistry = new 
SharedStateRegistryImpl();
         TestingStreamStateHandle handle = new TestingStreamStateHandle();
-        sharedStateRegistry.registerReference(new 
SharedStateRegistryKey("first"), handle, 1L);
-        sharedStateRegistry.registerReference(new 
SharedStateRegistryKey("first"), handle, 2L);
-        sharedStateRegistry.registerReference(new 
SharedStateRegistryKey("first"), handle, 3L);
+
+        registerInitialCheckpoint(
+                sharedStateRegistry,
+                RESTORED_STATE_ID,
+                CheckpointProperties.forSavepoint(false, 
SavepointFormatType.NATIVE));
+
+        sharedStateRegistry.registerReference(

Review Comment:
   I'm not sure I fully understand your comment, but shared state is discarded 
either when it's not used, or a **different** entry is submitted for the same 
key (that's probably what you meant). 
   There is no contract to use placeholder; state backend might also send the 
same state handle.
   If a different non-placeholder entry is submitted then it depends on whether 
the existing entry is already a part of a completed checkpoint. If it is, then 
the new entry will be discarded; otherwise, the existing entry will be 
discarded.



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