Download presentation
Presentation is loading. Please wait.
Published byKristian Burridge Modified over 10 years ago
1
Fan Qi fan.qi@nus.edu.sg Database Lab 1, com1 #01-08 CS3223 Tutorial 10
2
Transaction Management
3
Cascadeless Schedule Every read is from a committed value or from DB Strict Schedule If one object is written by a transaction, it is not concurrently read/write by other transactions Recovery can be efficiently done by before-image
4
Protocol Implementation 2PL & Strict 2PL Gain all the locks before release Hold all locks before commit/abort Multi-granular Locking Four locks available, IS, IX, S, X To obtain S or IS lock on a node, must already hold IS or IX lock on parent node To obtain X or IX lock on a node, must already hold IX lock on parent node
5
Question 1 a) R1(X), R2(X), W1(X), W2(X) b) W1(X), R2(Y), R1(Y), R2(X) c) R1(X), R2(Y), W3(X), R2(X), R1(Y) d) R1(X), R1(Y), W1(X), R2(Y), W3(Y), W1(X), R2(Y) e) R1(X), W2(X), W1(X), Abort2, Commit1 f) R1(X), W2(X), W1(X), Commit2, Commit1 g) W1(X), R2(X), W1(X), Abort2, Commit1 h) W1(X), R2(X), W1(X), Commit2, Commit1 i) W1(X), R2(X), W1(X), Commit2, Abort1 j) R2(X), W3(X), Commit3, W1(Y), Commit1, R2(Y), W2(Z), Commit2 k) R1(X), W2(X), Commit2, W1(X), Commit1, R3(X), Commit3 l) R1(X), W2(X), W1(X), R3(X), Commit1, Commit2, Commit3
6
Question 2 a) R1(X), R2(X), W1(X), W2(X) b) W1(X), R2(Y), R1(Y), R2(X) c) R1(X), R2(Y), W3(X), R2(X), R1(Y) d) R1(X), R1(Y), W1(X), R2(Y), W3(Y), W1(X), R2(Y) e) R1(X), W2(X), W1(X), Abort2, Commit1 f) R1(X), W2(X), W1(X), Commit2, Commit1 g) W1(X), R2(X), W1(X), Abort2, Commit1 h) W1(X), R2(X), W1(X), Commit2, Commit1 i) W1(X), R2(X), W1(X), Commit2, Abort1 j) R2(X), W3(X), Commit3, W1(Y), Commit1, R2(Y), W2(Z), Commit2 k) R1(X), W2(X), Commit2, W1(X), Commit1, R3(X), Commit3 l) R1(X), W2(X), W1(X), R3(X), Commit1, Commit2, Commit3
7
Question 2 (Examples)
8
Question 3 a) Read record P1200:5. b) Read records P1200: 98 through P1205:2. c) Read all (records on all) pages in file F1. d) Read pages P500 through P520. e) Read pages P10 through P980. f) Read all pages in F1 and (based on the values read) modify 10 pages. g) Delete record P1200:98. (This is a blind write.) h) Delete the first record from each page. (Again, these are blind writes.) i) Delete all records. Database | File | Page | Record
9
Question 3 (Examples) Database File 1 File 2 1,10001001,2000
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.