[infinispan-issues] [JBoss JIRA] Updated: (ISPN-841) Flag.CACHE_MODE_LOCAL is not working properly for put operation in TreeCache

Galder Zamarreño (JIRA) jira-events at lists.jboss.org
Thu Dec 23 09:49:18 EST 2010


     [ https://issues.jboss.org/browse/ISPN-841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Galder Zamarreño updated ISPN-841:
----------------------------------

    Steps to Reproduce: See attached TestInfinispan.java file.  (was: package com.db.fdr.test.cache;

import java.util.Properties;
import java.util.concurrent.CyclicBarrier;

import org.infinispan.Cache;
import org.infinispan.config.Configuration;
import org.infinispan.config.GlobalConfiguration;
import org.infinispan.context.Flag;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.tree.Fqn;
import org.infinispan.tree.TreeCache;
import org.infinispan.tree.TreeCacheFactory;
import org.infinispan.util.concurrent.IsolationLevel;

import com.db.fdr.test.TestCase;

/**
 * <p/>
 * Copyright 2010 Deutsche Bank
 *
 * @author <a href="mailto:konstantin.kuzmin at db.com">Konstantin Kuzmin</a>
 * @version $Revision$
 * @since Dec 17, 2010
 */
public class TestInfinispan extends TestCase {
    private Cache cache1;
    private Cache cache2;
    private TreeCache treeCache1;
    private TreeCache treeCache2;
    private static final String KEY = "key";

    public static Cache createCache() throws Exception {
        final GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
        final Properties p = new Properties();
        p.setProperty("configurationFile", "jgroups-config.xml");
        gc.setTransportProperties(p);

        final Configuration configuration = new Configuration();
        configuration.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
        configuration.setTransactionManagerLookupClass("org.infinispan.transaction.lookup.DummyTransactionManagerLookup");
        configuration.setIsolationLevel(IsolationLevel.READ_COMMITTED);
        configuration.setLockAcquisitionTimeout(1000L);
        configuration.setSyncCommitPhase(true);
        configuration.setSyncRollbackPhase(true);

        configuration.setUseLockStriping(true);
        configuration.setConcurrencyLevel(500);

        configuration.setInvocationBatchingEnabled(true);

        final EmbeddedCacheManager manager = new DefaultCacheManager(gc, configuration, true);
        return manager.getCache();
    }

    public static TreeCache createTreeCache(final Cache cache) throws Exception {
        final TreeCacheFactory tcf = new TreeCacheFactory();
        return tcf.createTreeCache(cache);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        cache1 = createCache();
        cache2 = createCache();
    }

    public void testCacheLocalPut() throws Exception {
        cache1.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).put(KEY, "1");
        cache2.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).put(KEY, "2");
        assertEquals("cache2 was updated locally", "2", cache2.get(KEY));
        assertEquals("cache1 should not be invalidated in case of LOCAL put in cache2", "1", cache1.get(KEY));
    }

    public void testTreeCacheLocalPut() throws Exception {
        treeCache1 = createTreeCache(cache1);
        treeCache2 = createTreeCache(cache2);
        final Fqn fqn = Fqn.fromElements("TEST");
        treeCache1.put(fqn, KEY, "1", Flag.CACHE_MODE_LOCAL);
        treeCache2.put(fqn, KEY, "2", Flag.CACHE_MODE_LOCAL);
        assertEquals("treeCache2 was updated locally", "2", treeCache2.get(fqn, KEY));
        assertEquals("treeCache1 should not be invalidated in case of LOCAL put in treeCache2", "1", treeCache1.get(fqn, KEY));
    }
}
)


> Flag.CACHE_MODE_LOCAL is not working properly for put operation in TreeCache
> ----------------------------------------------------------------------------
>
>                 Key: ISPN-841
>                 URL: https://issues.jboss.org/browse/ISPN-841
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Tree API
>    Affects Versions: 4.1.0.Final
>         Environment: Windows XP Professional SP3
>            Reporter: Konstantin Kuzmin
>            Assignee: Galder Zamarreño
>             Fix For: 5.0.0.BETA1
>
>         Attachments: TestInfinispan.java
>
>
> Actually, the problem might be wider. I suppose the Flag set is not propagated to underlying (Cache) infrastructure in some cases.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the infinispan-issues mailing list