[infinispan-issues] [JBoss JIRA] (ISPN-1983) putForExternalRead() not obeying the specification

Galder Zamarreño (JIRA) jira-events at lists.jboss.org
Tue Apr 17 10:29:17 EDT 2012


Galder Zamarreño created ISPN-1983:
--------------------------------------

             Summary: putForExternalRead() not obeying the specification
                 Key: ISPN-1983
                 URL: https://issues.jboss.org/browse/ISPN-1983
             Project: Infinispan
          Issue Type: Bug
          Components: Core API
    Affects Versions: 5.1.3.FINAL
            Reporter: Galder Zamarreño
            Assignee: Galder Zamarreño
             Fix For: 5.1.4.FINAL


The javadoc says: "Only goes through if the key specified does not exist..."

But, two consecutive calls for putForExternalRead result in the second one acting on the cache.

1st call:
{code}2012-04-17 16:19:35,617 1444  TRACE [org.infinispan.interceptors.InvocationContextInterceptor] (main:replSync) Invoked with command PutKeyValueCommand{key=k, value=v, flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ], putIfAbsent=true, lifespanMillis=-1, maxIdleTimeMillis=-1} and InvocationContext [SingleKeyNonTxInvocationContext{flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ]}]
2012-04-17 16:19:35,617 1444  TRACE [org.infinispan.statetransfer.StateTransferLockImpl] (main:replSync) Acquired shared state transfer shared lock, total holders: 1
2012-04-17 16:19:35,617 1444  TRACE [org.infinispan.container.EntryFactoryImpl] (main:replSync) Exists in context? null 
2012-04-17 16:19:35,617 1444  TRACE [org.infinispan.container.EntryFactoryImpl] (main:replSync) Retrieved from container null
2012-04-17 16:19:35,617 1444  TRACE [org.infinispan.container.EntryFactoryImpl] (main:replSync) Creating new entry.
2012-04-17 16:19:35,619 1446  TRACE [org.infinispan.interceptors.CallInterceptor] (main:replSync) Executing command: PutKeyValueCommand{key=k, value=v, flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ], putIfAbsent=true, lifespanMillis=-1, maxIdleTimeMillis=-1}.
2012-04-17 16:19:35,620 1447  TRACE [org.infinispan.remoting.rpc.RpcManagerImpl] (main:replSync) NodeA-26945 broadcasting call PutKeyValueCommand{key=k, value=v, flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ], putIfAbsent=true, lifespanMillis=-1, maxIdleTimeMillis=-1} to recipient list null
...
2012-04-17 16:19:35,626 1453  TRACE [org.infinispan.interceptors.EntryWrappingInterceptor] (main:replSync) Committed entry ReadCommittedEntry(1436ae83){key=k, value=v, oldValue=null, isCreated=false, isChanged=false, isRemoved=false, isValid=true}
{code}

2nd call:
{code}2012-04-17 16:19:35,626 1453  TRACE [org.infinispan.interceptors.InvocationContextInterceptor] (main:replSync) Invoked with command PutKeyValueCommand{key=k, value=v, flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ], putIfAbsent=true, lifespanMillis=-1, maxIdleTimeMillis=-1} and InvocationContext [SingleKeyNonTxInvocationContext{flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ]}]
2012-04-17 16:19:35,626 1453  TRACE [org.infinispan.remoting.InboundInvocationHandlerImpl] (Incoming-1,ISPN,NodeB-23417:) Calling perform() on SingleRpcCommand{cacheName='replSync', command=PutKeyValueCommand{key=k, value=v, flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ], putIfAbsent=false, lifespanMillis=-1, maxIdleTimeMillis=-1}}
2012-04-17 16:19:35,626 1453  TRACE [org.infinispan.container.EntryFactoryImpl] (main:replSync) Exists in context? null 
2012-04-17 16:19:35,626 1453  TRACE [org.infinispan.container.EntryFactoryImpl] (main:replSync) Retrieved from container ImmortalCacheEntry{key=k, value=ImmortalCacheValue {value=v}}
2012-04-17 16:19:35,627 1454  TRACE [org.infinispan.interceptors.CallInterceptor] (main:replSync) Executing command: PutKeyValueCommand{key=k, value=v, flags=[ZERO_LOCK_ACQUISITION_TIMEOUT, FORCE_ASYNCHRONOUS, FAIL_SILENTLY, PUT_FOR_EXTERNAL_READ], putIfAbsent=true, lifespanMillis=-1, maxIdleTimeMillis=-1}.
2012-04-17 16:19:35,627 1454  TRACE [org.infinispan.container.entries.ReadCommittedEntry] (main:replSync) Updating entry (key=k removed=false valid=true changed=true created=false value=v]
2012-04-17 16:19:35,627 1454  TRACE [org.infinispan.interceptors.EntryWrappingInterceptor] (main:replSync) Committed entry ReadCommittedEntry(7f2ea1dd){key=k, value=v, oldValue=null, isCreated=false, isChanged=false, isRemoved=false, isValid=true}
{code}

Why is updating an entry if if the value is already present? It shouldn't do that.

Even further, in the case of putForExternalRead() the previous value is not needed since we don't return it, so it should not even retrieve it from the container. Just checking if it's present should be enough. This is in contrast to a normal putIfAbsent() call.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the infinispan-issues mailing list