{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

24-tx-notes - Transaction Processing CPS 116 Introduction...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Transaction Processing CPS 116 Introduction to Database Systems 2 Announcements (Tue. Dec. 6) Extra credit (20 points) due today midnight Homework #4 due Thursday Sample solution available by email this weekend Project demo next Monday-Wednesday Submit your project report & code by demo time; see project description on course website for details Final exam in 2 weeks Open book, open notes; focus on the second half Sample final & solution available Review on Thursday 3 Review ACID Atomicity: TX’s are either completely done or not done at all Consistency: TX’s should leave the database in a consistent state Isolation: TX’s must behave as if they are executed in isolation Durability: Effects of committed TX’s are resilient against failures SQL transactions -- Begins implicitly SELECT …; UPDATE …; ROLLBACK | COMMIT;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 4 Concurrency control Goal: ensure the “I” (isolation) in ACID A B C T 1 : read( A ); write( A ); read( B ); write( B ); commit; T 2 : read( A ); write( A ); read( C ); write( C ); commit; 5 Good versus bad schedules T 1 T 2 r( A ) w( A ) r( B ) w( B ) r( A ) w( A ) r( C ) w( C ) T 1 T 2 r( A ) w( A ) r( A ) w( A ) r( B ) r( C ) w( B ) w( C ) T 1 T 2 r( A ) r( A ) w( A ) w( A ) r( B ) r( C ) w( B ) w( C ) Good! 6 Serial schedule Execute transactions in order, with no interleaving of operations T 1 .r( A ), T 1 .w( A ), T 1 .r( B ), T 1 .w( B ), T 2 .r( A ), T 2 .w( A ), T 2 .r( C ), T 2 .w( C ) T 2 .r( A ), T 2 .w( A ), T 2 .r( C ), T 2 .w( C ), T 1 .r( A ), T 1 .w( A ), T 1 .r( B ), T 1 .w( B ) ) Isolation achieved by definition! Problem: no concurrency at all Question: how to reorder operations to allow more concurrency
Background image of page 2
3 7 Conflicting operations Two operations on the same data item conflict if at least one of the operations is a write r( X ) and w( X ) conflict w( X ) and r( X ) conflict w( X ) and w( X ) conflict r( X ) and r( X ) do not r/w( X ) and r/w( Y ) do not Order of conflicting operations matters E.g., if T 1 .r( A ) precedes T 2 .w( A ), then conceptually, T 1 should precede T 2 8 Precedence graph A node for each transaction A directed edge from T i to T j if an operation of T i precedes and conflicts with an operation of T j in the schedule T 1 T 2 r( A ) w( A ) r( A ) w( A ) r( B ) r( C ) w( B ) w( C ) T 1 T 2 r( A ) r( A ) w( A ) w( A ) r( B ) r( C ) w( B ) w( C ) T 1 T 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}