[ 
https://issues.apache.org/jira/browse/FLINK-10473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17068381#comment-17068381
 ] 

dalongliu commented on FLINK-10473:
-----------------------------------

[~azagrebin] thks for your reply, I have debuggger stops in 
TtlIncrementalCleanup#runCleanup:81, successed. But I still have some doubts 
about incremental clean up, I write a new incremental clean up test in 
TtlStateTestBase as follows:
{code:java}
@Test 
1  public void testIncrementalCleanup2() throws Exception { 
2      assumeTrue(incrementalCleanupSupported()); 
3      initTest(getConfBuilder(TTL).cleanupIncrementally(5, false).build()); 
4      final int keysToUpdate = 2; 
5      timeProvider.time = 0; 
6      // create 8 keys 
7      updateKeys(0, 8, ctx().updateEmpty); 
8      timeProvider.time = 50; 
9      // update some keys
10     updateKeys(0, keysToUpdate, ctx().updateUnexpired); 
11     // expire rest  
12     timeProvider.time = 120; 
13     updateKeys(keysToUpdate, keysToUpdate * 2, ctx().updateUnexpired); 
14     // check rest expired and cleanup updated 
15     checkExpiredKeys(keysToUpdate * 2, 8); 
}
{code}
First, I write 8 keys to state in line 7, then set timeProvider.time = 50, 

Second, update 2 keys (0, 1) in line 10,  then timeProvider.time = 120 let ttl 
expired

Last, I update 2 keys (2, 3), then check the rest keys wether expired in line 
15.

In my opinion, rest keys of (4, 5, 6, 7) has expired because of incremental 
clean up, actually they are not expired. So why are the keys  not expired? I 
didn't understand. The way of incremental clean up in my test is wrong? How can 
I make the incremental clean up work?

Meanwhile, I have some doubt about 
CopyOnWriteStateMap$StateEntryChainIterator.{color:#ff0000}nextMapPosition 
{color:#172b4d}function, I found it monotone increasing when call 
TtlIncrementalCleanup#runCleanup, that cause can not enter for loop of this 
method, can you explain more about it{color}{color}

Best regards!

 

 

> State TTL incremental cleanup using Heap backend key iterator
> -------------------------------------------------------------
>
>                 Key: FLINK-10473
>                 URL: https://issues.apache.org/jira/browse/FLINK-10473
>             Project: Flink
>          Issue Type: New Feature
>          Components: Runtime / State Backends
>    Affects Versions: 1.7.0
>            Reporter: Andrey Zagrebin
>            Assignee: Andrey Zagrebin
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.8.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> This feature enables lazy background cleanup of state with time-to-live in 
> state keyed backend which stores state in JVM heap. The idea is to keep a 
> global state lazy iterator with loose consistency. Every time a state value 
> for some key is accessed or a record is processed, the iterator is advanced, 
> TTL of iterated state entries is checked and the expired entries are cleaned 
> up. When the iterator reaches the end of state storage it just starts over. 
> This way the state with TTL is regularly cleaned up to prevent ever growing 
> memory consumption. The caveat of this cleanup strategy is that if state is 
> not accessed or no records are processed then accumulated expired state still 
> occupies the storage.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to