100 likes | 115 Vues
This system ensures durable and consistent transaction processing, allowing successful completion or abort of transactions. It supports actions like withdrawing, transferring funds, and maintaining balance. The architecture involves transaction managers, resource managers, and precise phases such as prepare, commit, and abort. The system prevents transaction interference and ensures the isolation of concurrent transactions to maintain serializability. It also addresses potential issues like deadlock and efficiently manages resource locking and unlocking.
E N D
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 Read savings (sub 100) Read checking (add 100) Write savings Write checking Transaction Examples
Transaction architecture Transaction manager Join Application logic Prepare, commit, abort Resource managers
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”
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
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
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
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
Transaction 1: Lock A Lock B … Release all Transaction 2: Lock B Lock A … Release all Danger from Waiting: Deadlock
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