Hi, all,

For a new cache without any data,  I think CacheEvent with a put operation, 
should not be hasOldValue() == true.


This is my test case to regenerate it.
public void testCacheEvent() throws Exception {
    Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
    final AtomicLong oldValCnt = new AtomicLong(0);
    ignite.events().localListen(new IgnitePredicate<CacheEvent>() {
                                    @Override
                                    public boolean apply(CacheEvent event) {
                                        if (event.hasOldValue())
                                            oldValCnt.incrementAndGet();
                                        return true;
                                    }
                                }, EventType.EVT_CACHE_OBJECT_PUT);

    CacheConfiguration cacheCfg = new CacheConfiguration("hasOldValueCache");
    cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

    IgniteCache cache = ignite.createCache(cacheCfg);
    cache.put(1,"val1");
    assertEquals(0, oldValCnt.get());
}


In Atomic mode, the assertion is right, but failed in Transactional mode.


It looks that the 
org.apache.ignite.internal.processors.cache.GridCacheMapEntry#hasValueUnlocked 
does not work properly  in 
org.apache.ignite.internal.processors.cache.GridCacheMapEntry#innerSet.




Am I right? and How to fix it ?


Thanks for your help.




Lin.

Reply via email to