1 2 Previous Next 23 Replies Latest reply on Sep 1, 2010 9:52 AM by rareddy Go to original post
      • 15. Re: Using the INPUTS qualifier in Update Procedure
        rakeshsagar

        Hi Ramesh,

         

        Thanks for your inputs.

         

        Updating the view worked when I used the autoCommitTxn  property.

         

        I also tried creating an XA datasource but did not succeeed.

        Can you tell me the procedure to create an XA datasource and add this to the Source Model inside the VDB.

         

        Thanks

        Rakesh

        • 16. Re: Using the INPUTS qualifier in Update Procedure
          rareddy

          What have you tried? and what did not work?

           

          I am not sure if Designer supports creating a XA data source. You would have to create them manually otherwise. There are many samples of XA data source file in "<jboss-as>/docs/examples/jca". You can also use JBoss AS "admin-console" web-app to create XA data sources.

           

          Ramesh..

          • 17. Re: Using the INPUTS qualifier in Update Procedure
            blafond

            I believe you can create a non-XA connector from Designer and then you can hand-edit the resulting xxxx-ds.xml file as needed to convert this to a XA connection factory.

             

            Designer is not intended to be the Admin tool for Teiid. As such, there will be limitations and this is one of them.

             

            Teiid Designer 7.0+ utilizes DTP's connection profiles for managing source connections. I don't think DTP has exposed any concept of XA, or transactional connection profiles.

             

            The "Modeling > Create Data Source" action is only a convenience method to create (and deploy) a Data Source on Teiid. This is accomplished by requiring that a "Connection Profile" be associated with a Relational Source model. You can execute the "Modeling > Set Connection Profile" action to inject the CP information into a relational model. This action will not work if there are no Connection Profiles defined in DTP, so again, Designer's connector paradigm is focused on CTP Connection Profiles.

             

            Barry LaFond

            Teiid Designer Project

            • 18. Re: Using the INPUTS qualifier in Update Procedure
              jdoyle

              Designer does not currently create XA datasources.  It's something we could add in the future.  You'll have to create the datasource with one of the methods that Ramesh suggests.

               

              ~john

              • 19. Re: Using the INPUTS qualifier in Update Procedure
                rakeshsagar

                Hi Ramesh,

                 

                I am trying to update a table in oracle  and my data source is XA datasource and I am using local transactions  i,e setting connection.setAutoCommit(false);

                 

                When I try to execute the insert command I get the following error.

                 

                Message:Could not enlist in transaction on entering meta-aware object!

                 

                 

                17:24:36,470 WARN  [PROCESSOR] Processing exception 'Error Code:0 Message:Error
                Code:0 Message:Could not enlist in transaction on entering meta-aware object!; -
                nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unab
                led to enlist resource, see the previous warnings. tx=TransactionImple < ac, Bas
                icAction: a8606b7:88b:4c7cec58:6f status: ActionStatus.ABORT_ONLY >); - nested t
                hrowable: (org.jboss.resource.JBossResourceException: Could not enlist in transa
                ction on entering meta-aware object!; - nested throwable: (javax.transaction.Sys
                temException: java.lang.Throwable: Unabled to enlist resource, see the previous
                warnings. tx=TransactionImple < ac, BasicAction: a8606b7:88b:4c7cec58:6f status:
                ActionStatus.ABORT_ONLY >))' for request 65PHS7AJAk2H.3.  Exception type org.te
                iid.core.TeiidProcessingException thrown from org.jboss.resource.connectionmanag
                er.TxConnectionManager$TxConnectionEventListener$TransactionSynchronization.chec
                kEnlisted(TxConnectionManager.java:879). Enable more detailed logging to see the
                entire stacktrace.

                 

                 

                Please help me in solving this problem.

                 

                Thanks

                • 20. Re: Using the INPUTS qualifier in Update Procedure
                  rareddy

                  Rakesh,

                   

                  You are setting the "connection.setAutoCommit(false)" on the Teiid connection right? to enable local transactions.

                   

                  I have done extensive testing with different types of data sources and various settings and came up conclusion that you some how still using "local" connections instead of XA. May be your VDB still points to the old "local" jndi names please check. Other than that there should not be any reason you are seeing this issue.

                   

                  Generally you can read this documentation about transactions in Teiid. However, I want explain little more on how to configure the data sources in each transaction type in JBoss AS as a general discussion.

                   

                  Teiid supports three types of transactions.

                   

                  Command:  This means "setAutoCommit(true)" on the Teiid JDBC Connection.  Although, for the user it is a single connection, for Teiid it still needs to manage multiple sources underneath. To support this an additional URL property called "autoCommitTxn" is used to define further behavior by the Teiid connection.

                  • autoCommitTxn = ON, Teiid always starts a single XA transaction over all your physical sources. It does not matter how many sources Teiid is covering under this transaction.
                  • autoCommitTxn = OFF, Teiid does not start any transaction. In this case sources are on their own to manage the transactions. So, in this case failure in one source does not affect the result of other sources involved in execution of single Teiid statement.
                  • autoCommitTxn = DETECT, in this mode Teiid detects is the executed statement is over multiple physical sources, if yes, then it creates a wrapping XA transaction across all the sources, otherwise if it is a single source it uses the source's transaction semantics.

                   

                  Local: This means, the client program is controlling the transaction boundaries by setting "setAutoCommit(false)". Then using "commit" and "rollback" on the connection. The advantage here is, you can execute multiple user level Teiid statements (each may correspond to many physical sources) in a single transaction.

                   

                  Global: Global is where you not only include Teiid statement executions, you also can include third party source (independent of Teiid) to participate in same transaction as Teiid.

                   

                  So, what you can glean from above is, expect for ""autoCommitTxn=OFF" case, you need XA based data-sources in the JBoss AS, if you want to be fully transactional system over multiple sources. NO EXCEPTIONS.

                   

                  However, in reality that is not always the case. Some sources you use are capable of XA, some are not. To distinguish between the transactional capabilities of sources, JBoss AS offers three different types of data sources.

                   

                  • xa-datasource - capable of participating in XA based transaction.
                  • local-datasource - designed for individual data source use, does not participate in XA, unless this is the only source that is local data source that is participating in this particular XA transaction.
                  • no-tx-datasource - does not participate in XA at all. A XA transaction may include this type data source on same thread, but it will not be subject to any transactional terms.

                   

                  Now, you can configure your Teiid sources as any one of the data sources defined above.  The behavior of client program depends on  how you configured data source and what is your transaction demarcation.

                   

                  For example let's go though few use cases of different types of sources. Let's say you have 3 sources A, B, C.  I will show different types by appending "xa", "local", "no-tx" in different situations

                   

                  • A-xa B-xa, C-xa : Can participate in all transactional scopes. No restrictions.
                  • A-xa, B-xa, c-local: Can participate in all transactional scopes. Note that there is only one single source is "local". Also, it is assumed that in the global case, the third party source is also XA.
                  • A-xa, B-XA, C-no-tx : Can participate in all transactional scopes. Note "C" is not a really bound by any transactional contract. So, really A, and B are only participents in transaction.
                  • A-xa, B-local, C-no-tx : Can participate in all transactional scopes. Note "C" is not a really bound by any transactional terms, and there is only single "local" source.
                  • if any two or more sources are "local" :  They can only participate in "autoCommitTxn=OFF" mode. Otherwise will end with exception as "Could not enlist in transaction on entering meta-aware object!;" exception.
                  • A-no-tx, B-no-tx, C-no-tx : Can participate in all transaction scopes, but none of the sources will be bound by XA. This equivalent to not using transactions or setting "autoCommitTxn=OFF".

                   

                  So, pay attention to what kind of data source you are using underneath the Teiid. I know currently Teiid Designer creates "local" data source by default which is not optimal. We would very much like this to be creating a XA data source, however with current limitations with DTP we had to create "local" connections. This will be revisited in future releases.

                   

                  To create XA data source, look in JBoss AS "doc" directory for example templates, or use the "admin-console" to create the XA data sources. Please note that Teiid can only guarantee transactional semantics only if the physical sources support transactions.

                   

                  As last piece of advice, if your source is not XA, and not the only local source and can not use "no-tx", then you can look into extending the source to implement the compensating XA implementation. i.e. define your own resource manager for your source and manage the transaction the way you want it to behave.  Search JBoss community if anybody implemented as such implementations, but this is last resort and it is not failure proof.

                   

                  To summarize as SteveH put it

                  1. use XA if possible
                  2. use no-tx if applicable
                  3. use autoCommitTxn = OFF
                  4. write a compensating XA based implementation.


                  Hope this helps everybody who may be running into transactional issues with Teiid.

                   

                  Thanks.

                   

                  Ramesh..

                  • 21. Re: Using the INPUTS qualifier in Update Procedure
                    rakeshsagar

                    Hi Ramesh,

                     

                    Yes I am using local transactions by setting connection.setAutoCommit(false).

                     

                    regarding the statement

                     

                    if any two or more sources are "local" :  They can only participate in  "autoCommitTxn=OFF" mode. Otherwise will end with exception as "Could not enlist in transaction on entering meta-aware object!;" exception.

                     

                    I have a question

                     

                    If I have 2 local sources and I had set "autoCommitTxn=OFF" and also set connection.setAutoCommit(false) and trying to update the 2 sources using the insert into command, I am getting "Could not enlist in transaction on entering meta-aware object!;" exception.

                     

                    Is this expected for local transactions and do we need to use the XAConnection for these kind of operations?

                     

                    Also, If I am having 4 sources and 2 are XA and 2 are local. Now I am trying to create the connection to Teiid using the TeiidDataSource connection and using XAConnection. Is this possible ?

                    • 22. Re: Using the INPUTS qualifier in Update Procedure
                      rareddy

                      Yes, it would end up in the exception.

                       

                      As soon as you set "connection.setAutoCommit(false)" then it is a "local" transaction, not a command level transaction. From the above explanation and from Teiid documentation note that "autoCommitTxn" mode ONLY applies when connection.setAutoCommit(true). Having a "autoCommitTxn" property on URL has no effect when you are working with either "global" or "local" transaction modes. It only applies in the request level transactions.

                       

                      Thanks.

                       

                      Ramesh..

                      • 23. Re: Using the INPUTS qualifier in Update Procedure
                        rareddy

                        If you are looking for transactionally safe operation over your both sources, you must have configured "xa-datasources", it does not matter what transactional scope you are using in your client.  Only in autoCommit=false and autoCommitTxn=OFF, you are saying you do not care about transactional scope, then you can configure which every data source you want.

                         

                        Ramesh..

                        1 2 Previous Next