Got it. The following sequence will fail: 1. get() 2. pfer() 3. get() //fail here
However, if the 1st step is eliminated, second get succeeds: pfer(); get();//success. Here's the test: package org.jboss.cache.api; | | import org.jboss.cache.config.Configuration; | import org.jboss.cache.config.Configuration.NodeLockingScheme; | import org.jboss.cache.factories.UnitTestConfigurationFactory; | import org.testng.annotations.Test; | | import javax.transaction.TransactionManager; | | import org.jboss.cache.*; | import org.jboss.cache.lock.IsolationLevel; | | /** | * Tests that a node that was putFromExternalRead and then removed in TX1 does NOT | * get returned in subsequent TX2. | * | * @author nikita_tovsto...@mba.berkeley.edu | * @since 3.0.3.GA | */ | @Test(groups = {"functional", "pessimistic"}, sequential = true, testName = "api.RemovedNodeResurrectionInSubsequentTxTest") | public class RemovedNodeResurrectionInSubsequentTxTest extends AbstractSingleCacheTest { | | private static final Fqn A_B = Fqn.fromString("/a/b"); | private static final Fqn A = Fqn.fromString("/a"); | private static final Fqn A_C = Fqn.fromString("/a/c"); | private static final String KEY = "key"; | private static final String VALUE = "value"; | private static final String K2 = "k2"; | private static final String V2 = "v2"; | protected NodeSPI root; | protected TransactionManager txManager; | | public CacheSPI createCache() { | CacheSPI myCache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, false), false, getClass()); | myCache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL); | myCache.getConfiguration().setCacheLoaderConfig(null); | myCache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC); | configure(myCache.getConfiguration()); | myCache.start(); | root = myCache.getRoot(); | txManager = myCache.getTransactionManager(); | | return myCache; | } | | protected void configure(Configuration c) { | c.setIsolationLevel(IsolationLevel.REPEATABLE_READ); | } | | public void testPferAndEvictInSameTx() throws Exception { | | Object val = null; | | cache.getRoot().addChild(A); | | txManager.begin(); | | val = cache.get(A_B, KEY); //N1 IF THIS LINE IS EXECUTED, TEST FAILS BELOW AT N2 | | //put in cache | cache.putForExternalRead(A_B, KEY, VALUE); | | val = cache.get(A_B, KEY); | assert val != null : "get() after pfer() returned " + val; //N2 THIS WILL FAIL IF LINE N1 (ABOVE) IS EXECUTED (NOT COMMENTED OUT) | | //evict from cache | cache.evict(A_B); //sometimes MVCCInvocationContext has ref to mvccTCtx, sometimes NOT | | //verify eviction | val = cache.get(A_B, KEY); | assert val == null : "get() after evict() returned " + val; | | txManager.commit(); | | } | } | Here's the output: anonymous wrote : | | | java.lang.AssertionError: get() after pfer() returned null | at org.jboss.cache.api.RemovedNodeResurrectionInSubsequentTxTest.testPferAndEvictInSameTx(RemovedNodeResurrectionInSubsequentTxTest.java:65) | at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) | at java.lang.Thread.run(Thread.java:619) | However, if line marked as "N1" is commented out, test passes. Any ideas? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4217201#4217201 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4217201 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user