azagrebin 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_r287878198
##########
File path:
flink-core/src/main/java/org/apache/flink/api/common/state/StateTtlConfig.java
##########
@@ -322,11 +329,22 @@ public Builder cleanupInRocksdbCompactFilter() {
*/
@Nonnull
public Builder cleanupInRocksdbCompactFilter(long
queryTimeAfterNumEntries) {
-
cleanupStrategies.activate(CleanupStrategies.Strategies.ROCKSDB_COMPACTION_FILTER,
+
strategies.put(CleanupStrategies.Strategies.ROCKSDB_COMPACTION_FILTER,
new
RocksdbCompactFilterCleanupStrategy(queryTimeAfterNumEntries));
return this;
}
+ /**
+ * Enable cleanup of expired state in background.
+ *
+ * <p>Depending on actually used backend, the corresponding
cleanup will kick in if supported.
+ */
+ @Nonnull
+ public Builder cleanupInBackground() {
Review comment:
I suggest we add a simple unit test for this method where `StateTtlConfig`
is built like in the doc example with `cleanupInBackground` and test checks
that `StateTtlConfig.getCleanupStrategies().isCleanupInBackground()` is `true`,
`getIncrementalCleanupStrategy()` is not null,
`getIncrementalCleanupStrategy()getCleanupSize()` is 5 etc.
----------------------------------------------------------------
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