4 Replies Latest reply on Jul 22, 2010 3:42 PM by Vladimir Blagojevic

    replaceAsync with eager locking: succeed even when the key doesn't exist

    Chun Li Newbie

      We found a strange behavior with 4.0.0final and also 4.0.0CR2. When using cache.replaceAsync(key,newValue), the new value is saved even the key doesn't exist in the cache. We are using eager locking for the cache, and later we added some logging statement in ReplaceCommand.perform method, so that it can print out the MVCCEntry.

       

      Here's what we got. It seems LockingInterceptor will always create a new MVCCEntry, so the replace can always success. Is is a bug?

       

       

      17:34:31,413  [org.infinispan.util.concurrent.locks.DeadlockDetectingLockManager] Attempting to lock 1b6c2d17-7467-411d-8502-c9cb726d50aa with acquisition timeout of 20000 millis
      17:34:31,413  [org.infinispan.util.concurrent.locks.DeadlockDetectingLockManager] Using early dead lock detection
      17:34:31,413  [org.infinispan.util.concurrent.locks.DeadlockDetectingLockManager] successfully acquired lock on 1b6c2d17-7467-411d-8502-c9cb726d50aa, returning ...
      17:34:31,414  [org.infinispan.container.EntryFactoryImpl] Creating new entry.
      17:34:31,414  [org.infinispan.interceptors.CallInterceptor] Suppressing invocation of method handleLockControlCommand.
      17:34:31,414  [org.infinispan.remoting.rpc.RpcManagerImpl] perf-srm-7682 broadcasting call LockControlCommand{gtx=DeadlockDetectingGlobalTransaction{replicatingTo=[], replicationThread=null, coinToss=5847955923061173935} GlobalTransaction:<perf-srm-7682>:157, cacheName='session, implicit='true, keys=[1b6c2d17-7467-411d-8502-c9cb726d50aa]} to recipient list null
      17:34:31,414  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] dests=null, command=LockControlCommand{gtx=DeadlockDetectingGlobalTransaction{replicatingTo=[], replicationThread=null, coinToss=5847955923061173935} GlobalTransaction:<perf-srm-7682>:157, cacheName='session, implicit='true, keys=[1b6c2d17-7467-411d-8502-c9cb726d50aa]}, mode=SYNCHRONOUS, timeout=20000
      17:34:31,414  [org.infinispan.marshall.VersionAwareMarshaller] Wrote version 400
      17:34:31,414  [org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher] real_dests=[perf-srm2-61994]
      17:34:31,428  [org.infinispan.marshall.VersionAwareMarshaller] (OOB-19,ana-cluster,perf-srm-7682:) Read version 400
      17:34:31,429  [org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher] responses: [sender=perf-srm2-61994, retval=null, received=true, suspected=false]

      17:34:31,429  [org.infinispan.interceptors.CallInterceptor] Executing command: ReplaceCommand{oldValue=null, newValue=net.beaumaris.sessionpersistence.catv.entity.SessionData@59e9b241, successful=true}.

      17:34:31,429  [org.infinispan.commands.write.ReplaceCommand] The MVCCEntry value is ReadCommittedEntry(1232146194){key=1b6c2d17-7467-411d-8502-c9cb726d50aa, value=null, oldValue=null, isCreated=true, isChanged=true, isRemoved=false, isValid=true}