mid-term-2011-winter

advertisement
CS 223 Mid Term Exam
Total Time: 1 hour 30 minutes.
Closed Books & Closed notes
Question 1: Let us consider a multidatabase system 1 that consist of set of databases
DBMS1, … DBMSn. Transactions in multidatabase are classified into two types: local
transactions that execute at a single DBMS, or global transactions that execute at more
than one DBMS. Each database system DBMS_i follows a concurrency control protocol
such as SGT, TO, etc. to ensure that its local schedules – that is, schedules consisting of
local transactions and sub-transactions of global transaction that execute at DBMS_i are
conflict serializable. Furthermore, a global transaction manager that controls execution of
the global transactions further ensures that execution of global transactions, by
themselves, is also serializable. Resulting schedules wherein local schedules are
serializable, and also the projection of schedules to operations of global transactions are
serializable, are referred to as Two-Level Serializable (2LSR) .
Let us look at an example to clarify. Consider a multidatabase with two databases,
DBMS1 and DBMS2. Let data items x,y and a,b be located at DBMS1 and DBMS2
respectively. The schedule below contains 2 local transactions L1 and L2 at DBMS1 that
execute operations w_L1(x) and r_L2(x),w_L2(y) respectively. The schedule also
contains a single local transaction L3 at DBMS2 which executes the operation W_L3(a) .
Furthermore, the schedule contains two global transactions: G1 that executes operations
r_G1(x) at DBMS1 and w_G1(a) at DBMS2, and G2 that executes operations w_G2(y) at
DBMS1 and w_G2(a), w_G2(b) at DBMS2.
DBMS1: r_G1(x) w_L1(x) r_L2(x) w_L2(y) w_G2(y)
DBMS2: w_G1(a) w_L3(a) w_G2(a) w_G2(b)
Notice that the schedule at DBMS1 and at DBMS2 are serializable. Likewise, the above
schedule projected to only operations of global transactions is also serializable. Thus, the
schedule is 2LSR.
In fact, in the above example, the overall schedule consisting of operations in both the
sites is serializable. While in the above example a 2LSR schedule is indeed also
serializable, this might not always be the case.
(a) Illustrate through an example a 2LSR schedule2 might not be conflict serializable.
HINT: you will need to identify a set of local transactions that order global
transactions in opposite order at different sites. (10 points)
1
A multidatabase is a federation of possibly pre-existing systems in which different component systems
act autonomously.
2
schedules where projection of operations to each local DBMS as well as projection of operations to those
that correspond to global transactions are serializable.
(b) Let us put a further restriction on the execution of global transactions and require
that the projection of the schedule to global transactions be serial – that is, global
transactions execute sequentially in the multidatabase with only one global
transaction being active at one time. Will such a restriction ensure that the
resulting schedule is serializable. If yes, provide intuitive argument. Else, show an
example non-serializable schedule that may still result. (20 points)
Q3: Time stamp ordering. (20 points)
Consider a database consisting of two data items x and y. Let us assume that we are
using a TO protocol with Thomas Write Rule for concurrency control and the read and
write time stamps of x and y are currently as follows:
x.read-timestamp = 10
x.write-timetamp = 12
y.read-timestamp = 32
y.write-timestamp = 20
Let us consider a transaction T1 with a timestamp 18 that requests an operation O. For
each of the choices of O, specify whether O will be permitted or not. And furthermore,
what will the resulting read and write timestamps of the data items x and y will be as a
result of the execution of O
Case 1: O = r_1(x)
Case 2: O = w_1(x)
Case 3: O = r_1(y)
Case 4: O = w_1(y)
(20 points)
Q0: Construct a view serializable schedule which is not conflict serializable.
Q0-1: Construct a conflict serializable schedule which cannot be generated by the 2PL
protocol.
Q0-2 Construct an ACA schedule which is not strict.
Q0-4: Explain what is the advantage of schedules being strict and not just ACA from the
perspective of recovery.
B-tree question for 20 points.
Paper question for 10 points.
Download