Aleksey Plekhanov created IGNITE-24793:
------------------------------------------

             Summary: Expired entries are not properly deleted sometimes
                 Key: IGNITE-24793
                 URL: https://issues.apache.org/jira/browse/IGNITE-24793
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksey Plekhanov


There is expired entries leak if TTL of entry updated during expiration. See 
{{UpdateClosure.call}} method. If 
{{checkRowExpired}} returns null value (entry is expired), pending entries tree 
is not cleared after update (in {{finishUpdate}} method) and the old row is not 
deleted from data pages (but data tree refers to the new row). Moreover, entry 
stays in heap entry map with wrong TTL and not expired after timeout. So, in 
this case we have: 2 rows in data pages, 2 rows in pending tree, 1 row in data 
tree (refers to the last data row) and doubled rows in the index trees (refer 
to the old data and to the new data row). After TTL cleanup by timeout pending 
entries rows are deleted, but data rows and other structures are not cleaned 
due to spoiled heap map entry. Old data row can't be deleted at all even if we 
delete the entry by key explicetely.
Reproducer:
{code:java}
/** */
@Test
@WithSystemProperty(key = 
IgniteSystemProperties.IGNITE_UNWIND_THROTTLING_TIMEOUT, value = "4000")
public void testEntriesLeak() throws Exception {
    IgniteEx srv = 
startGrid(getConfiguration().setIncludeEventTypes(EVT_CACHE_OBJECT_READ));

    srv.events().localListen(evt -> {
        doSleep(2000L);
        return true;
    }, EVT_CACHE_OBJECT_READ);

    IgniteCache<Object, Object> cache = srv.getOrCreateCache(DEFAULT_CACHE_NAME)
        .withExpiryPolicy(new TouchedExpiryPolicy(new Duration(SECONDS, 1)));

    cache.put(1, 1);
    cache.get(1);

    assertTrue(GridTestUtils.waitForCondition(() -> 
cache.size(CachePeekMode.PRIMARY) == 0, 5_000L));
} {code}
  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to