1 / 10

The Transaction

The Transaction. Durable starting state. Durable, consistent, ending state. Collection of resource actions. Successful completion. Abort. Rollback. Withdraw $100 Read current balance new balance = current - 100 Write new balance Dispense cash. Transfer $100

landonm
Download Presentation

The Transaction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Transaction Durable starting state Durable, consistent, ending state Collection of resource actions Successful completion Abort Rollback

  2. Withdraw $100 Read current balance new balance = current - 100 Write new balance Dispense cash Transfer $100 Read savings (sub 100) Read checking (add 100) Write savings Write checking Transaction Examples

  3. Transaction architecture Transaction manager Join Application logic Prepare, commit, abort Resource managers

  4. Transaction manager Phase 1 commit() Transaction manager Phase 2 prepare() yes_or_no Transaction manager abort() Commit or abort One or more “no’s” Rollback All “yes”

  5. Withdraw $100 Read checking balance new balance = current - 100 Write new balance Dispense cash Transfer $100 Read savings (sub 100) Read checking (add 100) Write savings Write checking Transaction Interference time

  6. Isolation of transactions (Serializability) Two concurrent transactions Transaction_1 Shared resources Give the same result as: Transaction_2 Transaction_1 Transaction_2 Or: Transaction_2 Transaction_1

  7. Withdraw $100 Read checking balance new balance = current - 100 Write new balance Dispense cash Transfer $100 Read savings (sub 100) Read checking (add 100) Write savings Write checking Bad (Not Serializable) time

  8. Withdraw $100 Read checking balance new balance = current - 100 Write new balance Dispense cash Transfer $100 Read savings (sub 100) Read checking (add 100)Write savings Write checking OK (Same as Withdraw first) time

  9. Transaction 1: Lock A Lock B … Release all Transaction 2: Lock B Lock A … Release all Danger from Waiting: Deadlock

  10. Summary Application server Resource manager Transaction manager request(tp_ID,….) join(tp_ID) Lock OK or Already_locked More requests…. Prepare (tp_ID) commit_or_abort(tp_ID) Commit or rollback Unlock

More Related