4 Replies Latest reply on Jun 13, 2012 6:42 AM by jrox

    Infinispan replication not working?

    jrox

      I have an issue that with my two nodes the clustering and replication seems to be setup but for some reason the data not get replicated properly.

      I attached TRACE log files of the two nodes (Node 1 startup first) where at some time I insert something into the cache in Node 1 and expect it to be transferred to Node 2. Can anyone see any problem in the logs about that?

       

      Strange thing is that if I use similar code on my local machine and initiate two processes, the replication works fine, not on the remote machine though where it should work.

       

      In the logs I can see that the key object (SCDSK_tMySQLSCDCached_1) seems to be the problem. The key object seems to be in the cache on Node 1 and can be looked up wheras on Node 2 it seems to be a null object somehow.

       

      This is basically the programmatic configuration of the cacheManager used to create the cache:

       

      cacheManager = new org.infinispan.manager.DefaultCacheManager(

                                              org.infinispan.configuration.global.GlobalConfigurationBuilder

                                                                  .defaultClusteredBuilder().transport()

                                                                  .addProperty("configurationFile", "jgroups-udp.xml").serialization()

                                                                  .addAdvancedExternalizer(key.new SCDSKExternalizer_tMySQLSCDCached_1())

                                                                  .addAdvancedExternalizer(value.new SCDStructExternalizer_tMySQLSCDCached_1())

                                                                  .build(),

                                              new org.infinispan.configuration.cache.ConfigurationBuilder()

                                                                  .clustering()

                                                                  .cacheMode(

                                                                                      org.infinispan.configuration.cache.CacheMode.REPL_SYNC)

                                                                  .eviction()

                                                                  .strategy(org.infinispan.eviction.EvictionStrategy.LRU)

                                                                  .maxEntries(2000).expiration().build());

        • 1. Re: Infinispan replication not working?
          mgencur

          Hi Andre, this seems to be only a TRACE log for JGroups. Can you enable also the trace log for infinispan and attach also the configuration you used?

          • 2. Re: Infinispan replication not working?
            jrox

            Thanks for pointing that out. I've attached a new trace log and the configuration and a little explanation on the problem.

            • 3. Re: Infinispan replication not working?
              dan.berindei

              Andre, could you also post your test code here?

               

              I've looked at your logs and I only saw one GetKeyValueCommand, in node1.log, before the PutKeyValueCommand:

               

              2012-06-12 15:55:28,020 - [TRACE] - InvocationContextInterceptor.handleAll(123) | Invoked with command GetKeyValueCommand {key=project_blue.txnrealtimejob_0_1.TxnRealTimeJob$1SCDSK_tMySQLSCDCached_1@315a0, flags=null} and InvocationContext [SingleKeyNonTxInvocationContext{flags=null}]

              ...

              2012-06-12 15:55:28,031 - [TRACE] - InvocationContextInterceptor.handleAll(123) | Invoked with command PutKeyValueCommand{key=project_blue.txnrealtimejob_0_1.TxnRealTimeJob$1SCDSK_tMySQLSCDCached_1@315a0, value=project_blue.txnrealtimejob_0_1.TxnRealTimeJob$1SCDStruct_tMySQLSCDCached_1@327626e9, flags=null, putIfAbsent=true, lifespanMillis=-1, maxIdleTimeMillis=-1} and InvocationContext [SingleKeyNonTxInvocationContext{flags=null}]

               

              Also, I'm not sure if this is a problem, but it's a good idea to mark your Externalizer classes static, so that you don't need an instance of the key or value class to instantiate its externalizer.

              • 4. Re: Infinispan replication not working?
                jrox

                The trace log does not include any process that is actually querying the cache. So I thought the GetKeyValueCommand in node1.log is basically initiated to see whether the key is already present before it is being inserted with the PutKeyValueCommand in node1.log. At the same time this should be inserted in node2.log with the PutKeyValueCommand which it seems to do BUT the data that gets replicated seems not to be okay as you can see on line 713 in node2.log. (key=project_blue.txnrealtimejob_0_1.TxnRealTimeJob$1SCDSK_tMySQLSCDCached_1@0 ...).. The 0 at the end doesn't seem to be a good sign.

                 

                It is quite hard to post the code as the code is generated code out of a tool where I don't have much freedom on how I would like to implement infinispan, that's also the reason why the externalizers are not static, because they are local inner classes that don't allow the static keyword. If you think the error must be somewhere in the code as this should work let me know and I'll try and simplify the code and post it here.