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

Distinguishing multiple server Store configurations is impossible

XMLWordPrintable

      Problem description

      One of our users reported that when using two Deployed Cache Stores, their configuration gets overridden and both behaves as if they had the same configuration. Here's an example:

      <distributed-cache name="cassandracache1" owners="2" segments="256" mode="SYNC">
          <store name="store1" class="org.infinispan.persistence.cassandra.CassandraStore" preload="true">
              <property name="autoCreateKeyspace">
                  true
              </property>
              <property name="keyspace">
                  Infinispan
              </property>
              <property name="entryTable">
                  InfinispanEntries
              </property>
              <property name="servers">
                  172.17.0.2[9042]
              </property>
          </store>
      </distributed-cache>
      <distributed-cache name="cassandracache2" owners="2" segments="256" mode="SYNC">
          <store name="store2" class="org.infinispan.persistence.cassandra.CassandraStore" preload="true">
              <property name="autoCreateKeyspace">
                  true
              </property>
              <property name="keyspace">
                  Infinispan
              </property>
              <property name="entryTable">
                  InfinispanEntries1
              </property>
              <property name="servers">
                  172.17.0.2[9042]
              </property>
          </store>
      </distributed-cache>
      

      Both caches (cassandracache1 and cassandracache2) use the same entryTable which is set to InfinispanEntries1.

      Investigation

      CacheStoreFactory implementation were created to fabricate Loader/Writer instance based on parsed configuration (via createInstance method). This method receives from PersistenceManagerImpl an instance of an AbstractStoreConfiguration (here's an example (1)) two times - once per each parsed configuration. The parsing part seems OK but we do not parse Cache Store Name, which makes differentiating both configuration impossible.

      Proposed fix

      • Add name attribute to StoreConfiguration.
      • Either add an explicit parameter to CacheStoreFactory#createInstance(StoreConfiguration cfg, String cacheStoreName) or scan for Cache Store name in both implementations (DeployedCacheStoreFactory and LocalClassLoaderCacheStoreFactory.
      (1) AbstractStoreConfiguration [attributes=DeployedStoreConfiguration = [fetchPersistentState=false, purgeOnStartup=false, ignoreModifications=false, preload=true, shared=false, transactional=false, maxBatchSize=100, properties={keyspace=Infinispan, connectionPool.poolTimeoutMillis=5, entryTable=InfinispanEntries, connectionPool.idleTimeoutSeconds=120, connectionPool.heartbeatIntervalSeconds=30, autoCreateKeyspace=true, servers=172.17.0.2[9042]}, customStoreClassName=org.infinispan.persistence.cassandra.CassandraStore], async=AsyncStoreConfiguration [attributes=AsyncStoreConfiguration = [enabled=false, modificationQueueSize=1024, threadPoolSize=1]], singletonStore=SingletonStoreConfiguration [attributes=SingletonStoreConfiguration = [enabled=false, push-state-timeout=10000, push-state-when-coordinator=true]]]
      

              remerson@redhat.com Ryan Emerson
              slaskawi@redhat.com Sebastian Łaskawiec (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: