2 Replies Latest reply on Apr 5, 2016 1:59 PM by godiedelrio

    Partition handling in invalidation mode caches

    godiedelrio

      Hi everybody. We are using Infinispan 7.2.5.Final as a L2 cache implementation for Hibernate 4.3.11.Final. All the caches are configured with invalidation/synchronous mode as the default configuration in Hibernate for Infinispan suggests. The cluster has 10+ nodes and we need consistency over availability (in terms of the CAP theorem). We've been doing some tests to see what happens with consistency in case of network partitions and figured out that partition handling is not active in invalidation cache mode.

      During startup, Infinispan creates PartitionManagerHandler's but only for distributed or replicated caches.

       

      @DefaultFactoryFor(classes = PartitionHandlingManager.class)
      public class PartitionHandlingManagerFactory extends AbstractNamedCacheComponentFactory implements
            AutoInstantiableFactory {
         @Override
         @SuppressWarnings("unchecked")
         public <T> T construct(Class<T> componentType) {
            if (configuration.clustering().partitionHandling().enabled()) {
               if (configuration.clustering().cacheMode().isDistributed() ||
                     configuration.clustering().cacheMode().isReplicated()) {
                  return (T) new PartitionHandlingManagerImpl();
               }
            }
            return null;
         }
      }
      

       

      In this scenario, after a network partition, all cluster partitions remain active, i.e, no partition enters degraded mode. This can leave us with two or more cluster partitions having inconsistent data until the partitions merge back, because an entry could be modified in one partition and remain outdated in the others.

      Can someone tell why partition handling isn't supported for invalidation cache mode?

      Thanks in advance

        • 1. Re: Partition handling in invalidation mode caches
          rvansa

          It's not implemented as nobody asked for that. Under partition, the safest thing to do with invalidation cache is to wipe it out, ignore any write operations and return nulls for all reads. If the partition handling worked as in dist/repl mode, writes would throw an exception (and some reads too) - I am not sure if Hibernate would handle such behaviour well, it would probably just fail all operations.

           

          Nevertheless, it seems that it could be an useful feature. Please, fill a JIRA for partition handling support on invalidation caches.

          • 2. Re: Partition handling in invalidation mode caches
            godiedelrio

            Thank you Radim, we've just created a JIRA around this issue. If you feel we should give more details let us know.