0 Replies Latest reply on Aug 23, 2013 12:42 PM by Leire Retana

    Cache size set to -1 when using RemoteCacheManager

    Leire Retana Newbie

      Hi all,

       

      We are trying to set infinispan as a remote standalone server, configured to back up data in a mysql database. The server seems to bound correctly to the database and the cache configuration seems to not give any troubles at startup about the table configuration.

       

      The issue arises when we use the RemoteCacheManager to retrieve the cache, and when that happens, the cache size is -1. The biggest issue is that we can't find errors nor in the client nor in the server, which makes it very difficult to debug. It seems logical to think the cache size should never be set to -1, any ideas on what's happening?

       

      We are using:

       

      - Infinispan server 5.3.0-Final

      - hot rod client 5.3.0-Final

      - mysql connector v 5.1.26

      - mysql server 5.5.24

       

      The configuration for the datasource and caches in the standalone infinispan server is as follows:

       

              <subsystem xmlns="urn:jboss:domain:datasources:1.1">

                  <datasources>

                      <datasource jndi-name="java:jboss/mydb" pool-name="newpool" enabled="true" jta="true" use-java-context="true" use-ccm="true">

                          <connection-url>jdbc:mysql://mysql.dev/mydb?characterEncoding=utf8&amp;useUnicode=true</connection-url>

                          <driver>mysql</driver>

                          <security>

                              <user-name>username</user-name>

                              <password>password</password>

                          </security>

                          <statement>

                              <prepared-statement-cache-size>100</prepared-statement-cache-size>

                              <share-prepared-statements/>

                          </statement>

                      </datasource>

                      <drivers>

                        <driver name="mysql" module="com.mysql">

                        </driver>

                      </drivers>

                  </datasources>

              </subsystem>

       

       

              <subsystem xmlns="urn:infinispan:server:core:5.3" default-cache-container="local">

                  <cache-container name="local" default-cache="default">

                      <local-cache name="default" start="EAGER">

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

                          <transaction mode="NONE"/>

                          <string-keyed-jdbc-store datasource="java:jboss/mydb" passivation="false" preload="false" purge="false" shared="true">

                              <property name="databaseType">MYSQL</property>

                              <string-keyed-table prefix="REMOTE">

                                  <id-column name="ID_COLUMN" type="VARCHAR(255)"/>

                                  <data-column name="DATA_COLUMN" type="BLOB"/>

                                  <timestamp-column name="TIMESTAMP_COLUMN" type="BIGINT"/>

                              </string-keyed-table>

                          </string-keyed-jdbc-store>

                      </local-cache>

                    </cache-container>

                    <cache-container name="security"/>

                </subsystem>

       

      Also script to create the table in the database:

       

            CREATE TABLE REMOTE_default (
                 ID_COLUMN     VARCHAR(255)     NOT NULL,
                DATA_COLUMN     BLOB    DEFAULT NULL,
                 TIMESTAMP_COLUMN BIGINT        DEFAULT NULL
             )
             ENGINE InnoDB;
       
             ALTER TABLE REMOTE_default
             ADD CONSTRAINT remote_default_pk PRIMARY KEY (ID_COLUMN);

       

      And last, the code in the client is very basic:

       

              ConfigurationBuilder configurationBuilder = new ConfigurationBuilder().addServers("test.dev:11222");

              RemoteCacheManager cachemanager = new RemoteCacheManager(configurationBuilder.build());

       

              RemoteCache<String, String> cache = cachemanager.getCache("default", true);

              cache.put("key1", "myvalue1");

       

      These four lines of code generate no errors when cache.size() returns -1

       

      Any help on troubleshooting this would be greatly appreciated. Thanks!