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

Optimistic transaction fails with Functional Map

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • Core, Transactions
    • None

      Utilizing a cache with optimistic transactions in a transaction with the Functional Map and the Map APIs fails. The transaction fails when the functional map modifies a remote entry and the next operation is one of the Map API (get, remove, etc). If the operation involves only local keys, it is completed fine.

      15:06:26,301 ERROR (jgroups-9,FunctionalRemoteTxTest-NodeA:[]) [o.i.i.i.InvocationContextInterceptor] ISPN000136: Error executing command RemoveCommand on Cache 'dist', writing keys [MagicKey{0/EC4526D5/64@FunctionalRemoteTxTest-NodeB}]
      java.lang.IllegalStateException: Wrapping entry without version
      	at org.infinispan.interceptors.distribution.VersionedDistributionInterceptor.wrapRemoteEntry(VersionedDistributionInterceptor.java:57) ~[classes/:?]
      	at org.infinispan.interceptors.distribution.BaseDistributionInterceptor.lambda$remoteGetSingleKey$0(BaseDistributionInterceptor.java:169) ~[classes/:?]
      	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
      	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
      	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2179) ~[?:?]
      	at org.infinispan.remoting.transport.AbstractRequest.complete(AbstractRequest.java:69) ~[classes/:?]
      	at org.infinispan.remoting.transport.impl.MultiTargetRequest.onResponse(MultiTargetRequest.java:111) ~[classes/:?]
      	at org.infinispan.remoting.transport.jgroups.StaggeredRequest.onResponse(StaggeredRequest.java:49) ~[classes/:?]
      	at org.infinispan.remoting.transport.impl.RequestRepository.addResponse(RequestRepository.java:51) ~[classes/:?]
      	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processResponse(JGroupsTransport.java:1556) ~[classes/:?]
      	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processMessage(JGroupsTransport.java:1457) ~[classes/:?]
      	at org.infinispan.remoting.transport.jgroups.JGroupsTransport$ChannelCallbacks.up(JGroupsTransport.java:1649) ~[classes/:?]
      	at org.jgroups.JChannel.up(JChannel.java:748) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:941) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.FRAG2.up(FRAG2.java:139) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.FlowControl.up(FlowControl.java:245) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.FlowControl.up(FlowControl.java:245) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.pbcast.GMS.up(GMS.java:853) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:235) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.UNICAST3.deliverMessage(UNICAST3.java:1144) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.UNICAST3.addMessage(UNICAST3.java:880) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.UNICAST3.handleDataReceived(UNICAST3.java:862) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.UNICAST3.up(UNICAST3.java:474) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java:669) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.Discovery.up(Discovery.java:296) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.stack.Protocol.up(Protocol.java:360) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.protocols.TP.passMessageUp(TP.java:1232) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at org.jgroups.util.SubmitToThreadPool$SingleMessageHandler.run(SubmitToThreadPool.java:95) ~[jgroups-5.3.13.Final.jar:5.3.13.Final]
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
      	at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
      

      A simple test class to reproduce the issue:

      package org.infinispan.functional;
      
      import static org.assertj.core.api.Assertions.assertThat;
      
      import org.infinispan.Cache;
      import org.infinispan.configuration.cache.ConfigurationBuilder;
      import org.infinispan.distribution.MagicKey;
      import org.infinispan.transaction.LockingMode;
      
      public class FunctionalRemoteTxTest extends FunctionalTxInMemoryTest {
      
         {
            transactional = true;
            numDistOwners = 1;
         }
      
         @Override
         protected void configureCache(ConfigurationBuilder builder) {
            super.configureCache(builder);
            builder.transaction().invocationBatching().enable();
            builder.transaction().lockingMode(LockingMode.OPTIMISTIC);
         }
      
         public void testRemoteAndRemove() {
            Cache<MagicKey, String> cache = cache(0, DIST);
      
            MagicKey key = new MagicKey(cache(1, DIST));
      
            log.info("Test starting now");
            cache.startBatch();
      
            log.info("Submit eval");
            rw.<String>eval(key, e -> {
               assertThat(e.find()).isEmpty();
               e.set("value");
               return null;
            }).join();
      
            log.info("Submit get");
            System.out.println("GET: " + cache.get(key));
      
            log.info("Calling end");
            cache.endBatch(true);
         }
      }
      

              rh-ee-jbolina Jose Bolina
              rh-ee-jbolina Jose Bolina
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: