StefanRRichter commented on a change in pull request #7163: [FLINK-10471][State 
TTL] State TTL cleanup using RocksDb compaction filter
URL: https://github.com/apache/flink/pull/7163#discussion_r251873842
 
 

 ##########
 File path: 
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java
 ##########
 @@ -1516,22 +1544,48 @@ private void copyStateDataHandleData(
        }
 
        /**
-        * Creates a column family handle for use with a k/v state.
+        * Restores a state info from a restored meta info to use with a k/v 
state.
         */
-       private ColumnFamilyHandle createColumnFamily(String stateName) {
-               byte[] nameBytes = 
stateName.getBytes(ConfigConstants.DEFAULT_CHARSET);
+       private RocksDbKvStateInfo restoreStateInfo(StateMetaInfoSnapshot 
restoredMetaInfo) {
+               ColumnFamilyOptions options = createColumnFamilyOptions();
+               FlinkCompactionFilterFactory compactionFilterFactory =
+                       
ttlCompactFilterUtils.setCompactFilterIfStateTtl(restoredMetaInfo, options);
+               String name = restoredMetaInfo.getName();
+               return new RocksDbKvStateInfo(createColumnFamily(options, 
name), compactionFilterFactory, null);
+       }
+
+       /**
+        * Creates a state info from a new meta info to use with a k/v state.
+        */
+       private RocksDbKvStateInfo createStateInfo(RegisteredStateMetaInfoBase 
metaInfoBase) {
 
 Review comment:
   I think it should not be required to have those two methods with essentially 
duplicate code, e.g. you can do 
`RegisteredStateMetaInfoBase.fromMetaInfoSnapshot(restoredMetaInfo);` and call 
`createStateInfo(RegisteredStateMetaInfoBase metaInfoBase)`

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to