UW CSE 444 - Introduction to Database Systems (17 pages)

Previewing pages 1, 2, 3, 4, 5, 6 of 17 page document View the full content.
View Full Document

Introduction to Database Systems



Previewing pages 1, 2, 3, 4, 5, 6 of actual document.

View the full content.
View Full Document
View Full Document

Introduction to Database Systems

110 views


Pages:
17
School:
University of Washington
Course:
Cse 444 - Database Internals
Database Internals Documents
Unformatted text preview:

Introduction to Database Systems CSE 444 Lecture 26 Distributed Transactions Announcements Wrap up lecture on Friday Short review example problems on the board Project 4 due this Friday Don t forget to terminate your jobs Course evaluaDons at the end of this lecture Today Distributed transacDons Because you loved transacDons so much the rst Dme 2 Partitioned data Employee TID eid name t1 53666 Jones Madras 28 35k t2 53688 Smith Chicago 38 32k t3 53650 Smith Chicago 29 48k t4 53831 Madayan Bombay 41 20k t5 53832 Guldu 32 20k VerDcal Fragment city Bombay age salary Horizontal Fragment 3 Distributed Data UPDATE Employee SET salary salary 2k WHERE age 30 4 Distributed Catalog How do we idenDfy a relaDon Naming issues Centralized catalog local name birth site global rela on name replica id global replica name Vulnerable to single site failure Compromizes site autonomy R approach Local catalog describing all local relaDons Birth site also keeps track of replicas and fragments Could be cached at other sites 5 Remember Transactions ACID Distributed Concurrency Control Distributed Recovery How can locks for objects be managed How can deadlocks be detected Atomicity and Durability need to be enforced across sites In a distributed secng a Xact spawns subtransacDons 6 Distributed Lock management Centralized Primary Copy one site deals with lock and unlock requests One copy of an object is designated as primary and requests are handled at that site Fully Distributed Manage requests locally 7 Deadlock detection Local and global waits for graphs T1 T2 T1 At site A T2 Global waits for graph T1 T2 At site B 3 algorithms 1 2 3 Construct global waits for graph periodically at a centralized site Construct waits for graphs hierarchically Abort long waiDng transacDons Phantom Deadlocks 8 Distributed Recovery Either all subtransacDons must commit or none of them Regular logging commit protocol The transacDon manager at the originaDng site is the coordinator The transacDon managers at the subtransacDons sites are the subordinates 9 2 Phase Commit Motivation 1 User decides to commit 2 commit coordinator 4 coordinator crash subordinate 1 3 commit subordinate 2 But I already aborted subordinate 3 10 2 Phase Commit Use 2 phases a voDng phase and a terminaDon phase Principle When a process makes a decision it votes yes no or commit abort A subordinate acknowledges messages acks Force write log record before sending Log records include Xact and coordinator ids Coordinator logs ids of subordinates 11 2 Phase Commit Phase 1 1 User decides to commit 2 prepare coordinator 4 yes subordinate 1 3 force write prepare 2 prepare 4 yes 4 yes 2 prepare subordinate 2 3 force write prepare subordinate 3 3 force write prepare 12 2 Phase Commit Phase 2 1 Force write commit 2 commit coordinator 5 Write end then forget Xact 4 ack subordinate 1 3 force write commit 2 commit 5 Commit Xact and forget it 4 ack 4 ack 2 commit subordinate 3 subordinate 2 3 force write commit 5 Commit Xact and forget it 3 force write commit Xact is now commiled 5 Commit Xact and forget it 13 2 Phase Commit Phase 1 with abort 1 User decides to commit 2 prepare coordinator 4 yes subordinate 1 3 force write prepare 2 prepare 4 no 4 no 2 prepare subordinate 3 subordinate 2 3 force write abort 5 Abort Xact and forget it 3 force write abort 5 Abort Xact and forget it 14 2 Phase Commit Phase 2 1 Force write abort 2 abort coordinator 5 Write end then forget Xact 4 ack subordinate 1 3 force write abort 5 Abort Xact and forget it subordinate 2 subordinate 3 15 Restart after failure How do we know if we are coordinator or subordinate and what do we do We see a commit or abort record We see a prepare record We are coordinator send to subordinates unDl we get an ack We are subordinate contact coordinator to determine status We see no prepare commit or abort We can unilaterally abort Any issues 16 Refinement 2PC with presumed abort ObservaDons Coordinator waits for acks to forget Xact no informaDon abort A reader does not care for commit abort outcome Re nements If abort is decided remove Xact from Xact table immediately If I get an abort msg no need to ack The abort log record of the coordinator does not need the subordinate list Abort records don t need to be force wrilen A reader Xact votes reader instead of yes no Coordinator does not need to communicate further with readers If all are readers no need for the 2nd phase 17


View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Introduction to Database Systems and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to Database Systems and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?