Skip to content

Conversation

@azagrebin
Copy link
Contributor

What is the purpose of the change

This PR extends the cleanup of full snapshot from the expired state. A queue is added between a snapshotting thread which discovers expired state during its full scan and main thread which accesses state. The main thread incrementally pulls the queue and cleans up local state if still applicable.

Brief change log

  • add FullSnapshotCleanupStrategy config for this feature, users can activate it in state config builder StateTtlConfig.Builder.cleanupFullSnapshotAndLocalState
  • Add key and namespace parameters to StateSnapshotTransformer interface to save expired keys in queue and address state later for cleanup
  • Parse key/namespace bytes in RocksDb and pass them in both backends to StateSnapshotTransformer
  • add TtlIncrementalCleanup service which wraps queue with expiration specific add/pull logic
  • add call from TtlStateSnapshotTransformer to TtlIncrementalCleanup.addIfExpired to enqueue expired keys
  • add callback from states to TtlIncrementalCleanup.stateAccessed when state is touched
  • add check/cleanup in TTL state wrappers when pulled from queue AbstractTtlState.cleanupIfExpired
  • add test for the feature TtlStateTestBase.testFullSnapshotCleanupQueue

Verifying this change

unit tests of TTL logic.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (yes)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? (not documented)

@azagrebin
Copy link
Contributor Author

cc @StefanRRichter

@yanghua
Copy link
Contributor

yanghua commented Aug 14, 2018

checkstyle errors :

16:40:29.994 [ERROR] src/main/java/org/apache/flink/runtime/state/ttl/AbstractTtlState.java:[21,8] (imports) UnusedImports: Unused import: org.apache.flink.api.common.state.StateTtlConfig.
16:40:29.994 [ERROR] src/main/java/org/apache/flink/runtime/state/ttl/TtlAggregatingState.java:[21,8] (imports) UnusedImports: Unused import: org.apache.flink.api.common.state.StateTtlConfig.
16:40:29.994 [ERROR] src/main/java/org/apache/flink/runtime/state/ttl/TtlAggregatingState.java:[22,8] (imports) UnusedImports: Unused import: org.apache.flink.api.common.typeutils.TypeSerializer.
16:40:29.994 [ERROR] src/main/java/org/apache/flink/runtime/state/ttl/TtlFoldingState.java:[22,8] (imports) UnusedImports: Unused import: org.apache.flink.api.common.state.StateTtlConfig.
16:40:29.994 [ERROR] src/main/java/org/apache/flink/runtime/state/ttl/TtlFoldingState.java:[23,8] (imports) UnusedImports: Unused import: org.apache.flink.api.common.typeutils.TypeSerializer.

@azagrebin
Copy link
Contributor Author

azagrebin commented Mar 23, 2019

Closing in favour of proper cleanup strategies #7163 and #7188

@azagrebin azagrebin closed this Mar 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants