[infinispan-issues] [JBoss JIRA] (ISPN-4187) LRU eviction algorithm does not evict the eldest entry

Martin Gencur (JIRA) issues at jboss.org
Thu Apr 3 10:19:13 EDT 2014


Martin Gencur created ISPN-4187:
-----------------------------------

             Summary: LRU eviction algorithm does not evict the eldest entry
                 Key: ISPN-4187
                 URL: https://issues.jboss.org/browse/ISPN-4187
             Project: Infinispan
          Issue Type: Bug
          Components: Eviction
    Affects Versions: 7.0.0.Alpha2
            Reporter: Martin Gencur
            Assignee: William Burns


The following test for JDBC cache stores fails:
{code:java}
@Test
    @WithRunningServer({@RunningServer(name = CONTAINER1, config = CONFIG_FETCH_STATE_1)})
    public void testFetchState() throws Exception {
        try {
            mc1 = createMemcachedClient(server1);
            assertCleanCacheAndStore1();
            mc1.set("k1", "v1");
            mc1.set("k2", "v2");
            mc1.set("k3", "v3");
            assertNotNull(dbServer1.stringTable.getValueByKey("k1"));
            startContainer(controller, CONTAINER2, CONFIG_FETCH_STATE_2);
            mc2 = createMemcachedClient(server2);
            assertTrue(0 < server2.getCacheManager(MANAGER_NAME).getCache(CACHE_NAME).getNumberOfEntries());
            //the cache store should fetch state from the others
            //since eviction.max-entries==2, first k2 and k3 is loaded from the other cache, then k1 is loaded
            //from the other cache's loader and thus k2 is evicted and ends up in a cache loader
            assertNull(dbServer2.stringTable.getValueByKey("k1"));
            assertEquals("v1", mc2.get("k1"));
            assertEquals("v2", mc2.get("k2"));
            System.out.println("1)" + dbServer2.stringTable.getValueByKey("k1"));
            System.out.println("2)" + dbServer2.stringTable.getValueByKey("k2"));
            System.out.println("3)" + dbServer2.stringTable.getValueByKey("k3"));
            System.out.println("NumEntries:" + server2.getCacheManager(MANAGER_NAME).getCache(CACHE_NAME).getNumberOfEntries());
            assertNull(dbServer2.stringTable.getValueByKey("k1"));
//^^^^^fails here, the K1 was evicted even though it was used recently
//K3 was supposed to be evicted but it did not happen
            assertNull(dbServer2.stringTable.getValueByKey("k2"));
            assertCleanCacheAndStore2();
        } finally {
            controller.stop(CONTAINER2);
        }
    }
{code}

This tests works properly if the following commit is reverted, so it was caused by this commit:
https://github.com/infinispan/infinispan/commit/b190230d84beb41474bae0239c181a5f0e95f30c

Note that there's another commit with the same name but different commit hash: b71da1c




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the infinispan-issues mailing list