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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Rejected
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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()
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  dlovison Diego Lovison
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: