Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-9412

HotRod Transaction Cache PESSIMISTIC locking mode is not locking the key in another transaction

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Critical Critical
    • None
    • None
    • None
    • None

      I am expecting the thread 2 be blocked in `cache.put(k1, v1)` until thread 1 has committed the transaction

      According to the docs, using Pessimistic transactional cache, when cache.put(k1,v1) returns, k1 is locked and no other transaction running anywhere in the cluster can write to it. Reading k1 is still possible. The lock on k1 is released when the transaction completes (commits or rollbacks).

      Cache Configuration

            return new org.infinispan.configuration.cache.ConfigurationBuilder()
               .clustering().cacheMode(CacheMode.DIST_SYNC)
               .jmxStatistics().enable()
               .transaction()
                  .cacheStopTimeout(0L)
                  .transactionManagerLookup(new EmbeddedTransactionManagerLookup())
                  .lockingMode(LockingMode.PESSIMISTIC)
                  .locking().isolationLevel(IsolationLevel.REPEATABLE_READ)
      
            .build();
      

      Steps to reproduce

      Thread t1 = {
        tm.begin()
        cache.put(k1, v1)
        long operation like 1 minute
        tm.commit()
      }
      
      Thread t2 = {
         long operation like 15 seconds
         tm.begin()
         cache.put(k1, v1)
         tm.commit()
      }
      
      t1.start()
      t2.start()
      

              Unassigned Unassigned
              dlovison@redhat.com Diego Lovison
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: