]
RH Bugzilla Integration commented on ISPN-4187:
-----------------------------------------------
Tristan Tarrant <ttarrant(a)redhat.com> changed the Status of [bug
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
Labels: 630betablocker
Fix For: 7.0.0.Alpha4
Attachments: server2.log
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"));
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/b190230d84beb41474bae0239...
Note that there's another commit with the same name but different commit hash:
b71da1c
The test above can be run from
https://github.com/chepa653/infinispan/tree/t_ISPN-3904 by
going to server/integration/testsuite and running mvn clean verify
-Dtest=StringBasedStoreMultinodeTest#testFetchState -Dlog.level.infinispan=TRACE