ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Kozlov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (IGNITE-1895) Entries aren't evicted for LRU policy
Date Tue, 24 Nov 2015 14:39:11 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-1895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sergey Kozlov updated IGNITE-1895:
----------------------------------
    Fix Version/s:     (was: 1.5)
                   1.6

> Entries aren't evicted for LRU policy
> -------------------------------------
>
>                 Key: IGNITE-1895
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1895
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 1.5
>            Reporter: Sergey Kozlov
>            Assignee: Sergey Kozlov
>             Fix For: 1.6
>
>         Attachments: example-ignite-lru-client.xml, example-ignite-lru.xml
>
>
> 1. :
> {code:title=CacheLruExample.java|borderStyle=solid}
> package org.apache.ignite.examples.datagrid;
> import java.util.HashMap;
> import java.util.Map;
> import org.apache.ignite.Ignite;
> import org.apache.ignite.IgniteCache;
> import org.apache.ignite.IgniteException;
> import org.apache.ignite.Ignition;
> import org.apache.ignite.examples.ExampleNodeStartup;
> public class CachePutGetExample {
>     /** Cache name. */
>     private static final String CACHE_NAME = "cache_0001";
>     public static void main(String[] args) throws IgniteException, InterruptedException
{
>         try (Ignite ignite = Ignition.start("examples/config/example-ignite-lru-client.xml"))
{
>             try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME))
{
>                 System.out.println();
>                 System.out.println(">>> Test started.");
>                 int counter = 0;
>                 for (int i = 1; i <= 100; i++) {
>                     if (cache.get(i) != null)
>                         counter++;
>                 }
>                 System.out.println(">>> Get: found not-null keys " + Integer.toString(counter));
>                 Thread.sleep(1000);
>                 for (int i = 1; i <= 100; i++) {
>                     cache.remove(i);
>                 }
>                 System.out.println(">>> Remove: 1..100");
>                 Thread.sleep(1000);
>                 counter = 0;
>                 for (int i = 1; i <= 100; i++) {
>                     cache.put(i, Integer.toString(i));
>                     counter++;
>                 }
>                 System.out.println(">>> Put: 1..100");
>                 Thread.sleep(1000);
>                 counter = 0;
>                 for (int i = 50; i <= 100; i++) {
>                     if (cache.get(i) != null)
>                         counter++;
>                 }
>                 System.out.println(">>> Get 50..100");
>                 Thread.sleep(1000);
>                 for (int i = 30; i <= 49; i++) {
>                     cache.put(i, Integer.toString(i));
>                 }
>                 System.out.println(">>> Put: 30..49");
>                 Thread.sleep(1000);
>                 counter = 0;
>                 for (int i = 1; i <= 100; i++) {
>                     if (cache.get(i) != null)
>                         counter++;
>                 }
>                 System.out.println(">>> Get: found not-null keys (must be 50):
" + Integer.toString(counter));
>             }
>         }
>     }
> }
> {code}
> 2. Copy attached configurations in examples/config directory
> 3. Start two nodes with example-ignite-lru.xml
> 3. Compile and run example
> 4. The output of example shows that cache has more entries than defined by max size in
eviction policy:
> {noformat}
> ...
> [16:34:47,088][INFO ][main][GridDiscoveryManager] Topology snapshot [ver=3, servers=2,
clients=1, CPUs=8, heap=3.8GB]
> >>> Test started.
> >>> Get: found not-null keys 0
> >>> Remove: 1..100
> >>> Put: 1..100
> >>> Get 50..100
> >>> Put: 30..49
> >>> Get: found not-null keys (must be 50): 70
> ...
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message