8 Replies Latest reply on Jan 11, 2010 3:06 AM by galder.zamarreno

    CacheLoader saves but rollbacks

      I'm testing cache persistence with Core3.2 and Pojo3.0. I use a JdbcCacheLoader, which hits HSQLDB.

      The test starts the cache, attaches the "table" component, and modifies its state within a JTA transaction.
      --> As soon as the attached componenent is modified HSQLDB is written to (lines appear in jbosscache.log), which is fine; then the process terminates.
      --> In the HSQLDB .log file i can see inserts and stuff that involves the FQN of my component. At the end of the script though there is a rollback, so my data is never saved (the JBOSSCACHE table is empty)

      I added a cache loader interceptor, and i can see node events, but no TransactionRegisteredEvent. Maybe that is related?

      My cache config:

      I'm testing cache persistence with Core3.2 and Pojo3.0. I use a JdbcCacheLoader, which hits HSQLDB.
      
      The test starts the cache, attaches the "table" component, and modifies its state within a JTA transaction.
      --> As soon as the attached componenent is modified HSQLDB is written to (lines appear in jbosscache.log), which is fine; then the process terminates.
      --> In the HSQLDB .log file i can see inserts and stuff that involves the FQN of my component. At the end of the script though there is a rollback, so my data is never saved
      
      I added a cache loader interceptor, and i can see node events, but no TransactionRegisteredEvent. Maybe that is related?


        • 1. Re: CacheLoader saves but rollbacks

          Oops, i didn't post the config. There really should be an edit button. '

          <?xml version="1.0" encoding="UTF-8"?>
          <jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
           <transaction transactionManagerLookupClass="hellotrackworld.impl.srv.AtomikosTransactionManagerLookup"/>
           <locking
           isolationLevel="SERIALIZABLE"
           lockParentForChildInsertRemove="false"
           lockAcquisitionTimeout="20000"
           nodeLockingScheme="pessimistic"
           writeSkewCheck="false"
           concurrencyLevel="500"/>
          



          • 2. Re: CacheLoader saves but rollbacks

            Sorry, my connection is so poor that i'm not even able to post a XML config. I'll try again tomorrow.

            • 3. Re: CacheLoader saves but rollbacks

              At last here is the complete replSync-service.xml. Sorry for the inconvenience.

              <?xml version="1.0" encoding="UTF-8"?>
              <jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
               <transaction transactionManagerLookupClass="hellotrackworld.impl.srv.AtomikosTransactionManagerLookup"/>
               <locking
               isolationLevel="SERIALIZABLE"
               lockParentForChildInsertRemove="false"
               lockAcquisitionTimeout="20000"
               nodeLockingScheme="pessimistic"
               writeSkewCheck="false"
               concurrencyLevel="500"/>
               <loaders passivation="false" shared="false">
               <preload>
               <node fqn="/"/>
               </preload>
               <loader
               class="org.jboss.cache.loader.JDBCCacheLoader"
               async="false"
               fetchPersistentState="true"
               ignoreModifications="false"
               purgeOnStartup="false">
               <properties>
               cache.jdbc.table.name=jbosscache
               cache.jdbc.table.create=true
               cache.jdbc.table.drop=true
               cache.jdbc.table.primarykey=jbosscache_pk
               cache.jdbc.fqn.column=fqn
               cache.jdbc.fqn.type=VARCHAR(255)
               cache.jdbc.node.column=node
               cache.jdbc.node.type=BINARY
               cache.jdbc.parent.column=parent
               cache.jdbc.driver=org.hsqldb.jdbcDriver
               cache.jdbc.url=jdbc:hsqldb:hsql://localhost/jbc
               cache.jdbc.user=sa
               cache.jdbc.password=
               </properties>
               </loader>
               </loaders>
              </jbosscache>
              


              • 4. Re: CacheLoader saves but rollbacks

                If i comment the following:

                TransactionManager tm = Spring.getBean ( TransactionManager.class , "atomikosTransactionManager" );
                cache.getCache().getConfiguration().getRuntimeConfig().setTransactionManager(transactionManager);

                the behaviour is completely different:
                -instead of a single transaction spanning all operations between a SET AUTOCOMMIT FALSE and ROLLBACK, the log file structure is more complicated, including many SET AUTOCOMMIT FALSE and SET AUTOCOMMIT TRUE. More importantly there is no ROLLBACK at the end.
                -consequently the data is really persisted

                So, it works with the default, local transaction manager, but not with a JTA TM (Atomikos) ..


                • 5. Re: CacheLoader saves but rollbacks
                  galder.zamarreno

                  Maybe you wanna try with JBoss Transactions which is a JTA TM as well? To try, download or set correct dependencies to JBoss Transactions (see jbc trunk for example) and use http://anonsvn.jboss.org/repos/jbosscache/core/trunk/src/main/java/org/jboss/cache/transaction/JBossStandaloneJTAManagerLookup.java lookup class. That class also shows how to get hold of a JBoss Transaction TM in a standalone environment.

                  • 6. Re: CacheLoader saves but rollbacks

                    Thanks for the reply, it's nice that someone reads these "old" messages.
                    I have temporarily stopped working on the persistence aspect, but yes i could try with JBossTS when i'm back on it.

                    • 7. Re: CacheLoader saves but rollbacks

                      Now that i think about it, has JBC been tested with Atomikos, or TransactionManagers other than JBossTS?

                      • 8. Re: CacheLoader saves but rollbacks
                        galder.zamarreno

                        We don't currently test Atomikos but we're open to contributions from the community to include it amongst the transaction managers that we test