klion26 commented on a change in pull request #8459: [FLINK-12476] [State TTL] 
Consider setting a default background cleanup strategy in StateTtlConfig
URL: https://github.com/apache/flink/pull/8459#discussion_r285098205
 
 

 ##########
 File path: 
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/ttl/RocksDbTtlCompactFiltersManager.java
 ##########
 @@ -108,7 +110,16 @@ public void configCompactFilter(
                        @Nonnull StateDescriptor<?, ?> stateDesc,
                        TypeSerializer<?> stateSerializer) {
                StateTtlConfig ttlConfig = stateDesc.getTtlConfig();
-               if (ttlConfig.isEnabled() && 
ttlConfig.getCleanupStrategies().inRocksdbCompactFilter()) {
+
+               //if ttl is enable and cleanup in background and user did not 
specify the cleanup strategy
+               //then build the compact filter cleanup strategy and apply the 
default value
+               if (ttlConfig.isEnabled() && ttlConfig.isCleanupInBackground() 
&&
+                       
ttlConfig.getCleanupStrategies().getRocksdbCompactFilterCleanupStrategy() == 
null) {
+                       
ttlConfig.getCleanupStrategies().activate(ROCKSDB_COMPACTION_FILTER,
+                               new 
StateTtlConfig.RocksdbCompactFilterCleanupStrategy(1000L));
+               }
+
+               if (ttlConfig.getCleanupStrategies().inRocksdbCompactFilter()) {
 
 Review comment:
   Maybe we need to add `ttlConfig.isEnabled()` here?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to