db-16 : jta transactions in the rdbms, what's going on down there? deb walz principal software...

40
DB-16: JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

Upload: henry-johnston

Post on 14-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

DB-16: JTA Transactions in the RDBMS, What's Going on Down There?

Deb WalzPrincipal Software Engineer

Page 2: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal 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

Page 3: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 4: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 5: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 6: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 7: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 8: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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(…)

Page 9: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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);

Page 10: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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);

Page 11: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 12: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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);

Page 13: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 14: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 15: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 16: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 17: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 18: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 19: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 20: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 21: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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 …

Page 22: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 23: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 24: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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)

Page 25: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 26: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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 …

Page 27: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 28: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 29: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 30: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 31: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 32: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 33: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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:

Page 34: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 35: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 36: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 37: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

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

Page 38: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

38 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?

Questions?

Page 39: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

39 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?

Thank you for your time!

Page 40: DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer

40 © 2005 Progress Software Corporation DB-16 JTA Transactions in the RDBMS, What's going on Down There?