db-16 : jta transactions in the rdbms, what's going on down there? deb walz principal software...
TRANSCRIPT
DB-16: JTA Transactions in the RDBMS, What's Going on Down There?
Deb WalzPrincipal Software Engineer
2 © 2005 Progress Software Corporation 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
3 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
D I S C L A I M E R
Under Development
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.
D I S C L A I M E R
4 © 2005 Progress Software Corporation 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
5 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
J2EE Architecture
Application Client
Container
J2SE
Application Client
JM
S
JA
AS
JA
XP
JD
BC
Applet
Container
J2SE
AppletWeb Container
J2SE
JM
S
JA
AS
JA
XP
JT
A
Co
nn
ecto
r
JD
BC
Java Mail
JAF
JSP Servlet
HTTP SSL
HTTP SSL EJB Container
J2SE
EJB
JM
S
JA
AS
JA
XP
JT
A
Co
nn
ecto
r
JD
BC
Java Mail
JAF
Database
6 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Architecture
JTA UserTransaction
ApplicationServer
Application ResourceManager
TransactionManager
EJB
JTA XAResource
JTA TransactionManager
JDBC, JMS
7 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Prepare Phase
Two-Phase Commit Protocol
Transaction
ManagerOracle
OpenEdge
OpenEdgePrepare to Commit
Ready to Commit
Resolution Phase
Transaction
ManagerOracle
OpenEdge
OpenEdgeCommit
Complete
8 © 2005 Progress Software Corporation 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(…)
9 © 2005 Progress Software Corporation 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);
10 © 2005 Progress Software Corporation 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);
11 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JDBC Code Snippets - 3
xaRes.start(xid1);
...
xaRes.end(xid1);
... xaRes.start(xid1,TMJOIN);
...
xaRes.end(xid1);
Connection #1
Connection #2
12 © 2005 Progress Software Corporation 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);
13 © 2005 Progress Software Corporation 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
14 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Overview Changes to database engine Planning for JTA support Monitoring JTA Transactions
JTA Transactions in the RDBMS
15 © 2005 Progress Software Corporation 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
16 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
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
JTA Transactions
17 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
TransactionList
UserList
Data Structures – Traditional Transactions
TransactionTableEntry
Transaction Id
State
User Id
Time Started
Flags
18 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Data Structures – JTA Transactions
Transaction Id
State
User Id
Time Started
Pointer to JTA
Flags
JTA XID
State
Transaction Id
User Id
Locks
JTA Entry
JTA (XID)List
Active
Idle
Trad’l
TransactionList
UserList
TransactionTableEntry
19 © 2005 Progress Software Corporation 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
20 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Crash Recovery - Review
Redo Phase Undo Phase
– Physical Undo
– Logical Undo
21 © 2005 Progress Software Corporation 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 2005Multi-user session begin. (333)Begin Physical Redo Phase at 0 . (5326)Physical Redo Phase completed … (7161)Begin JTA Lock ApplicationEnd JTA Lock Application …
22 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Thu Mar 24 18:21:22 2005Multi-user session begin. (333)Begin Physical Redo Phase … (5326)Physical Redo Phase Completed … (7161)Begin JTA Lock ApplicationEnd JTA Lock ApplicationBegin Physical Undo 2 Transactions … (7163)Physical Undo 1 Live JTA Transactions detectedPhysical 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 detectedLogical Undo Phase Completed … (12095)Logical Undo: 1 Live JTA Transactions active
New Lock Acquisition Phase – after database crash
23 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Crash Recovery – New BI Notes
RL_TBGN
RL_CXINS
RL_RMCR
RL_TEND
Traditional Transaction
RL_TBGN
RL_CXINS
RL_RMCR
RL_RCOMM
RL_TEND
4GL 2PC Transaction
RL_GTBGN
RL_XID
RL_TBLLK
RL_CXINS
RL_RMCR
RL_GEND
RL_GPREP
RL_GTEND
JTA Transaction
24 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Crash Recovery – Effect on Database Utilities
Redo Phase: JTA Transaction: <xid> in state: Prepared (12572)
Redo Phase: JTA Transactions must access crash recovery through a multi-user process (12573)
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)
25 © 2005 Progress Software Corporation 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
26 © 2005 Progress Software Corporation 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 EntryJTA (XID)List
Lock Entries …
27 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Overview Changes to database engine Planning for JTA support Monitoring JTA Transactions
JTA Transactions in the RDBMS
28 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Planning for JTA Support
Enabling JTA Support Space allocation Startup Parameters
29 © 2005 Progress Software Corporation 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
30 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Space Allocation
More notes implies more BI and AI space needed
31 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Startup Parameters
-maxxids -L -bithreshold Standard performance tuning
– -bibufs
– -B
32 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
JTA Overview Changes to database engine Planning for JTA support Monitoring JTA Transactions
JTA Transactions in the RDBMS
33 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
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
Lock Table Display
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:
Pre-JTA:
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: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:
34 © 2005 Progress Software Corporation 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
35 © 2005 Progress Software Corporation 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
36 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Resolve JTA Transactions
1. Commit a JTA Transaction
2. Rollback a JTA Transaction
3. Quit
37 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
In Summary
JTA Overview Database Changes
– New transaction type
– Crash Recovery Changes
– Lock Manager Changes Planning for JTA Monitoring Enhancements
JTA Transactions in the RDBMS
38 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Questions?
39 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?
Thank you for your time!
40 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?