You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexei Scherbakov (JIRA)" <ji...@apache.org> on 2016/05/13 15:11:13 UTC

[jira] [Updated] (IGNITE-3134) Unexpected EVT_CACHE_ENTRY_EVICTED events in OFFHEAP_TIERED mode

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

Alexei Scherbakov updated IGNITE-3134:
--------------------------------------
    Description: 
EVT_CACHE_ENTRY_EVICTED event is triggered on any cache operation in this mode.

Code sample:

{code}
IgnitePredicate<CacheEvent> lsnr = new IgnitePredicate<CacheEvent>() {
        @Override public boolean apply(CacheEvent evt) {
                    System.out.println("Old value: " + evt.oldValue());
                    counter.incrementAndGet();
                    return true; // Return true to continue listening.
        }
};

CacheConfiguration<Object, Object> cfg = new CacheConfiguration<>();
cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
cfg.setEvictionPolicy(new FifoEvictionPolicy<>(1));
IgniteCache<Object, Object> test = ignite.getOrCreateCache(cfg);

// Register event listener for all local task execution events.
ignite.events().localListen(lsnr, EVT_CACHE_ENTRY_EVICTED);

test.put("1", "1");
test.put("2", "2");
test.put("3", "3");
Object o = test.get("2");

System.out.println(counter.get());
{code}

will print 4

  was:
EVT_CACHE_ENTRY_EVICTED event is triggered on any cache operation in this mode.

Code sample:

{code}
IgnitePredicate<CacheEvent> lsnr = new IgnitePredicate<CacheEvent>() {
        @Override public boolean apply(CacheEvent evt) {
                    System.out.println("Old value: " + evt.oldValue());
                    counter.incrementAndGet();
                    return true; // Return true to continue listening.
        }
};

CacheConfiguration<Object, Object> cfg = new CacheConfiguration<>();
cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
cfg.setEvictionPolicy(new FifoEvictionPolicy<>(1));
IgniteCache<Object, Object> test = ignite.getOrCreateCache(cfg);

// Register event listener for all local task execution events.
ignite.events().localListen(lsnr, EVT_CACHE_ENTRY_EVICTED);

test.put("1", "1");
test.put("2", "2");
test.put("3", "3");
Object o = test.get("2");

System.out.println(counter.get());
{code}


> Unexpected EVT_CACHE_ENTRY_EVICTED events in OFFHEAP_TIERED mode
> ----------------------------------------------------------------
>
>                 Key: IGNITE-3134
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3134
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>            Reporter: Alexei Scherbakov
>             Fix For: 1.7
>
>
> EVT_CACHE_ENTRY_EVICTED event is triggered on any cache operation in this mode.
> Code sample:
> {code}
> IgnitePredicate<CacheEvent> lsnr = new IgnitePredicate<CacheEvent>() {
>         @Override public boolean apply(CacheEvent evt) {
>                     System.out.println("Old value: " + evt.oldValue());
>                     counter.incrementAndGet();
>                     return true; // Return true to continue listening.
>         }
> };
> CacheConfiguration<Object, Object> cfg = new CacheConfiguration<>();
> cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
> cfg.setEvictionPolicy(new FifoEvictionPolicy<>(1));
> IgniteCache<Object, Object> test = ignite.getOrCreateCache(cfg);
> // Register event listener for all local task execution events.
> ignite.events().localListen(lsnr, EVT_CACHE_ENTRY_EVICTED);
> test.put("1", "1");
> test.put("2", "2");
> test.put("3", "3");
> Object o = test.get("2");
> System.out.println(counter.get());
> {code}
> will print 4



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