KarmaGYZ commented on a change in pull request #7188: [FLINK-10473][State TTL] TTL state incremental cleanup for heap backend URL: https://github.com/apache/flink/pull/7188#discussion_r242114799
########## File path: docs/dev/stream/state/state.md ########## @@ -394,6 +396,47 @@ val ttlConfig = StateTtlConfig This option is not applicable for the incremental checkpointing in the RocksDB state backend. +##### Incremental cleanup + +Another option is to trigger cleanup of some state entries incrementally. +The trigger can be a callback from each state access or/and each record processing. +If this cleanup strategy is active for certain state, +The storage backend keeps a lazy global iterator for this state over all its entries. +Every time incremental cleanup is triggered, the iterator is advanced. +The traversed state entries are checked and expired ones are cleaned up. + +This feature can be activated in `StateTtlConfig`: + +<div class="codetabs" markdown="1"> +<div data-lang="java" markdown="1"> +{% highlight java %} +import org.apache.flink.api.common.state.StateTtlConfig; + StateTtlConfig ttlConfig = StateTtlConfig + .newBuilder(Time.seconds(1)) + .cleanupInRocksdbCompactFilter() Review comment: It should be cleanupIncrementally. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services