6 Replies Latest reply on Dec 18, 2015 10:50 AM by Radim Vansa

    Using Cache Store with Clustered Distributed Cache

    Sonal Maheshwari Newbie

      Hi, I am quite new to Infinispan. I am trying to persist data using cache store. I started 3 nodes in the clustered environment using distributed cache. After starting these nodes, i wrote some data to them which was distributed among these. This is configuration for cache used:

       

      <distributed-cache name="test-disc-cache" owners="2" mode="SYNC" remote-timeout="30000" start="EAGER" l1-lifespan="0">

             <locking isolation="READ_COMMITTED" striping="false" acquire-timeout="30000" concurrency-level="1000"/>

             <transaction mode="NONE"/>

             <file-store passivation="false" purge="true" preload="false" shared="true"/>

             <eviction max-entries="2000" strategy = "NONE"/>

      </distributed-cache>

       

      Since i am trying to use cache store with cache, i killed two cluster nodes, and restarted one of them but got this error:

       

      ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.infinispan.clustered.test-disc-cache: org.jboss.msc.service.StartException in service jboss.infinispan.clustered.test-disc-cache: Failed to start service

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_40]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_40]

        at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]

      Caused by: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.persistence.manager.PersistenceManagerImpl.start() on object of type PersistenceManagerImpl

        at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:185)

        at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:869)

        at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:638)

        at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:627)

        at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:530)

        at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:216)

        at org.infinispan.CacheImpl.start(CacheImpl.java:666)

        at org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:551)

        at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:514)

        at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:396)

        at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:410)

        at org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager.getCache(DefaultEmbeddedCacheManager.java:89)

        at org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager.getCache(DefaultEmbeddedCacheManager.java:80)

        at org.jboss.as.clustering.infinispan.subsystem.CacheService.start(CacheService.java:78)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]

        ... 3 more

      Caused by: org.infinispan.commons.CacheException: Unable to start cache loaders

        at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:155)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_40]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_40]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_40]

        at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_40]

        at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:183)

        ... 18 more

      Caused by: org.infinispan.persistence.spi.PersistenceException: java.io.IOException: Unsupported protocol version 57

        at org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:123)

        at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:122)

        ... 23 more

      Caused by: java.io.IOException: Unsupported protocol version 57

        at org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1243)

        at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.startObjectInput(AbstractJBossMarshaller.java:134)

        at org.infinispan.marshall.core.VersionAwareMarshaller.startObjectInput(VersionAwareMarshaller.java:142)

        at org.infinispan.marshall.core.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:98)

        at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectFromByteBuffer(AbstractDelegatingMarshaller.java:80)

        at org.infinispan.persistence.file.SingleFileStore.rebuildIndex(SingleFileStore.java:199)

        at org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:119)

        ... 24 more

       

      If i clear the data from disc, i am able to start this node w/o error. But what i what here is that the data should be loaded from cache store...if node/server is restarted. Any help will be appreciated.

       

      Also, if some one could help me with the configuration that i want will be very helpful:

      1. Clustered Nodes with disrtibuted cache

      2. Cache store to persist data

       

      Thanks in advance.

      Sonal

        • 1. Re: Using Cache Store with Clustered Distributed Cache
          Daniel Kelleher Newbie

          Hi all, has anyone had any ideas on this? I'm having a very similar problem.

           

          We're using a distributed modeshape cache across two cluster nodes, configured using an Infinispan SingleFileStore that (at the moment) both point to the same network drive (is that a good idea?). When restarting the nodes I get an error during the rebuildIndex stage in SingleFileStore.start()

           

          Caused by: org.infinispan.commons.CacheException: Unable to start cache loaders

          2015-12-17 14:56:46,852 INFO  [stdout] (default task-10)        at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:162) ~[infinispan-core.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,853 INFO  [stdout] (default task-10)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]

          2015-12-17 14:56:46,854 INFO  [stdout] (default task-10)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]

          2015-12-17 14:56:46,855 INFO  [stdout] (default task-10)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]

          2015-12-17 14:56:46,855 INFO  [stdout] (default task-10)        at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]

          2015-12-17 14:56:46,855 INFO  [stdout] (default task-10)        at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168) ~[infinispan-commons.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,855 INFO  [stdout] (default task-10)        ... 147 common frames omitted

          2015-12-17 14:56:46,856 INFO  [stdout] (default task-10) Caused by: org.infinispan.persistence.spi.PersistenceException: java.io.IOException: Unsupported protocol version 119

          2015-12-17 14:56:46,856 INFO  [stdout] (default task-10)        at org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:135) ~[infinispan-core.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,857 INFO  [stdout] (default task-10)        at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:129) ~[infinispan-core.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,857 INFO  [stdout] (default task-10)        ... 152 common frames omitted

          2015-12-17 14:56:46,857 INFO  [stdout] (default task-10) Caused by: java.io.IOException: Unsupported protocol version 119

          2015-12-17 14:56:46,857 INFO  [stdout] (default task-10)        at org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1249) ~[na:na]

          2015-12-17 14:56:46,857 INFO  [stdout] (default task-10)        at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.startObjectInput(AbstractJBossMarshaller.java:128) ~[infinispan-commons.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,858 INFO  [stdout] (default task-10)        at org.infinispan.marshall.core.VersionAwareMarshaller.startObjectInput(VersionAwareMarshaller.java:142) ~[infinispan-core.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,858 INFO  [stdout] (default task-10)        at org.infinispan.marshall.core.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:98) ~[infinispan-core.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,858 INFO  [stdout] (default task-10)        at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectFromByteBuffer(AbstractDelegatingMarshaller.java:80) ~[infinispan-commons.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,858 INFO  [stdout] (default task-10)        at org.infinispan.persistence.file.SingleFileStore.rebuildIndex(SingleFileStore.java:212) ~[infinispan-core.jar!/:7.2.3.Final]

          2015-12-17 14:56:46,859 INFO  [stdout] (default task-10)        at org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:126) ~[infinispan-core.jar!/:7.2.3.Final]

           

          The infinispan config is attached.

           

          Thanks a lot for your help!

           

          Daniel

          • 2. Re: Using Cache Store with Clustered Distributed Cache
            Radim Vansa Master

            No, SingleFileStore expects that it is the only node the writes to that file. As there are two modifying instances, at some point it starts reading unexpected rubbish.

            • 3. Re: Using Cache Store with Clustered Distributed Cache
              Daniel Kelleher Newbie

              Thanks, that was my suspicion. Looks like that data's garbage then

               

              A related question - I wanted to move to the newer SoftIndexFileStore - is it possible to migrate the persisted files generated by a SingleFileStore to a SoftIndexFileStore? I'm using Infinispan with Modeshape, which uses Infinispan as the persistent data layer- so there is no underlying datasource I can fall back to.

              • 4. Re: Using Cache Store with Clustered Distributed Cache
                Radim Vansa Master

                The best way to migrate these is to create a new cache with the other store, and copy entries there manually. There are no automation tools right now.

                • 5. Re: Using Cache Store with Clustered Distributed Cache
                  Daniel Kelleher Newbie

                  If I add a new empty node using the SoftIndex store to an existing replicated cache using SingleFileStore, will Infinispan "fill in the gaps" and copy all entries from the cache to the new node (with the new store) automatically? *wishful thinking*

                  • 6. Re: Using Cache Store with Clustered Distributed Cache
                    Radim Vansa Master

                    Yes, actually this could work. But is it really worth transferring the data over network when you can just copy them into local cache? With cache streams, you can just execute a foreach on the cache.