rkhachatryan commented on a change in pull request #17945:
URL: https://github.com/apache/flink/pull/17945#discussion_r761393530



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyedStateBackend.java
##########
@@ -137,10 +137,25 @@
      */
     boolean deregisterKeySelectionListener(KeySelectionListener<K> listener);
 
+    @Deprecated
     default boolean isStateImmutableInStateBackend(CheckpointType 
checkpointOptions) {
         return false;
     }
 
+    /**
+     * Whether it's safe to reuse key-value from the state-backend, e.g for 
the purpose of
+     * optimization.
+     *
+     * <p>NOTE: this method should not be used to check for {@link 
InternalPriorityQueue}, as the
+     * priority queue could be stored on different locations, e.g RocksDB 
state-backend could store
+     * that on JVM heap if configuring HEAP as the time-service factory.
+     *
+     * @return returns ture if safe to reuse the key-value from the 
state-backend.
+     */
+    default boolean isSafeToReuseState() {

Review comment:
       With this change, there are:
   - `KeyedStateBackend.isSafeToReuseState`
   - `AbstractKeyedStateBackend.requiresLegacySynchronousTimerSnapshots`
   
   which I think serve the same purpose but for KV and PQ states.
   
   How about  having them both in `KeyedStateBackend` and name accordingly (KV 
and PQ for example)? I think this would make API more symmetric and explicit.




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