3 Replies Latest reply on Aug 22, 2014 8:20 AM by shawkins

    Transaction already associated - Teiid 8.9.0-Alpha1

    blaxell

      Hi,

       

      I run the following statement on teiid 8.9.0-Alpha1.

       

      begin
      insert into test_tables.target select * from test_tables.source;
      end
      
      

      While it is running (source table is quite big), i just run this query again and get the following exception

       

      ERROR [org.teiid.PROCESSOR] (Worker3_QueryProcessorQueue1610) +Pd1Qn6RePZf TEIID30019 Unexpected exception for request +Pd1Qn6RePZf.604: java.lang.AssertionError: Transaction al
      ready associated with request.
              at org.teiid.core.util.Assertion.failed(Assertion.java:73) [teiid-common-core-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.core.util.Assertion.assertTrue(Assertion.java:68) [teiid-common-core-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.Request.getTransactionContext(Request.java:320) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.Request.createProcessor(Request.java:310) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.Request.processRequest(Request.java:439) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:609) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:315) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:254) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:274) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.9.0.Alpha1.jar:8.9.0.Alpha1]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
              at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
      
      

       

      if the insert statement is not inside an anonymous procedure, it works fine. Also if you wait till the first query has completely finished before starting it again.

        • 1. Re: Transaction already associated - Teiid 8.9.0-Alpha1
          shawkins

          > if the insert statement is not inside an anonymous procedure, it works fine. Also if you wait till the first query has completely finished before starting it again.

           

          What method are you using to execute the first statement?  Are you using asynch calls?  The client should effectively block until execution is complete under a transactional scenario.

          • 2. Re: Transaction already associated - Teiid 8.9.0-Alpha1
            blaxell

            I open a session in SQuirrel SQL Client and run this

            1. begin 
            2. insert into test_tables.target select * from test_tables.source; 
            3. end

            twice in the same session. The second time just while the first run is being executed. Both executions are done within the single session

            • 3. Re: Transaction already associated - Teiid 8.9.0-Alpha1
              shawkins

              That type of multi-threaded use of the client is not expected.  A request scoped transaction is associated with the session under the presumption that the client calls are blocking.  So this is somewhat expected if the tooling is allowing you to executed the statements concurrently and a request scoped transaction is started.  We are typically pessimistic about starting a transaction when there is a procedure block, which may explain the difference in behavior you are seeing with or without the wrapping block.  You can set the connection or session property autoCommitTxn to OFF as well to disable Teiid's automatic starting of transaction.