ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wangpeibin (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-5782) FifoEvictionPolicy does not work with ignite 2.0.0
Date Wed, 19 Jul 2017 06:19:01 GMT
wangpeibin created IGNITE-5782:
----------------------------------

             Summary:  FifoEvictionPolicy does not work with ignite 2.0.0
                 Key: IGNITE-5782
                 URL: https://issues.apache.org/jira/browse/IGNITE-5782
             Project: Ignite
          Issue Type: Bug
          Components: cache
    Affects Versions: 2.0
            Reporter: wangpeibin


I use a ignite slide window with FifoEvictionPolicy before with ignite 1.9.0
right now I migration to ingite 2.0.0 according ApacheIgnite2.0MigrationGuide-CacheMemoryMode

but I find the window does not evict the entry successful.

I write a unit test code below:
```
        try (Ignite ignite = Ignition.start("default-config.xml")) {
            CacheConfiguration cacheConfiguration = new CacheConfiguration();
            cacheConfiguration.setCacheMode(CacheMode.REPLICATED);
            cacheConfiguration.setName("Test");

            // for ignite 1.9.0
            // cacheConfiguration.setMemoryMode(CacheMemoryMode.ONHEAP_TIERED);
            // for ignite 2.0.0
            cacheConfiguration.setOnheapCacheEnabled(true);
            

            cacheConfiguration.setEvictionPolicy(new FifoEvictionPolicy(5));
            IgniteCache<Object, Object> cache = ignite.getOrCreateCache(cacheConfiguration);
            for(Integer i = 0; i < 10; i++) {
                Map<Object, Object> value = new HashMap<>();
                value.put("key", i.toString());
                value.put("value", 1);
                cache.put(i.toString(), value);
            }

            cache.forEach(objectObjectEntry -> {
                System.out.println(objectObjectEntry);
    
            });
        }
        System.out.println("finished");
```

with ignite 1.9.0 the output is
```
Entry [key=5, val={value=1, key=5}]
Entry [key=6, val={value=1, key=6}]
Entry [key=7, val={value=1, key=7}]
Entry [key=8, val={value=1, key=8}]
Entry [key=9, val={value=1, key=9}]
```
with ignite 2.0.0 the output is
```
Entry [key=0, val={value=1, key=0}]
Entry [key=1, val={value=1, key=1}]
Entry [key=2, val={value=1, key=2}]
Entry [key=3, val={value=1, key=3}]
Entry [key=4, val={value=1, key=4}]
Entry [key=5, val={value=1, key=5}]
Entry [key=6, val={value=1, key=6}]
Entry [key=7, val={value=1, key=7}]
Entry [key=8, val={value=1, key=8}]
Entry [key=9, val={value=1, key=9}]
```



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message