I read Apache Flink documentation about State Time-TO-Live https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/state.html#state-time-to-live-ttl
And I don't understand two moments.
1)
StateTTLConfig ttl = StateTtlConfig
.newBuilder(Time.minutes(60))
.setUpdateType(StateTtlConfig.UpdateType.OnCreateAndWrite)
.setStateVisibility(StateTtlConfig.StateVisibility.NeverReturnExpired)
.build();
//And use in my Process Function
valueStateDescriptor.enableTimeToLive(ttl);
If I will put in ValueState some element in 15:00 and then stop my job with savepoint and only in 17:00 i will start my job from last savepoint.
Value State will be clear, am i right?
2) If I use Apache Flink CEP Pattern:
.begin("a")
.where(simpleConditionA)
.followedBy("b")
.where(simpleConditionB)
.within(Time.minutes(60));
If I will get A element in 15:00 and then stop my job with savepoint and only in 17:00 i will start my job from last savepoint. And get B element, pattern not be match am i right?
How it (ttl) work with Apache Flink CEP Pattern?
Thanks.
I understand about CEP, I am really using ingestion time. I will try to explain: I use Process Function with ValueState, with timerTime, and I clear state in onTimer method. I put in state (keyedstate) some element, set timer on 1 hour and execute some logic. Basically value state + timer is used as an output limiter (1 output message in 1 hour). In my company we need to stop running job (with savepoint) on cluster and then after a couple of hours we will need to restart job from last savepoint. Now I am not using TTL, and after restart, my ValueState.value not null. I want after restart in less than a hour ValueState.value not null ( if i put in state before stop), but more than a hour value state always will be null.
P.s I use RrocksDb state backend, incremental checkpoints with interval 1s. It works perfectly.))