0 Replies Latest reply on Dec 13, 2016 9:25 AM by vladsz83

    Async write-behind

    vladsz83

      Hi All,

       

      I'm testing the write-behind ability of Infinispan. I'm using JDBC String Based Store. In general, I need a reliable queue/set of cache modifications kept in memory and asynchronously flushing the changes into underlying DB. The database connection is supposed to be lost sometimes.  Current cache configuration is:

       

      new ConfigurationBuilder().clustering().cacheMode(CacheMode.DIST_SYNC)
      .invocationBatching().enable()
        .persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.
      class)
      .async().enabled(
      true).modificationQueueSize(50000).threadPoolSize(4)
      .fetchPersistentState(
      false).preload(false)
      .ignoreModifications(
      false)
      .purgeOnStartup(
      false)
      .dialect(DatabaseType.
      ORACLE)
      .table()
      .tableNamePrefix(
      "INFINICACHE")
      .idColumnName(
      "ID_COLUMN").idColumnType("VARCHAR2(255)")
      .dataColumnName(
      "DATA_COLUMN").dataColumnType("BLOB")
      .timestampColumnName(
      "TIMESTAMP_COLUMN").timestampColumnType("NUMBER")
      .connectionPool()
      .connectionUrl(
      "…")
      .username(
      "…").password("…")
      .driverClass(
      "oracle.jdbc.OracleDriver")
      .build();

       

      So, I collected several questions. Could anyone answer the following:

      1) Why the cache isn’t working when the connection is lost? It doesn’t want to start or put any record. I expected it would. The cache yields typical connection exceptions.

      2) Why the cache does preload even if “preload” option is set to false?

      3) I can’t enable the singleton mode. It issues:

      • 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:172)

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

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

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

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

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

                      at org.infinispan.cache.impl.CacheImpl.start(CacheImpl.java:854)

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

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

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

       

      Why?

      4) Can I change c3p0 pool to other one?

      5) Is it possible to map records to tables instead of saving into blobs?

      6) Can I store the queue on disk ?

      7) Is there a simplier way/api to implement custom store? Not via configuration/builder?

       

      Thanks.