400 likes | 623 Views
DB-16 : JTA Transactions in the RDBMS, What's Going on Down There?. Deb Walz Principal Software Engineer. JTA Transactions in the RDBMS. JTA Overview Changes to database engine Planning for JTA support Monitoring JTA Transactions. Under Development.
E N D
DB-16: JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer
JTA Transactions in the RDBMS • JTA Overview • Changes to database engine • Planning for JTA support • Monitoring JTA Transactions DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Under Development D I S C L A I M E R D I S C L A I M E R • This talk includes information about potential future products and/or product enhancements. • What I am going to say reflects our current thinking, but the information contained herein is preliminary and subject to change. Any future products we ultimately deliver may be materially different from what is described here. DB-16 JTA Transactions in the RDBMS, What's going on Down There?
What is JTA? • Java™ Transaction API • Part of Sun’s Java 2 Platform, Enterprise Edition (J2EE) Reference Architecture • Supports SQL Two-Phase Commit (2PC) through JDBC DB-16 JTA Transactions in the RDBMS, What's going on Down There?
J2EE Architecture Applet Container J2SE Web Container J2SE EJB Container J2SE EJB JSP Java Mail Java Mail JDBC JDBC JTA JTA JMS JMS JAAS JAAS JAXP JAXP Connector Connector Database JAF JAF Application Client Container J2SE Servlet Application Client Applet JMS JAAS JAXP JDBC HTTP SSL HTTP SSL DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Architecture EJB JTA TransactionManager JDBC, JMS Application Server Transaction Manager JTA UserTransaction JTA XAResource Resource Manager Application DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Two-Phase Commit Protocol OpenEdge Prepare to Commit Transaction Manager Oracle Ready to Commit OpenEdge OpenEdge Commit Transaction Manager Complete Oracle OpenEdge • Prepare Phase • Resolution Phase DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA XAResource Methods • start (xid, …) • end (xid, …) • prepare (xid) • commit (xid, …) • rollback (xid) • recover(…) DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JDBC Code Snippets - 1 xaRes.start(xid, TMNOFLAGS); . . . xaRes.end(xid, TMSUCCESS); xaRes.prepare(xid); xaRes.commit(xid, false); DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JDBC Code Snippets - 2 xaRes.start(xid1, TMNOFLAGS); ... xaRes.end(xid1, TMSUSPEND); ... xaRes.start(xid1, TMRESUME); ... xaRes.end(xid1, TMSUCCESS); DB-16 JTA Transactions in the RDBMS, What's going on Down There?
xaRes.start(xid1); ... xaRes.end(xid1); ... xaRes.start(xid1,TMJOIN); ... xaRes.end(xid1); JDBC Code Snippets - 3 Connection #1 Connection #2 DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JDBC Code Snippets - 4 ... xaRes.start(xid2); ... xaRes.prepare(xid1); ... xaRes.end(xid2); DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Where Do I Learn More about JTA? • http://java.sun.com/j2ee/index.jsp • http://java.sun.com/products/jta/ • http://www.datadirect.com/developer/jdbc/topics/jta/index.ssp DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Transactions in the RDBMS • JTA Overview • Changes to database engine • Planning for JTA support • Monitoring JTA Transactions DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Database Changes • New type of transaction • Data structure changes • Crash Recovery changes • Lock Manager changes DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Transactions • Controlled by external transaction manager • May be associated with more than one database connection • Once prepared, they withstand shutdown • Peaceably co-exist with traditional transactions DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Data Structures – Traditional Transactions Transaction Id State User Id Time Started Flags User List Transaction List Transaction Table Entry DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Data Structures – JTA Transactions JTA XID State Transaction Id Active User Id Idle Locks Transaction Id State User Id Time Started Trad’l Flags Pointer to JTA JTA (XID) List User List Transaction List JTA Entry Transaction Table Entry DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Crash Recovery Changes • New Lock Application Phase • Presence of Lock Table • New BI Notes • Effect on database utilities DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Crash Recovery - Review • Redo Phase • Undo Phase • Physical Undo • Logical Undo DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Crash Recovery – New Lock Application Phase No Outstanding Prepared JTA Transactions Thu Mar 24 17:15:52 2005 Multi-user session begin. (333) Begin Physical Redo Phase at 0 . (5326) Physical Redo Phase completed … (7161) Begin JTA Lock Application End JTA Lock Application … DB-16 JTA Transactions in the RDBMS, What's going on Down There?
New Lock Acquisition Phase – after database crash Thu Mar 24 18:21:22 2005 Multi-user session begin. (333) Begin Physical Redo Phase … (5326) Physical Redo Phase Completed … (7161) Begin JTA Lock Application End JTA Lock Application Begin Physical Undo 2 Transactions … (7163) Physical Undo 1 Live JTA Transactions detected Physical Undo Phase Completed … (5331) Begin Logical Undo Phase, 1 incomplete transactions are being backed out. (7162) Logical Undo Phase begin … (11231) Logical Undo: 1 Live JTA Transaction detected Logical Undo Phase Completed … (12095) Logical Undo: 1 Live JTA Transactions active DB-16 JTA Transactions in the RDBMS, What's going on Down There?
RL_TBGN RL_CXINS RL_RMCR RL_TEND RL_GTBGN RL_XID RL_TBLLK RL_CXINS RL_RMCR RL_GEND RL_GPREP RL_GTEND Crash Recovery – New BI Notes Traditional Transaction 4GL 2PC Transaction JTA Transaction RL_TBGN RL_CXINS RL_RMCR RL_RCOMM RL_TEND DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Crash Recovery – Effect on Database Utilities The database contains limbo transactions. (2043) See list on the log file .lg. Use PROUTIL <db> -C 2phase recover. (2042) ** The server exited with error code 20. (800) Redo Phase: JTA Transaction: <xid> in state: Prepared (12572) Redo Phase: JTA Transactions must access crash recovery through a multi-user process (12573) DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Lock Manager Changes • Locks are owned by transaction • Locks are restored during crash recovery • Locks may be present on start up • If JTA Transactions in prepared state DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Lock Manager Data Structures JTA XID State Transaction Id User Id Locks JTA (XID) List JTA Entry Lock Entries … DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Transactions in the RDBMS • JTA Overview • Changes to database engine • Planning for JTA support • Monitoring JTA Transactions DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Planning for JTA Support • Enabling JTA Support • Space allocation • Startup Parameters DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Enabling JTA Support • proutil <dbname> –C enablejta • Disables after-imaging (if enabled) • proutil <dbname> -C disablejta DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Space Allocation • More notes implies more BI and AI space needed DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Startup Parameters • -maxxids • -L • -bithreshold • Standard performance tuning • -bibufs • -B DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Transactions in the RDBMS • JTA Overview • Changes to database engine • Planning for JTA support • Monitoring JTA Transactions DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Lock Table Display Pre-JTA: Usr Name Chn # Recid Tbl Lock Flags 5 deb REC 6 3712 5 SHR L 6 carol REC 7 3713 5 SHR L 7 rich REC 8 3714 5 SHR L 8 george REC 9 3715 5 SHR L Usr Name Chn # Recid Tbl Lock Flags Trans JTA 5 deb REC 6 3712 5 SHR 123 Yes - - REC 7 3713 5 SHR 142 Yes 7 rich REC 8 3714 5 SHR No 8 george REC 9 3715 5 SHR L 214 No With JTA Support: With JTA Support: With JTA Support: Usr Name Chn # Recid Tbl Lock Flags Trans JTA 5 deb REC 6 3712 5 SHR 123 Yes - - REC 7 3713 5 SHR 142 Yes 7 rich REC 8 3714 5 SHR No 8 george REC 9 3715 5 SHR L 214 No Usr Name Chn # Recid Tbl Lock Flags Trans JTA 5 deb REC 6 3712 5 SHR 123 Yes - - REC 7 3713 5 SHR 142 Yes 7 rich REC 8 3714 5 SHR No 8 george REC 9 3715 5 SHR L 214 No DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Shared Resources Display Current size of locking table (-L): 8192 Locking table entries in use: 691 Locking table high water mark: 692 Max clients per server (-Ma): 5 Max JTA transactions (-maxxids): 200 Delay of before-image flush (-Mf): 3 DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Active Transactions Display Usr Name Login Time Tx start Tx Id Tx State 5 dwalz <T1> <T2> 178 Active JTA - - <T3> <T4> 183 Idle JTA • Active JTA • Idle JTA • Prepared JTA • Rollback Only JTA DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Resolve JTA Transactions • Commit a JTA Transaction • Rollback a JTA Transaction • Quit Don't do it!! DB-16 JTA Transactions in the RDBMS, What's going on Down There?
In Summary JTA Transactions in the RDBMS • JTA Overview • Database Changes • New transaction type • Crash Recovery Changes • Lock Manager Changes • Planning for JTA • Monitoring Enhancements DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Questions? DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Thank you for your time! DB-16 JTA Transactions in the RDBMS, What's going on Down There?
DB-16 JTA Transactions in the RDBMS, What's going on Down There?