Management
n Crash recovery
• Log-based
• Shadow-paging
© Prof. Navneet Goyal, BITS, Pilani
Overview
n A Tx. Is defined as any one execution of a
user program
n Logical unit of DB processing, that includes
one or more DB operations (insert, delete,
update, or retrieval)
n These DB ops. Can be embedded within an
appl. program or can be specified via a high
level language like SQL
n A single appl. program may contain more
than one tx.
n A DB is a collection of named DI ( field,
record, relation)
© Prof. Navneet Goyal, BITS, Pilani
Overview
n Basic Operations on a DB
n Read
n Write
n read_item(X): Reads a database item
named X into a program variable. To
simplify our notation, we assume that the
program variable is also named X.
n write_item(X): Writes the value of program
variable X into the database item named X.
t1 Begin Tx 100
t5 W(balx) Commit 90
t6 Commit 90
t1 Begin Tx 100
t5 W(balx) Commit 90
t6 Commit 90
n Serializability
T7 T3
T6 T4
T5
CS
S2
S => CS
S1: w1(y); w1(x); w2(y); w2(x); w3(x)
S2: w1(y); w2(y); w2(x); w1(x);w3(x)
S1 is serial & S2 produces the same result as
S1, but S2 is not CS.
© Prof. Navneet Goyal, BITS, Pilani
Conflict Serializability
n Commercial systems check only for CS
n Any system using CS would have blocked S2
n Should S2 have been blocked?
n System should have checked that S2
produces the same outcome as serial
schedule S1 and should have allowed S2
n Computationally expensive to do so
n We need a less ‘stringent’ condition than CS!
n A condition that would allow some more
serialzable schedules than CS
n Ideally we should allow all serializabe
schedules
n Are we asking for too much?
© Prof. Navneet Goyal, BITS, Pilani
View Serializability
S
Blind
writes
CS VS
1 & 2 ensure that each tx. reads the same value in both
schedules and, therefore, performs the same
computation.
Condition 3, coupled with 1 & 2, ensures that both the
schedules result in the same final system state
© Prof. Navneet Goyal, BITS, Pilani
View Serializability
n A schedule S is view serializable it is view equivalent
to a serial schedule.
n Every conflict serializable schedule is also view
serializable.
n Below is a schedule which is view-serializable but not
conflict serializable.
Blind
writes
n Non-recoverable schedule
if T10 fails,
T11 and T12 must also be rolled back.
n Can lead to the undoing of a significant amount of work
transaction transaction
with smaller with larger
timestamp timestamp
A:= A+50
write (A)
display (A+B)
2PL TS
CS VS
IX ü ü × × ×
S ü × ü × ×
S IX ü × × × ×
X × × × × ×
Q&A
Thank You