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

JdbcBinaryStore doesn't properly loadBucket from h2 database

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Out of Date
    • Affects Version/s: 6.0.0.CR1
    • Fix Version/s: None
    • Component/s: Loaders and Stores
    • Labels:
      None

      Description

      I test HTTP session persistence to h2 database in clustered enviroment within WildFly testsuite and occassionally I can see following exception:

      Unique index or primary key violation: "PRIMARY_KEY_A ON PUBLIC.""binarybased_default_host_session_db_cluster""(ID)"; SQL statement:
      INSERT INTO "binarybased_default_host_session_db_cluster" (datum, version, id) VALUES(?,?,?) [23505-159]
      	at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
      	at org.h2.message.DbException.get(DbException.java:169)
      	at org.h2.message.DbException.get(DbException.java:146)
      	at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:81)
      	at org.h2.index.PageBtree.find(PageBtree.java:121)
      	at org.h2.index.PageBtreeLeaf.addRow(PageBtreeLeaf.java:146)
      	at org.h2.index.PageBtreeLeaf.addRowTry(PageBtreeLeaf.java:100)
      	at org.h2.index.PageBtreeIndex.addRow(PageBtreeIndex.java:105)
      	at org.h2.index.PageBtreeIndex.add(PageBtreeIndex.java:96)
      	at org.h2.table.RegularTable.addRow(RegularTable.java:130)
      	at org.h2.command.dml.Insert.insertRows(Insert.java:124)
      	at org.h2.command.dml.Insert.update(Insert.java:84)
      	at org.h2.command.CommandContainer.update(CommandContainer.java:71)
      	at org.h2.command.Command.executeUpdate(Command.java:212)
      	at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143)
      	at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129)
      	at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:493)
      	at org.infinispan.persistence.jdbc.binary.JdbcBinaryStore.insertBucket(JdbcBinaryStore.java:405)
      	at org.infinispan.persistence.jdbc.binary.JdbcBinaryStore.storeInBucket(JdbcBinaryStore.java:519)
      	at org.infinispan.persistence.jdbc.binary.JdbcBinaryStore.write(JdbcBinaryStore.java:122)
      	at org.infinispan.persistence.manager.PersistenceManagerImpl.writeToAllStores(PersistenceManagerImpl.java:432) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.CacheWriterInterceptor$Updater.visitSingleStore(CacheWriterInterceptor.java:306) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.CacheWriterInterceptor$Updater.visitPutKeyValueCommand(CacheWriterInterceptor.java:250) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.CacheWriterInterceptor.store(CacheWriterInterceptor.java:212) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.CacheWriterInterceptor.commitCommand(CacheWriterInterceptor.java:115) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.CacheWriterInterceptor.visitPrepareCommand(CacheWriterInterceptor.java:101) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:96) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.EntryWrappingInterceptor.visitPrepareCommand(EntryWrappingInterceptor.java:93) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.invokeNextAndCommitIf1Pc(AbstractTxLockingInterceptor.java:93) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.locking.PessimisticLockingInterceptor.visitPrepareCommand(PessimisticLockingInterceptor.java:83) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.NotificationInterceptor.visitPrepareCommand(NotificationInterceptor.java:36) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.TxInterceptor.invokeNextInterceptorAndVerifyTransaction(TxInterceptor.java:114) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.TxInterceptor.visitPrepareCommand(TxInterceptor.java:101) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:96) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.statetransfer.TransactionSynchronizerInterceptor.visitPrepareCommand(TransactionSynchronizerInterceptor.java:42) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.statetransfer.StateTransferInterceptor.handleTopologyAffectedCommand(StateTransferInterceptor.java:253) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.statetransfer.StateTransferInterceptor.handleTxCommand(StateTransferInterceptor.java:184) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.statetransfer.StateTransferInterceptor.visitPrepareCommand(StateTransferInterceptor.java:89) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:96) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:106) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:70) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:96) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.BatchingInterceptor.handleDefault(BatchingInterceptor.java:70) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.AbstractVisitor.visitPrepareCommand(AbstractVisitor.java:96) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.commands.tx.PrepareCommand.acceptVisitor(PrepareCommand.java:125) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:321) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.transaction.TransactionCoordinator.commit(TransactionCoordinator.java:154) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.transaction.synchronization.SynchronizationAdapter.afterCompletion(SynchronizationAdapter.java:58) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.transaction.tm.DummyTransaction.notifyAfterCompletion(DummyTransaction.java:263) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.transaction.tm.DummyTransaction.runCommitTx(DummyTransaction.java:312) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:69) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:80) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.batch.BatchContainer.resolveTransaction(BatchContainer.java:101) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.batch.BatchContainer.endBatch(BatchContainer.java:83) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.batch.BatchContainer.endBatch(BatchContainer.java:64) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.CacheImpl.endBatch(CacheImpl.java:770) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.infinispan.AbstractDelegatingCache.endBatch(AbstractDelegatingCache.java:53) [infinispan-core-6.0.0.CR1.jar:6.0.0.CR1]
      	at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager$1.end(InfinispanSessionManager.java:151)
      	at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager$1.close(InfinispanSessionManager.java:141)
      	at org.wildfly.clustering.web.undertow.session.SessionAdapter.requestDone(SessionAdapter.java:69)
      	at io.undertow.servlet.spec.ServletContextImpl.updateSessionAccessTime(ServletContextImpl.java:708) [undertow-servlet-1.0.0.Beta20.jar:1.0.0.Beta20]
      	at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:501) [undertow-servlet-1.0.0.Beta20.jar:1.0.0.Beta20]
      	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:258) [undertow-servlet-1.0.0.Beta20.jar:1.0.0.Beta20]
      	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:205) [undertow-servlet-1.0.0.Beta20.jar:1.0.0.Beta20]
      	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:69) [undertow-servlet-1.0.0.Beta20.jar:1.0.0.Beta20]
      	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:134) [undertow-servlet-1.0.0.Beta20.jar:1.0.0.Beta20]
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:138) [undertow-core-1.0.0.Beta20.jar:1.0.0.Beta20]
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:622) [undertow-core-1.0.0.Beta20.jar:1.0.0.Beta20]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
      	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
      

      I've tried to debug this issue and I think the problem is following - the test creates and stores two buckets in org.infinispan.persistence.jdbc.binary.JdbcBinaryStore in storeInBucket(MarshalledEntry me, Integer bucketId). First bucket is stored and loaded always properly, but the second one, although is stored properly (exists in db), it's not loaded properly - resulting in null. This is the reason, why it tries to insert bucket with same id.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  tremes Tomas Remes
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: