[jbosscache-issues] [JBoss JIRA] Resolved: (JBCACHE-1404) Read locks are not released when isolation level is READ_COMMITED

Manik Surtani (JIRA) jira-events at lists.jboss.org
Wed Aug 27 09:10:39 EDT 2008


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

Manik Surtani resolved JBCACHE-1404.
------------------------------------

    Resolution: Rejected


Not a bug.  Read locks are held for the duration of the transaction even with R_C.  This is just the way it is implemented with pessimistic locking.  Look at MVCC in 3.X for a better locking scheme.

> Read locks are not released when isolation level is READ_COMMITED
> -----------------------------------------------------------------
>
>                 Key: JBCACHE-1404
>                 URL: https://jira.jboss.org/jira/browse/JBCACHE-1404
>             Project: JBoss Cache
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Transactions
>    Affects Versions: 2.1.1.GA
>            Reporter: Alexey Veklov
>            Assignee: Manik Surtani
>
> Read locks are released only on transaction commit/rollback when isolation level is READ_COMMITED.
> Here is TestCase:
> import javax.transaction.TransactionManager;
> import org.jboss.cache.Cache;
> import org.jboss.cache.CacheFactory;
> import org.jboss.cache.CacheSPI;
> import org.jboss.cache.DefaultCacheFactory;
> import org.jboss.cache.Fqn;
> import org.jboss.cache.NodeSPI;
> import org.jboss.cache.config.Configuration;
> import org.jboss.cache.lock.IsolationLevel;
> import com.db.fdr.test.TestCase;
> public class ReadCommittedLockingTest extends TestCase {
>     private Cache cache;
>     private Fqn fqn = Fqn.fromString("/test/fqn");
>     protected void setUp() throws Exception {
>         final CacheFactory cf = new DefaultCacheFactory();
>         final Configuration configuration = new Configuration();
>         configuration.setCacheMode(Configuration.CacheMode.REPL_SYNC);
>         configuration.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
>         configuration.setIsolationLevel(IsolationLevel.READ_COMMITTED);
>         cache = cf.createCache(configuration);
>         cache.create();
>         cache.start();
>     }
>     public void test() throws Exception {
>         final CacheSPI cacheSPI = (CacheSPI) cache;
>         final TransactionManager transactionManager = cacheSPI.getTransactionManager();
>         transactionManager.begin();
>         cache.put(fqn, "key", "value");
>         transactionManager.commit();
>         transactionManager.begin();
>         cache.get(fqn, "key");
>         assertEquals(IsolationLevel.READ_COMMITTED, cache.getConfiguration().getIsolationLevel());
>         final NodeSPI nodeSPI = cacheSPI.peek(fqn, false);
>         assertFalse("Should not be locked", nodeSPI.getLock().isReadLocked());
>         transactionManager.commit();
>     }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbosscache-issues mailing list