SlideShare a Scribd company logo
1 of 130
prepared by Visakh V,Assistant Professor, 
LBSITW
A transaction is a unit of 
program execution that 
accesses and possibly 
updates various data items 
prepared by Visakh V,Assistant Professor, 
LBSITW
E.g. transaction to transfer $50 from 
account A to account B: 
1. read(A) 
2. A := A – 50 
3. write(A) 
4. read(B) 
5. B := B + 50 
6. write(B) 
prepared by Visakh V,Assistant Professor, 
LBSITW
Two main issues to deal with: 
Failures of various kinds, such 
as hardware failures and system 
crashes 
 Concurrent execution of 
multiple transactions 
prepared by Visakh V,Assistant Professor, 
LBSITW
A Atomicity 
C Consistency 
I Isolation 
D Durability 
To preserve the integrity of 
data the database system 
must ensure ACID properties 
prepared by Visakh V,Assistant Professor, 
LBSITW
Atomicity. Either all operations of the 
transaction are properly reflected in the 
database or none are. 
Consistency. Execution of a transaction in 
isolation preserves the consistency of the 
database. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Isolation. Although multiple transactions may 
execute concurrently, each transaction must be 
unaware of other concurrently executing transactions. 
Intermediate transaction results must be hidden from 
other concurrently executed transactions. 
That is, for every pair of transactions Ti and 
Tj, it appears to Ti that either Tj, finished 
execution before Ti started, or Tj started 
execution after Ti finished. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Durability. After a transaction completes 
successfully, the changes it has made to the 
database persist, even if there are system 
failures. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Example of Fund Transfer 
Transaction to transfer $50 from account A to account B: 
1. read(A) 
2. A := A – 50 
3. write(A) 
4. read(B) 
5. B := B + 50 
6. write(B) 
Atomicity requirement 
if the transaction fails after step 3 and before step 6, 
money will be “lost” leading to an inconsistent database 
state . 
Failure could be due to software or hardware 
the system should ensure that updates of a partially 
executed transaction prepared are by Visakh not V,Assistant Professor, 
LBSITW 
reflected in the database
Durability requirement — once the user has been notified 
that the transaction has completed (i.e., the transfer of the 
$50 has taken place), the updates to the database by the 
transaction must persist even if there are software or 
hardware failures. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Consistency requirement 
the sum of A and B is unchanged by the execution of 
the transaction 
In general, consistency requirements include 
Explicitly specified integrity constraints such as 
primary keys and foreign keys 
Implicit integrity constraints 
e.g. sum of balances of all accounts, minus sum of 
loan amounts must equal value of cash-in-hand 
A transaction must see a consistent database. 
During transaction execution the database may be 
temporarily inconsistent. 
When the transaction completes successfully the 
database must be consistent 
Erroneous transaction logic can lead to inconsistency prepared by Visakh V,Assistant Professor, 
LBSITW
• Isolation requirement — if between steps 3 and 6, another 
transaction T2 is allowed to access the partially updated 
database, it will see an inconsistent database (the sum A + B will 
be less than it should be). 
T1 T2 
1. read(A) 
2. A := A – 50 
3. write(A) 
read(A), read(B), print(A+B) 
4. read(B) 
5. B := B + 50 
6. write(B 
• Isolation can be ensured trivially by running transactions serially 
– that is, one after the other. 
• However, executing multiple transactions concurrently has 
significant benefits, as we will see later. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Transaction State 
TRANSACTION STATES 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
• Active – the initial state; the transaction stays in this 
state while it is executing 
• Partially committed – after the final statement has 
been executed. 
• Failed -- after the discovery that normal execution can 
no longer proceed. 
• Aborted – after the transaction has been rolled back 
and the database restored to its state prior to the start 
of the transaction. Two options after it has been 
aborted: 
– restart the transaction 
• can be done only if no internal logical error 
– kill the transaction 
• Committed – after successful completion. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Concurrent Executions 
• Multiple transactions are allowed to run 
concurrently in the system. Advantages are: 
increased processor and disk utilization, leading to better 
transaction throughput 
E.g. one transaction can be using the CPU while another is 
reading from or writing to the disk 
reduced average response time for transactions: short 
transactions need not wait behind long ones. 
• Concurrency control schemes – mechanisms to 
achieve isolation 
 that is, to control the interaction among the concurrent 
transactions in order to prevent them from destroying the 
consistency of the database 
prepared by Visakh V,Assistant Professor, 
LBSITW
Schedules 
• Schedule – a sequences of instructions that specify the order 
in which instructions of concurrent transactions are executed 
– a schedule for a set of transactions must consist of all instructions 
of those transactions 
– must preserve the order in which the instructions appear in each 
individual transaction. 
• A transaction that successfully completes its execution will 
have a commit instructions as the last statement 
– by default transaction assumed to execute commit instruction as 
its last step 
• A transaction that fails to successfully complete its execution 
will have an abort instruction as the last statement 
prepared by Visakh V,Assistant Professor, 
LBSITW
Schedule 1 
• Let T1 transfer $50 from A to B, and T2 transfer 10% of 
the balance from A to B. 
• A serial schedule in which T1 is followed by T2 : 
prepared by Visakh V,Assistant Professor, 
LBSITW
Schedule 2 
• A serial schedule where T2 is followed by T1 
prepared by Visakh V,Assistant Professor, 
LBSITW
Schedule 3 
• Let T1 and T2 be the transactions defined previously. 
The following schedule is not a serial schedule, but it is 
equivalent to Schedule 1. 
Concurrent 
schedule  
In Schedules 1, 2 
and 3, 
the sum A + B is 
preserved. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Schedule 4 
• The following concurrent schedule does not 
preserve the value of (A + B ). 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
This problem occurred because two 
transactions are working on the same 
resource without knowing each other’s 
activity 
prepared by Visakh V,Assistant Professor, 
LBSITW
• : transaction reads values written 
by another transaction that hasn’t 
committed yet. 
•This problem has occurred because 
two transactions are working on the 
same resource without knowing 
each other’s activity 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
•Newly inserted rows appear as phantom to the 
transaction 
• A transaction re-executes a query returning a set of 
rows that satisfy a search condition and finds that 
the set of rows satisfying the condition has changed 
as a result of another recently committed transaction 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
It is the process of finding 
concurrent schedule equivalent to 
serial schedule prepared by Visakh V,Assistant Professor, 
LBSITW
•Transactions are programs. 
•Here we consider only two operations 
READ and WRITE 
prepared by Visakh V,Assistant Professor, 
LBSITW
Two forms 
prepared by Visakh V,Assistant Professor, 
LBSITW
i1,i2 : two consecutive 
instructions of different 
transactions 
prepared by Visakh V,Assistant Professor, 
LBSITW
1. l 
4 cases we need to 
consider 
= read(Q), l 
i 
j 
= read(Q). l 
i 
and l 
j 
don’t 
conflict. 
2. l 
i 
= read(Q), l 
j 
= write(Q). They conflict. 
3. l 
i 
= write(Q), l 
j 
= read(Q). They conflict 
4. l 
i 
= write(Q), l 
j 
= write(Q). They conflict 
prepared by Visakh V,Assistant Professor, 
LBSITW
Series of swaps of non 
conflict instruction 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
If S is Conflict 
equivalent to a serial 
schedule(prepared by Visakh V,Assistant Professor, 
LBSITW 
here S’)
prepared by Visakh V,Assistant Professor, 
LBSITW
•It is possible to have two schedules that 
produce the same outcome ,but that are 
not conflict equivalent 
prepared by Visakh V,Assistant Professor, 
LBSITW
•It is not conflict equivalent to its serial schedule(but 
this schedule move db to a consistent state) 
prepared by Visakh V,Assistant Professor, 
LBSITW
•So we must consider computation 
performed by transactions rather 
than just read and write operations. 
•But it is hard to implement 
and it is computationally 
expensive . 
prepared by Visakh V,Assistant Professor, 
LBSITW
•Another schedule equivalence purely based on read 
and write operations 
•If schedule s1 and s2 are said to be view equivalent 
if three conditions are met. 
prepared by Visakh V,Assistant Professor, 
LBSITW
1. If Ti reads the initial value of object A in s1,it must 
also read the initial value of A in s2. 
2. If Ti read a value of A written by Tj in s1,it must also 
read the value of A written by Tj in s2. 
3. For each data object A , the transaction (if any)that 
performs the final write on A in s1 must also perform 
the final write on A in s2. 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
If S is view equivalent 
to a serial 
schedule(prepared by Visakh V,Assistant Professor, 
LBSITW 
here S’)
Ex: for view serializable schedule 
It is view equivalent to its serial 
schedule 
prepared by Visakh V,Assistant Professor, 
LBSITW
What is the view equivalent serial schedule 
for this ????? prepared by Visakh V,Assistant Professor, 
LBSITW
The below example is view serializable but not conflict 
serializable!!! 
prepared by Visakh V,Assistant Professor, 
LBSITW
•Every conflict serializable schedule is 
also view serializable, but reverse need 
not be true. 
•If blind write appear in any view 
serializable schedule that is not conflict 
serializable. 
•Blind write :- transaction performing 
write without a read operation 
prepared by Visakh V,Assistant Professor, 
LBSITW
If transaction fails we need to undo the effect of this 
transaction to ensure the atomicity property 
(a)Recoverable schedule 
(b) Cascadeless schedule 
prepared by Visakh V,Assistant Professor, 
LBSITW
(a)Recoverable schedule 
Consider the example for non recoverable schedule: 
Recoverable schedule : for each pair of transaction Ti 
and Tj such that Tj reads a data item previously written 
by Ti ,the commit operation of Ti appears before the 
commit operation of prepared Tj by. Visakh V,Assistant Professor, 
LBSITW
(a)cascadeless schedule 
Ex: for cascading schedule 
Cascading Rollback: a single transaction 
failure leads to a series of transaction 
prepared rollbacks by Visakh V,Assistant Professor, 
LBSITW
Every cascadeless schedule is also 
recoverable 
prepared by Visakh V,Assistant Professor, 
LBSITW
• Isolation property may no long be preserved. 
• so we need Concurrency control scheme 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
lock is a mechanism to control 
concurrent access to a data 
item 
Grants the lock to the 
transaction 
prepared by Visakh V,Assistant Professor, 
LBSITW
Data item can be locked in two modes 
read 
write 
read 
write prepared by Visakh V,Assistant Professor, 
LBSITW
X-lock is requested using 
lock-X instruction. 
S-lock is requested using 
lock-S instruction. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Lock –compatibility matrix 
Compatible?? 
prepared by Visakh V,Assistant Professor, 
LBSITW
Ex: for performing locking 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
If a lock cannot be granted, the 
requesting transaction is made 
to wait till all incompatible locks 
held by other transactions have 
been released. The lock is then 
granted 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
Necessary condition for deadlock 
A state where neither of 
the transaction can 
proceed with its normal 
execution 
prepared by Visakh V,Assistant Professor, 
LBSITW
Consider the example for deadlock: 
prepared by Visakh V,Assistant Professor, 
LBSITW
Starvation : If a transaction T never 
make a progress , then is said to be 
starved. 
prepared by Visakh V,Assistant Professor, 
LBSITW
When a transaction Ti request a lock 
on a data item Q in a particular mode M 
We can avoid starvation by: 
•There is no other transaction holding a 
lock on Q in a mode that conflicts with M 
•There is no other transaction that is 
waiting for a lock on Q and that made its 
lock request before Ti 
prepared by Visakh V,Assistant Professor, 
LBSITW
•Set of rules 
• each transaction in the 
system follow this rule 
• it is for ,when a 
transaction may lock or 
unlock each of its data 
items. 
•It restricts the number 
possible schedules 
prepared by Visakh V,Assistant Professor, 
LBSITW
A schedule s is legal under a given 
locking protocol ,if s possible 
schedule for a set of transaction 
that follows the rules of the locking 
protocol 
prepared by Visakh V,Assistant Professor, 
LBSITW
A locking protocol ensures conflict 
serializability if and only if all legal 
schedules are conflict serializable. 
prepared by Visakh V,Assistant Professor, 
LBSITW
This is a protocol which ensures conflict 
serializable schedules. 
•Phase 1: Growing Phase 
•transaction may obtain locks 
•transaction may not release locks 
•Phase 2: Shrinking Phase 
•transaction may release 
locks 
•transaction may not obtain 
prepared by Visakh lVo,Ascsisktanst Professor, 
LBSITW
•Initially a transaction is in the 
growing phase .The transaction 
acquires locks as needed. 
•Once the transaction releases a 
lock ,it enters the shrinking phase 
and it can issue no more lock 
requests. 
•Unlock instruction do not need to 
appear at the end of the 
transaction. prepared by Visakh V,Assistant Professor, 
LBSITW
T1: lock-S(A); 
read (A); 
unlock(A); 
lock-S(B); 
read (B); 
unlock(B); 
display(A+B); 
T1: lock-s(A); 
read (A); 
lock-S(B); 
read (B); 
unlock(B); 
unlock(B); 
display(A+B); 
prepared by Visakh V,Assistant Professor, 
LBSITW
The point in the schedule where 
the transaction has obtained its 
final lock(the end of growing 
phase). 
•Two-phase locking does not ensure 
freedom from deadlocks 
prepared by Visakh V,Assistant Professor, 
LBSITW
•cascading rollback may occur under two 
phase locking 
prepared by Visakh V,Assistant Professor, 
LBSITW
•(a)Strict two phase locking 
(avoiding cascading rollback ) 
•(b)rigorous two phase locking 
prepared by Visakh V,Assistant Professor, 
LBSITW
Locking be in two phase + all exclusive mode 
locks of a transaction 
held until the 
transaction commit 
Locking be in two phase + all locks of a 
transaction held until 
the transaction commit prepared by Visakh V,Assistant Professor, 
LBSITW
T1: read(A1); 
read(A2); 
. . . . 
read(An); 
Write(A1) 
T2: read(A1); 
read(A2); 
.display(A1+A2); 
prepared by Visakh V,Assistant Professor, 
LBSITW
Two-phase locking with lock conversions: 
– First Phase: 
•can acquire a lock-S on item 
•can acquire a lock-X on item 
•can convert a lock-S to a lock-X (upgrade) 
– Second Phase: 
•can release a lock-S 
•can release a lock-X 
•can convert a lock-X to a lock-S (downgrade) 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
•Another method for finding the serializability 
order 
• The protocol manages concurrent execution 
such that the time-stamps determine the 
serializability 
• A time stamp is assigned by the database 
system before the transaction starts 
execution. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Assume transactions comes 
in the order T1.T2,T3 
•If an old transaction Ti has time-stamp TS(Ti), 
a new transaction Tj is assigned time-stamp 
TS(Tj) such that TS(Ti) <TS(Tj). 
prepared by Visakh V,Assistant Professor, 
LBSITW
For implementing this we use two simple methods 
• Use the value of the system clock. 
OR 
•Use a logical counter. 
prepared by Visakh V,Assistant Professor, 
LBSITW
The time-stamps determine the serializability 
order , i.e. ensure that Ti appears before Tj. 
maintains for each data Q two timestamp values: 
. 
is the largest time-stamp of any transaction that 
executed write(Q) successfully. 
is the largest time-stamp of any transaction that 
executed read(Q) successfully 
prepared by Visakh V,Assistant Professor, 
LBSITW
•The timestamp ordering protocol ensures that any 
conflicting read and write operations are executed in 
timestamp order 
•The protocol operates as follows. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Suppose a transaction Ti issues a read(Q) 
1. If TS(Ti)  W-timestamp(Q), then Ti needs to read a 
value of Q that was already overwritten. 
 Hence, the read operation is rejected, and Ti is 
rolled back. 
2. If TS(Ti)W-timestamp(Q), then the read operation 
is executed, and R-timestamp(Q) is set to max(R-timestamp( 
Q), TS(Ti)). 
prepared by Visakh V,Assistant Professor, 
LBSITW
Read rejected 
Read rejected 
Read accepted 
READ(B) 
prepared by Visakh V,Assistant Professor, 
LBSITW
Suppose a transaction Ti issues a write(Q) 
1. If TS(Ti) < R-timestamp(Q), then the value of Q that Ti is 
producing was needed previously, and the system assumed 
that that value would never be produced. 
 Hence, the write operation is rejected, and Ti is rolled 
back. 
2. If TS(Ti) < W-timestamp(Q), then Ti is attempting to write 
an obsolete value of Q. 
 Hence, this write operation is rejected, and Ti is rolled 
back. 
3. Otherwise, the write operation is executed, and W-timestamp( 
Q) is spreeptar etdo by TVisSak(hT V,iA)s.sistant Professor, 
LBSITW
WRITE(B) 
write accepted 
write rejected 
write rejected 
prepared by Visakh V,Assistant Professor, 
LBSITW 
wite rejected
A schedule that is possible under the time stamp protocol 
assume TS(T25) < TS (T26) 
prepared by Visakh V,Assistant Professor, 
LBSITW
•ensures 
freedom 
from deadlock 
•may not 
cascade-free 
•may not 
recoverable. 
prepared by Visakh V,Assistant Professor, 
LBSITW
• Problem with timestamp-ordering protocol: 
• Suppose Ti aborts, but Tj has read a data item 
written by Ti , then Tj must abort; if Tj had been 
allowed to commit earlier, the schedule is not 
recoverable. 
• Further, any transaction that has read a data 
item written by Tj must abort this can lead to 
cascading rollback --- that is, a chain of 
rollbacks 
prepared by Visakh V,Assistant Professor, 
LBSITW
• Solution 1: 
• A transaction is structured such that its writes are all 
performed at the end of its processing 
• All writes of a transaction form an atomic action; no 
transaction may execute while a transaction is being 
written 
• A transaction that aborts is restarted with a new 
timestamp 
• Solution 2: Limited form of locking: wait for data to be 
committed before reading it 
• Solution 3: Use commit dependencies to ensure 
recoverability prepared by Visakh V,Assistant Professor, 
LBSITW
Consider the example Example : 
Don’t worry, We 
have a soloution 
THOMAS WRITE 
RULE 
prepared by Visakh V,Assistant Professor, 
LBSITW
• Modified version of the timestamp-ordering protocol 
in which obsolete write operations may be ignored 
under certain circumstances. 
• When Ti attempts to write data item Q, if TS(Ti) < W-timestamp( 
Q), then Ti is attempting to write an 
obsolete value of {Q}. 
– Rather than rolling back Ti as the timestamp 
ordering protocol would have done, this {write} 
operation can be ignored. 
prepared by Visakh V,Assistant Professor, 
LBSITW
• Otherwise this protocol is the same as the timestamp 
ordering protocol. 
• Thomas' Write Rule allows greater potential concurrency. 
– Allows some view-serializable schedules that are not 
conflict-serializable 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
Types of failure 
1. Transaction failure 
•Logical error 
• System error 
: (due to internal 
condition) bad input, data 
not found, resource limit 
exceed. 
:entered an undesirable 
state (ex:deadlock) 
prepared by Visakh V,Assistant Professor, 
LBSITW
2. System crash 
: h/w malfunction , or a bug in the database 
s/w or OS 
: loss of content in volatile 
3. Disk failure 
: head crash or failure during data 
transfer operation. 
prepared by Visakh V,Assistant Professor, 
LBSITW
•Volatile storage: 
•does not survive system crashes 
•examples: main memory, cache memory 
•Nonvolatile storage: 
•survives system crashes 
•examples: disk, tape, flash memory, 
non-volatile (battery backed up) RAM 
•but may still fail, losing data 
•Stable storage: 
•a mythical form of storage that survives all failures 
•approximated by maintaining multiple copies on 
distinct nonvolatile pmrepaeredd byi Vaisakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
Blocks : Fixed length storage units 
Physical blocks are those blocks residing on the disk. 
Buffer blocks are the blocks residing temporarily in main 
memory. 
Block movements between disk and main memory are initiated 
through the following two operations: 
input(B) transfers the physical block B to main memory. 
output(B) transfers the buffer block B to the disk, and 
replaces the appropriate physical block there. 
prepared by Visakh V,Assistant Professor, 
LBSITW
Example of Data Access 
X 
Y 
A 
B 
x1 
y1 
buffer 
Buffer Block A 
Buffer Block B 
input(A) 
output(B) 
read(X) 
write(Y) 
disk 
work area 
of T1 
x2 
work area 
of T2 
memory 
prepared by Visakh V,Assistant Professor, 
LBSITW
• Each transaction Ti has its private work-area in which local copies 
of all data items accessed and updated by it are kept. 
– Ti's local copy of a data item X is called xi. 
• Transferring data items between system buffer blocks and its 
private work-area done by: 
– read(X) assigns the value of data item X to the local variable xi. 
– write(X) assigns the value of local variable xi to data item {X} in 
the buffer block. 
– Note: output(BX) need not immediately follow write(X). System 
can perform the output operation when it deems fit. 
• Transactions 
– Must perform read(X) before accessing X for the first time 
(subsequent reads can be from local copy) 
– write(X) can be executed at any time before the transaction 
commits prepared by Visakh V,Assistant Professor, 
LBSITW
Transaction Log 
• also know as journal log / redo-log 
• It is a physical file 
• It usually contain 
• transaction identifier 
• data –item identifier(or time stamp) 
• old value 
• new value 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
We denote various type of log record as 
1.<Ti start> : transaction Ti starts 
2. <Ti, X, V1, V2> : Before Ti executes write(X) 
3.<Ti commit> : Ti finishes it last statement 
4. <Ti abort> 
prepared by Visakh V,Assistant Professor, 
LBSITW
<T0 start> 
<T0, A, 1000, 950> 
<To, B, 2000, 2050> 
<T0 commit> 
<T1 start> 
<T1, C, 700, 600> 
<T1 commit> 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
•Also known as NO UNDO/REDO 
• Algorithm to support O/S, application, power, 
memory and machine failures 
• During transaction run changes recorded only in the 
log files not in database 
• On commit changes made from 
Log  database 
• this process is called “Re-doing”(redo(Ti)),sometimes 
known as ROLLFORWARD. 
• on rollback ,just discard the log files 
• on commit, just copy the log files to database prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
•Disadvantage 
•Increased time of recovery in case of 
system failure. 
prepared by Visakh V,Assistant Professor, 
LBSITW
•Also known as UNDO/REDO 
• Algorithm to support O/S, 
application, power, memory and 
machine failures 
•Transaction updates/alternation 
prepared by Visakh V,Assistant Professor, 
LBSITW
•On commit all the changes to the db are made 
permanent and log files discarded 
• On rollback , using the log entries old values are 
restored. All the changes in the database are discarded. 
•This process is called un-doing(undo(Ti)). 
• original values are restored using the log files for 
uncommitted transaction. 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
Log Write Output 
<T0 start> 
<T0, A, 1000, 950> 
<To, B, 2000, 2050 
A = 950 
B = 2050 
<T0 commit> 
<T1 start> 
<T1, C, 700, 600> 
C = 600 
BB , BC 
<T1 commit> 
BA 
• Note: BX denotes block containing X. 
BC output before T1 
commits 
BA output after T0 
commits 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
• The process of undoing changes using log files is 
frequently referred to as rollback 
•Disadvantage 
•Frequent I/O operations while the 
transaction Is active . 
prepared by Visakh V,Assistant Professor, 
LBSITW
•Commercial RDMS is neither deferred nor immediate 
• Database updated at fixed interval of time 
•Irrespective of transaction commit/un-commit state. 
•Check pointing : updating transaction at fixed intervals of 
time is called check-pointing. 
• @ check point time log files changes applied to the 
database. 
• 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
• During recovery we need to consider only the most recent 
transaction Ti that started before the checkpoint, and 
transactions that started after Ti. 
1. Scan backwards from end of log to find the most recent 
<checkpoint L> record 
– Only transactions that are in L or started after the 
checkpoint need to be redone or undone 
– Transactions that committed or aborted before the 
checkpoint already have all their updates output to stable 
storage. 
• Some earlier part of the log may be needed for undo 
operations 
1. Continue scanning backwards till a record <Ti start> is 
found for every transaction Ti in L. 
– Parts of log prior to earliest <Ti start> record above are not 
needed for recovery, and can be erased whenever desired. 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW
•Alternative to log-based crash-recovery techniques. 
•Advantage: require few disk access than log-based. 
• pages : fixed length portioned block in database. 
• page table : 
•The page table has n entries—one for each 
database page. 
•Each entry contains a pointer to a page on 
disk . 
prepared by Visakh V,Assistant Professor, 
LBSITW
prepared by Visakh V,Assistant Professor, 
LBSITW

More Related Content

What's hot

Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniquespusp220
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMSkoolkampus
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database SystemMeghaj Mallick
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbmsNancy Gulati
 
Locking base concurrency control
  Locking base concurrency control  Locking base concurrency control
Locking base concurrency controlPrakash Poudel
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlocksangrampatil81
 
Fragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseFragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseAbhilasha Lahigude
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management SystemJanki Shah
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architecturesPooja Dixit
 
trees in data structure
trees in data structure trees in data structure
trees in data structure shameen khan
 
Database , 8 Query Optimization
Database , 8 Query OptimizationDatabase , 8 Query Optimization
Database , 8 Query OptimizationAli Usman
 

What's hot (20)

Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniques
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
 
Fp growth
Fp growthFp growth
Fp growth
 
Distributed DBMS - Unit 6 - Query Processing
Distributed DBMS - Unit 6 - Query ProcessingDistributed DBMS - Unit 6 - Query Processing
Distributed DBMS - Unit 6 - Query Processing
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database System
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
 
Locking base concurrency control
  Locking base concurrency control  Locking base concurrency control
Locking base concurrency control
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
Binary tree
Binary treeBinary tree
Binary tree
 
Chapter18
Chapter18Chapter18
Chapter18
 
Serializability
SerializabilitySerializability
Serializability
 
Hashing
HashingHashing
Hashing
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlock
 
Fragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseFragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed Database
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architectures
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
Database , 8 Query Optimization
Database , 8 Query OptimizationDatabase , 8 Query Optimization
Database , 8 Query Optimization
 

Similar to Transaction Management

Data base recovery
Data base recoveryData base recovery
Data base recoveryVisakh V
 
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERYTRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERYRohit Kumar
 
Dartabase Transaction.pptx
Dartabase Transaction.pptxDartabase Transaction.pptx
Dartabase Transaction.pptxBibus Poudel
 
Concepts of Data Base Management Systems
Concepts of Data Base Management SystemsConcepts of Data Base Management Systems
Concepts of Data Base Management SystemsDinesh Devireddy
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryAjit Nayak
 
UNIT 2- TRANSACTION CONCEPTS AND CONCURRENCY CONCEPTS (1).pdf
UNIT 2- TRANSACTION CONCEPTS AND CONCURRENCY CONCEPTS (1).pdfUNIT 2- TRANSACTION CONCEPTS AND CONCURRENCY CONCEPTS (1).pdf
UNIT 2- TRANSACTION CONCEPTS AND CONCURRENCY CONCEPTS (1).pdfKavitaShinde26
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...DrCViji
 
7. transaction mang
7. transaction mang7. transaction mang
7. transaction mangkhoahuy82
 
DBMS Unit III Material
DBMS Unit III MaterialDBMS Unit III Material
DBMS Unit III MaterialArthyR3
 
Distributed Database Design and Relational Query Language
Distributed Database Design and Relational Query LanguageDistributed Database Design and Relational Query Language
Distributed Database Design and Relational Query LanguageAAKANKSHA JAIN
 
Database management system chapter15
Database management system chapter15Database management system chapter15
Database management system chapter15Md. Mahedi Mahfuj
 

Similar to Transaction Management (20)

Data base recovery
Data base recoveryData base recovery
Data base recovery
 
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERYTRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
TRANSACTION MANAGEMENT AND TIME STAMP PROTOCOLS AND BACKUP RECOVERY
 
Dartabase Transaction.pptx
Dartabase Transaction.pptxDartabase Transaction.pptx
Dartabase Transaction.pptx
 
Concepts of Data Base Management Systems
Concepts of Data Base Management SystemsConcepts of Data Base Management Systems
Concepts of Data Base Management Systems
 
Unit 06 dbms
Unit 06 dbmsUnit 06 dbms
Unit 06 dbms
 
Unit06 dbms
Unit06 dbmsUnit06 dbms
Unit06 dbms
 
Ch15
Ch15Ch15
Ch15
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and Recovery
 
Transaction processing
Transaction processingTransaction processing
Transaction processing
 
UNIT 2- TRANSACTION CONCEPTS AND CONCURRENCY CONCEPTS (1).pdf
UNIT 2- TRANSACTION CONCEPTS AND CONCURRENCY CONCEPTS (1).pdfUNIT 2- TRANSACTION CONCEPTS AND CONCURRENCY CONCEPTS (1).pdf
UNIT 2- TRANSACTION CONCEPTS AND CONCURRENCY CONCEPTS (1).pdf
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
 
DBMS 10 | Database Transactions
DBMS 10 | Database TransactionsDBMS 10 | Database Transactions
DBMS 10 | Database Transactions
 
7. transaction mang
7. transaction mang7. transaction mang
7. transaction mang
 
Join dependency
Join dependencyJoin dependency
Join dependency
 
DBMS Unit III Material
DBMS Unit III MaterialDBMS Unit III Material
DBMS Unit III Material
 
Distributed Database Design and Relational Query Language
Distributed Database Design and Relational Query LanguageDistributed Database Design and Relational Query Language
Distributed Database Design and Relational Query Language
 
unit06-dbms-new.ppt
unit06-dbms-new.pptunit06-dbms-new.ppt
unit06-dbms-new.ppt
 
Ch15
Ch15Ch15
Ch15
 
Database management system chapter15
Database management system chapter15Database management system chapter15
Database management system chapter15
 
Cs501 transaction
Cs501 transactionCs501 transaction
Cs501 transaction
 

More from Visakh V

Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalizationVisakh V
 
Relational algebra complete
Relational algebra completeRelational algebra complete
Relational algebra completeVisakh V
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms usersVisakh V
 
Memory Management
Memory ManagementMemory Management
Memory ManagementVisakh V
 
Slide 5 keys
Slide 5 keysSlide 5 keys
Slide 5 keysVisakh V
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms usersVisakh V
 
Slide 6 er strong & weak entity
Slide 6 er  strong & weak entitySlide 6 er  strong & weak entity
Slide 6 er strong & weak entityVisakh V
 
Slide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaSlide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaVisakh V
 
Slide 2 data models
Slide 2 data modelsSlide 2 data models
Slide 2 data modelsVisakh V
 
Slide 1 introduction to dbms
Slide 1 introduction to dbmsSlide 1 introduction to dbms
Slide 1 introduction to dbmsVisakh V
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancyVisakh V
 
Relational algebr
Relational algebrRelational algebr
Relational algebrVisakh V
 
data constraints,group by
data constraints,group by data constraints,group by
data constraints,group by Visakh V
 

More from Visakh V (14)

Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
Relational algebra complete
Relational algebra completeRelational algebra complete
Relational algebra complete
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms users
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Slide 5 keys
Slide 5 keysSlide 5 keys
Slide 5 keys
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms users
 
Slide 6 er strong & weak entity
Slide 6 er  strong & weak entitySlide 6 er  strong & weak entity
Slide 6 er strong & weak entity
 
Slide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaSlide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schema
 
Slide 2 data models
Slide 2 data modelsSlide 2 data models
Slide 2 data models
 
Slide 1 introduction to dbms
Slide 1 introduction to dbmsSlide 1 introduction to dbms
Slide 1 introduction to dbms
 
Data
DataData
Data
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancy
 
Relational algebr
Relational algebrRelational algebr
Relational algebr
 
data constraints,group by
data constraints,group by data constraints,group by
data constraints,group by
 

Recently uploaded

National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Steel Structures - Building technology.pptx
Steel Structures - Building technology.pptxSteel Structures - Building technology.pptx
Steel Structures - Building technology.pptxNikhil Raut
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...Amil Baba Dawood bangali
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadaditya806802
 

Recently uploaded (20)

National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Steel Structures - Building technology.pptx
Steel Structures - Building technology.pptxSteel Structures - Building technology.pptx
Steel Structures - Building technology.pptx
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasad
 

Transaction Management

  • 1. prepared by Visakh V,Assistant Professor, LBSITW
  • 2. A transaction is a unit of program execution that accesses and possibly updates various data items prepared by Visakh V,Assistant Professor, LBSITW
  • 3. E.g. transaction to transfer $50 from account A to account B: 1. read(A) 2. A := A – 50 3. write(A) 4. read(B) 5. B := B + 50 6. write(B) prepared by Visakh V,Assistant Professor, LBSITW
  • 4. Two main issues to deal with: Failures of various kinds, such as hardware failures and system crashes  Concurrent execution of multiple transactions prepared by Visakh V,Assistant Professor, LBSITW
  • 5. A Atomicity C Consistency I Isolation D Durability To preserve the integrity of data the database system must ensure ACID properties prepared by Visakh V,Assistant Professor, LBSITW
  • 6. Atomicity. Either all operations of the transaction are properly reflected in the database or none are. Consistency. Execution of a transaction in isolation preserves the consistency of the database. prepared by Visakh V,Assistant Professor, LBSITW
  • 7. Isolation. Although multiple transactions may execute concurrently, each transaction must be unaware of other concurrently executing transactions. Intermediate transaction results must be hidden from other concurrently executed transactions. That is, for every pair of transactions Ti and Tj, it appears to Ti that either Tj, finished execution before Ti started, or Tj started execution after Ti finished. prepared by Visakh V,Assistant Professor, LBSITW
  • 8. Durability. After a transaction completes successfully, the changes it has made to the database persist, even if there are system failures. prepared by Visakh V,Assistant Professor, LBSITW
  • 9. Example of Fund Transfer Transaction to transfer $50 from account A to account B: 1. read(A) 2. A := A – 50 3. write(A) 4. read(B) 5. B := B + 50 6. write(B) Atomicity requirement if the transaction fails after step 3 and before step 6, money will be “lost” leading to an inconsistent database state . Failure could be due to software or hardware the system should ensure that updates of a partially executed transaction prepared are by Visakh not V,Assistant Professor, LBSITW reflected in the database
  • 10. Durability requirement — once the user has been notified that the transaction has completed (i.e., the transfer of the $50 has taken place), the updates to the database by the transaction must persist even if there are software or hardware failures. prepared by Visakh V,Assistant Professor, LBSITW
  • 11. Consistency requirement the sum of A and B is unchanged by the execution of the transaction In general, consistency requirements include Explicitly specified integrity constraints such as primary keys and foreign keys Implicit integrity constraints e.g. sum of balances of all accounts, minus sum of loan amounts must equal value of cash-in-hand A transaction must see a consistent database. During transaction execution the database may be temporarily inconsistent. When the transaction completes successfully the database must be consistent Erroneous transaction logic can lead to inconsistency prepared by Visakh V,Assistant Professor, LBSITW
  • 12. • Isolation requirement — if between steps 3 and 6, another transaction T2 is allowed to access the partially updated database, it will see an inconsistent database (the sum A + B will be less than it should be). T1 T2 1. read(A) 2. A := A – 50 3. write(A) read(A), read(B), print(A+B) 4. read(B) 5. B := B + 50 6. write(B • Isolation can be ensured trivially by running transactions serially – that is, one after the other. • However, executing multiple transactions concurrently has significant benefits, as we will see later. prepared by Visakh V,Assistant Professor, LBSITW
  • 13. Transaction State TRANSACTION STATES prepared by Visakh V,Assistant Professor, LBSITW
  • 14. prepared by Visakh V,Assistant Professor, LBSITW
  • 15. • Active – the initial state; the transaction stays in this state while it is executing • Partially committed – after the final statement has been executed. • Failed -- after the discovery that normal execution can no longer proceed. • Aborted – after the transaction has been rolled back and the database restored to its state prior to the start of the transaction. Two options after it has been aborted: – restart the transaction • can be done only if no internal logical error – kill the transaction • Committed – after successful completion. prepared by Visakh V,Assistant Professor, LBSITW
  • 16. Concurrent Executions • Multiple transactions are allowed to run concurrently in the system. Advantages are: increased processor and disk utilization, leading to better transaction throughput E.g. one transaction can be using the CPU while another is reading from or writing to the disk reduced average response time for transactions: short transactions need not wait behind long ones. • Concurrency control schemes – mechanisms to achieve isolation  that is, to control the interaction among the concurrent transactions in order to prevent them from destroying the consistency of the database prepared by Visakh V,Assistant Professor, LBSITW
  • 17. Schedules • Schedule – a sequences of instructions that specify the order in which instructions of concurrent transactions are executed – a schedule for a set of transactions must consist of all instructions of those transactions – must preserve the order in which the instructions appear in each individual transaction. • A transaction that successfully completes its execution will have a commit instructions as the last statement – by default transaction assumed to execute commit instruction as its last step • A transaction that fails to successfully complete its execution will have an abort instruction as the last statement prepared by Visakh V,Assistant Professor, LBSITW
  • 18. Schedule 1 • Let T1 transfer $50 from A to B, and T2 transfer 10% of the balance from A to B. • A serial schedule in which T1 is followed by T2 : prepared by Visakh V,Assistant Professor, LBSITW
  • 19. Schedule 2 • A serial schedule where T2 is followed by T1 prepared by Visakh V,Assistant Professor, LBSITW
  • 20. Schedule 3 • Let T1 and T2 be the transactions defined previously. The following schedule is not a serial schedule, but it is equivalent to Schedule 1. Concurrent schedule  In Schedules 1, 2 and 3, the sum A + B is preserved. prepared by Visakh V,Assistant Professor, LBSITW
  • 21. Schedule 4 • The following concurrent schedule does not preserve the value of (A + B ). prepared by Visakh V,Assistant Professor, LBSITW
  • 22. prepared by Visakh V,Assistant Professor, LBSITW
  • 23. This problem occurred because two transactions are working on the same resource without knowing each other’s activity prepared by Visakh V,Assistant Professor, LBSITW
  • 24. • : transaction reads values written by another transaction that hasn’t committed yet. •This problem has occurred because two transactions are working on the same resource without knowing each other’s activity prepared by Visakh V,Assistant Professor, LBSITW
  • 25. prepared by Visakh V,Assistant Professor, LBSITW
  • 26. •Newly inserted rows appear as phantom to the transaction • A transaction re-executes a query returning a set of rows that satisfy a search condition and finds that the set of rows satisfying the condition has changed as a result of another recently committed transaction prepared by Visakh V,Assistant Professor, LBSITW
  • 27. prepared by Visakh V,Assistant Professor, LBSITW
  • 28. It is the process of finding concurrent schedule equivalent to serial schedule prepared by Visakh V,Assistant Professor, LBSITW
  • 29. •Transactions are programs. •Here we consider only two operations READ and WRITE prepared by Visakh V,Assistant Professor, LBSITW
  • 30. Two forms prepared by Visakh V,Assistant Professor, LBSITW
  • 31. i1,i2 : two consecutive instructions of different transactions prepared by Visakh V,Assistant Professor, LBSITW
  • 32. 1. l 4 cases we need to consider = read(Q), l i j = read(Q). l i and l j don’t conflict. 2. l i = read(Q), l j = write(Q). They conflict. 3. l i = write(Q), l j = read(Q). They conflict 4. l i = write(Q), l j = write(Q). They conflict prepared by Visakh V,Assistant Professor, LBSITW
  • 33. Series of swaps of non conflict instruction prepared by Visakh V,Assistant Professor, LBSITW
  • 34. prepared by Visakh V,Assistant Professor, LBSITW
  • 35. prepared by Visakh V,Assistant Professor, LBSITW
  • 36. If S is Conflict equivalent to a serial schedule(prepared by Visakh V,Assistant Professor, LBSITW here S’)
  • 37. prepared by Visakh V,Assistant Professor, LBSITW
  • 38. •It is possible to have two schedules that produce the same outcome ,but that are not conflict equivalent prepared by Visakh V,Assistant Professor, LBSITW
  • 39. •It is not conflict equivalent to its serial schedule(but this schedule move db to a consistent state) prepared by Visakh V,Assistant Professor, LBSITW
  • 40. •So we must consider computation performed by transactions rather than just read and write operations. •But it is hard to implement and it is computationally expensive . prepared by Visakh V,Assistant Professor, LBSITW
  • 41. •Another schedule equivalence purely based on read and write operations •If schedule s1 and s2 are said to be view equivalent if three conditions are met. prepared by Visakh V,Assistant Professor, LBSITW
  • 42. 1. If Ti reads the initial value of object A in s1,it must also read the initial value of A in s2. 2. If Ti read a value of A written by Tj in s1,it must also read the value of A written by Tj in s2. 3. For each data object A , the transaction (if any)that performs the final write on A in s1 must also perform the final write on A in s2. prepared by Visakh V,Assistant Professor, LBSITW
  • 43. prepared by Visakh V,Assistant Professor, LBSITW
  • 44. prepared by Visakh V,Assistant Professor, LBSITW
  • 45. If S is view equivalent to a serial schedule(prepared by Visakh V,Assistant Professor, LBSITW here S’)
  • 46. Ex: for view serializable schedule It is view equivalent to its serial schedule prepared by Visakh V,Assistant Professor, LBSITW
  • 47. What is the view equivalent serial schedule for this ????? prepared by Visakh V,Assistant Professor, LBSITW
  • 48. The below example is view serializable but not conflict serializable!!! prepared by Visakh V,Assistant Professor, LBSITW
  • 49. •Every conflict serializable schedule is also view serializable, but reverse need not be true. •If blind write appear in any view serializable schedule that is not conflict serializable. •Blind write :- transaction performing write without a read operation prepared by Visakh V,Assistant Professor, LBSITW
  • 50. If transaction fails we need to undo the effect of this transaction to ensure the atomicity property (a)Recoverable schedule (b) Cascadeless schedule prepared by Visakh V,Assistant Professor, LBSITW
  • 51. (a)Recoverable schedule Consider the example for non recoverable schedule: Recoverable schedule : for each pair of transaction Ti and Tj such that Tj reads a data item previously written by Ti ,the commit operation of Ti appears before the commit operation of prepared Tj by. Visakh V,Assistant Professor, LBSITW
  • 52. (a)cascadeless schedule Ex: for cascading schedule Cascading Rollback: a single transaction failure leads to a series of transaction prepared rollbacks by Visakh V,Assistant Professor, LBSITW
  • 53. Every cascadeless schedule is also recoverable prepared by Visakh V,Assistant Professor, LBSITW
  • 54. • Isolation property may no long be preserved. • so we need Concurrency control scheme prepared by Visakh V,Assistant Professor, LBSITW
  • 55. prepared by Visakh V,Assistant Professor, LBSITW
  • 56. lock is a mechanism to control concurrent access to a data item Grants the lock to the transaction prepared by Visakh V,Assistant Professor, LBSITW
  • 57. Data item can be locked in two modes read write read write prepared by Visakh V,Assistant Professor, LBSITW
  • 58. X-lock is requested using lock-X instruction. S-lock is requested using lock-S instruction. prepared by Visakh V,Assistant Professor, LBSITW
  • 59. Lock –compatibility matrix Compatible?? prepared by Visakh V,Assistant Professor, LBSITW
  • 60. Ex: for performing locking prepared by Visakh V,Assistant Professor, LBSITW
  • 61. prepared by Visakh V,Assistant Professor, LBSITW
  • 62. If a lock cannot be granted, the requesting transaction is made to wait till all incompatible locks held by other transactions have been released. The lock is then granted prepared by Visakh V,Assistant Professor, LBSITW
  • 63. prepared by Visakh V,Assistant Professor, LBSITW
  • 64. Necessary condition for deadlock A state where neither of the transaction can proceed with its normal execution prepared by Visakh V,Assistant Professor, LBSITW
  • 65. Consider the example for deadlock: prepared by Visakh V,Assistant Professor, LBSITW
  • 66. Starvation : If a transaction T never make a progress , then is said to be starved. prepared by Visakh V,Assistant Professor, LBSITW
  • 67. When a transaction Ti request a lock on a data item Q in a particular mode M We can avoid starvation by: •There is no other transaction holding a lock on Q in a mode that conflicts with M •There is no other transaction that is waiting for a lock on Q and that made its lock request before Ti prepared by Visakh V,Assistant Professor, LBSITW
  • 68. •Set of rules • each transaction in the system follow this rule • it is for ,when a transaction may lock or unlock each of its data items. •It restricts the number possible schedules prepared by Visakh V,Assistant Professor, LBSITW
  • 69. A schedule s is legal under a given locking protocol ,if s possible schedule for a set of transaction that follows the rules of the locking protocol prepared by Visakh V,Assistant Professor, LBSITW
  • 70. A locking protocol ensures conflict serializability if and only if all legal schedules are conflict serializable. prepared by Visakh V,Assistant Professor, LBSITW
  • 71. This is a protocol which ensures conflict serializable schedules. •Phase 1: Growing Phase •transaction may obtain locks •transaction may not release locks •Phase 2: Shrinking Phase •transaction may release locks •transaction may not obtain prepared by Visakh lVo,Ascsisktanst Professor, LBSITW
  • 72. •Initially a transaction is in the growing phase .The transaction acquires locks as needed. •Once the transaction releases a lock ,it enters the shrinking phase and it can issue no more lock requests. •Unlock instruction do not need to appear at the end of the transaction. prepared by Visakh V,Assistant Professor, LBSITW
  • 73. T1: lock-S(A); read (A); unlock(A); lock-S(B); read (B); unlock(B); display(A+B); T1: lock-s(A); read (A); lock-S(B); read (B); unlock(B); unlock(B); display(A+B); prepared by Visakh V,Assistant Professor, LBSITW
  • 74. The point in the schedule where the transaction has obtained its final lock(the end of growing phase). •Two-phase locking does not ensure freedom from deadlocks prepared by Visakh V,Assistant Professor, LBSITW
  • 75. •cascading rollback may occur under two phase locking prepared by Visakh V,Assistant Professor, LBSITW
  • 76. •(a)Strict two phase locking (avoiding cascading rollback ) •(b)rigorous two phase locking prepared by Visakh V,Assistant Professor, LBSITW
  • 77. Locking be in two phase + all exclusive mode locks of a transaction held until the transaction commit Locking be in two phase + all locks of a transaction held until the transaction commit prepared by Visakh V,Assistant Professor, LBSITW
  • 78. T1: read(A1); read(A2); . . . . read(An); Write(A1) T2: read(A1); read(A2); .display(A1+A2); prepared by Visakh V,Assistant Professor, LBSITW
  • 79. Two-phase locking with lock conversions: – First Phase: •can acquire a lock-S on item •can acquire a lock-X on item •can convert a lock-S to a lock-X (upgrade) – Second Phase: •can release a lock-S •can release a lock-X •can convert a lock-X to a lock-S (downgrade) prepared by Visakh V,Assistant Professor, LBSITW
  • 80. prepared by Visakh V,Assistant Professor, LBSITW
  • 81. •Another method for finding the serializability order • The protocol manages concurrent execution such that the time-stamps determine the serializability • A time stamp is assigned by the database system before the transaction starts execution. prepared by Visakh V,Assistant Professor, LBSITW
  • 82. Assume transactions comes in the order T1.T2,T3 •If an old transaction Ti has time-stamp TS(Ti), a new transaction Tj is assigned time-stamp TS(Tj) such that TS(Ti) <TS(Tj). prepared by Visakh V,Assistant Professor, LBSITW
  • 83. For implementing this we use two simple methods • Use the value of the system clock. OR •Use a logical counter. prepared by Visakh V,Assistant Professor, LBSITW
  • 84. The time-stamps determine the serializability order , i.e. ensure that Ti appears before Tj. maintains for each data Q two timestamp values: . is the largest time-stamp of any transaction that executed write(Q) successfully. is the largest time-stamp of any transaction that executed read(Q) successfully prepared by Visakh V,Assistant Professor, LBSITW
  • 85. •The timestamp ordering protocol ensures that any conflicting read and write operations are executed in timestamp order •The protocol operates as follows. prepared by Visakh V,Assistant Professor, LBSITW
  • 86. Suppose a transaction Ti issues a read(Q) 1. If TS(Ti)  W-timestamp(Q), then Ti needs to read a value of Q that was already overwritten.  Hence, the read operation is rejected, and Ti is rolled back. 2. If TS(Ti)W-timestamp(Q), then the read operation is executed, and R-timestamp(Q) is set to max(R-timestamp( Q), TS(Ti)). prepared by Visakh V,Assistant Professor, LBSITW
  • 87. Read rejected Read rejected Read accepted READ(B) prepared by Visakh V,Assistant Professor, LBSITW
  • 88. Suppose a transaction Ti issues a write(Q) 1. If TS(Ti) < R-timestamp(Q), then the value of Q that Ti is producing was needed previously, and the system assumed that that value would never be produced.  Hence, the write operation is rejected, and Ti is rolled back. 2. If TS(Ti) < W-timestamp(Q), then Ti is attempting to write an obsolete value of Q.  Hence, this write operation is rejected, and Ti is rolled back. 3. Otherwise, the write operation is executed, and W-timestamp( Q) is spreeptar etdo by TVisSak(hT V,iA)s.sistant Professor, LBSITW
  • 89. WRITE(B) write accepted write rejected write rejected prepared by Visakh V,Assistant Professor, LBSITW wite rejected
  • 90. A schedule that is possible under the time stamp protocol assume TS(T25) < TS (T26) prepared by Visakh V,Assistant Professor, LBSITW
  • 91. •ensures freedom from deadlock •may not cascade-free •may not recoverable. prepared by Visakh V,Assistant Professor, LBSITW
  • 92. • Problem with timestamp-ordering protocol: • Suppose Ti aborts, but Tj has read a data item written by Ti , then Tj must abort; if Tj had been allowed to commit earlier, the schedule is not recoverable. • Further, any transaction that has read a data item written by Tj must abort this can lead to cascading rollback --- that is, a chain of rollbacks prepared by Visakh V,Assistant Professor, LBSITW
  • 93. • Solution 1: • A transaction is structured such that its writes are all performed at the end of its processing • All writes of a transaction form an atomic action; no transaction may execute while a transaction is being written • A transaction that aborts is restarted with a new timestamp • Solution 2: Limited form of locking: wait for data to be committed before reading it • Solution 3: Use commit dependencies to ensure recoverability prepared by Visakh V,Assistant Professor, LBSITW
  • 94. Consider the example Example : Don’t worry, We have a soloution THOMAS WRITE RULE prepared by Visakh V,Assistant Professor, LBSITW
  • 95. • Modified version of the timestamp-ordering protocol in which obsolete write operations may be ignored under certain circumstances. • When Ti attempts to write data item Q, if TS(Ti) < W-timestamp( Q), then Ti is attempting to write an obsolete value of {Q}. – Rather than rolling back Ti as the timestamp ordering protocol would have done, this {write} operation can be ignored. prepared by Visakh V,Assistant Professor, LBSITW
  • 96. • Otherwise this protocol is the same as the timestamp ordering protocol. • Thomas' Write Rule allows greater potential concurrency. – Allows some view-serializable schedules that are not conflict-serializable prepared by Visakh V,Assistant Professor, LBSITW
  • 97. prepared by Visakh V,Assistant Professor, LBSITW
  • 98. Types of failure 1. Transaction failure •Logical error • System error : (due to internal condition) bad input, data not found, resource limit exceed. :entered an undesirable state (ex:deadlock) prepared by Visakh V,Assistant Professor, LBSITW
  • 99. 2. System crash : h/w malfunction , or a bug in the database s/w or OS : loss of content in volatile 3. Disk failure : head crash or failure during data transfer operation. prepared by Visakh V,Assistant Professor, LBSITW
  • 100. •Volatile storage: •does not survive system crashes •examples: main memory, cache memory •Nonvolatile storage: •survives system crashes •examples: disk, tape, flash memory, non-volatile (battery backed up) RAM •but may still fail, losing data •Stable storage: •a mythical form of storage that survives all failures •approximated by maintaining multiple copies on distinct nonvolatile pmrepaeredd byi Vaisakh V,Assistant Professor, LBSITW
  • 101. prepared by Visakh V,Assistant Professor, LBSITW
  • 102. prepared by Visakh V,Assistant Professor, LBSITW
  • 103. Blocks : Fixed length storage units Physical blocks are those blocks residing on the disk. Buffer blocks are the blocks residing temporarily in main memory. Block movements between disk and main memory are initiated through the following two operations: input(B) transfers the physical block B to main memory. output(B) transfers the buffer block B to the disk, and replaces the appropriate physical block there. prepared by Visakh V,Assistant Professor, LBSITW
  • 104. Example of Data Access X Y A B x1 y1 buffer Buffer Block A Buffer Block B input(A) output(B) read(X) write(Y) disk work area of T1 x2 work area of T2 memory prepared by Visakh V,Assistant Professor, LBSITW
  • 105. • Each transaction Ti has its private work-area in which local copies of all data items accessed and updated by it are kept. – Ti's local copy of a data item X is called xi. • Transferring data items between system buffer blocks and its private work-area done by: – read(X) assigns the value of data item X to the local variable xi. – write(X) assigns the value of local variable xi to data item {X} in the buffer block. – Note: output(BX) need not immediately follow write(X). System can perform the output operation when it deems fit. • Transactions – Must perform read(X) before accessing X for the first time (subsequent reads can be from local copy) – write(X) can be executed at any time before the transaction commits prepared by Visakh V,Assistant Professor, LBSITW
  • 106. Transaction Log • also know as journal log / redo-log • It is a physical file • It usually contain • transaction identifier • data –item identifier(or time stamp) • old value • new value prepared by Visakh V,Assistant Professor, LBSITW
  • 107. prepared by Visakh V,Assistant Professor, LBSITW
  • 108. We denote various type of log record as 1.<Ti start> : transaction Ti starts 2. <Ti, X, V1, V2> : Before Ti executes write(X) 3.<Ti commit> : Ti finishes it last statement 4. <Ti abort> prepared by Visakh V,Assistant Professor, LBSITW
  • 109. <T0 start> <T0, A, 1000, 950> <To, B, 2000, 2050> <T0 commit> <T1 start> <T1, C, 700, 600> <T1 commit> prepared by Visakh V,Assistant Professor, LBSITW
  • 110. prepared by Visakh V,Assistant Professor, LBSITW
  • 111. •Also known as NO UNDO/REDO • Algorithm to support O/S, application, power, memory and machine failures • During transaction run changes recorded only in the log files not in database • On commit changes made from Log  database • this process is called “Re-doing”(redo(Ti)),sometimes known as ROLLFORWARD. • on rollback ,just discard the log files • on commit, just copy the log files to database prepared by Visakh V,Assistant Professor, LBSITW
  • 112. prepared by Visakh V,Assistant Professor, LBSITW
  • 113. prepared by Visakh V,Assistant Professor, LBSITW
  • 114. •Disadvantage •Increased time of recovery in case of system failure. prepared by Visakh V,Assistant Professor, LBSITW
  • 115. •Also known as UNDO/REDO • Algorithm to support O/S, application, power, memory and machine failures •Transaction updates/alternation prepared by Visakh V,Assistant Professor, LBSITW
  • 116. •On commit all the changes to the db are made permanent and log files discarded • On rollback , using the log entries old values are restored. All the changes in the database are discarded. •This process is called un-doing(undo(Ti)). • original values are restored using the log files for uncommitted transaction. prepared by Visakh V,Assistant Professor, LBSITW
  • 117. prepared by Visakh V,Assistant Professor, LBSITW
  • 118. Log Write Output <T0 start> <T0, A, 1000, 950> <To, B, 2000, 2050 A = 950 B = 2050 <T0 commit> <T1 start> <T1, C, 700, 600> C = 600 BB , BC <T1 commit> BA • Note: BX denotes block containing X. BC output before T1 commits BA output after T0 commits prepared by Visakh V,Assistant Professor, LBSITW
  • 119. prepared by Visakh V,Assistant Professor, LBSITW
  • 120. • The process of undoing changes using log files is frequently referred to as rollback •Disadvantage •Frequent I/O operations while the transaction Is active . prepared by Visakh V,Assistant Professor, LBSITW
  • 121. •Commercial RDMS is neither deferred nor immediate • Database updated at fixed interval of time •Irrespective of transaction commit/un-commit state. •Check pointing : updating transaction at fixed intervals of time is called check-pointing. • @ check point time log files changes applied to the database. • prepared by Visakh V,Assistant Professor, LBSITW
  • 122. prepared by Visakh V,Assistant Professor, LBSITW
  • 123. prepared by Visakh V,Assistant Professor, LBSITW
  • 124. prepared by Visakh V,Assistant Professor, LBSITW
  • 125. • During recovery we need to consider only the most recent transaction Ti that started before the checkpoint, and transactions that started after Ti. 1. Scan backwards from end of log to find the most recent <checkpoint L> record – Only transactions that are in L or started after the checkpoint need to be redone or undone – Transactions that committed or aborted before the checkpoint already have all their updates output to stable storage. • Some earlier part of the log may be needed for undo operations 1. Continue scanning backwards till a record <Ti start> is found for every transaction Ti in L. – Parts of log prior to earliest <Ti start> record above are not needed for recovery, and can be erased whenever desired. prepared by Visakh V,Assistant Professor, LBSITW
  • 126. prepared by Visakh V,Assistant Professor, LBSITW
  • 127. prepared by Visakh V,Assistant Professor, LBSITW
  • 128. prepared by Visakh V,Assistant Professor, LBSITW
  • 129. •Alternative to log-based crash-recovery techniques. •Advantage: require few disk access than log-based. • pages : fixed length portioned block in database. • page table : •The page table has n entries—one for each database page. •Each entry contains a pointer to a page on disk . prepared by Visakh V,Assistant Professor, LBSITW
  • 130. prepared by Visakh V,Assistant Professor, LBSITW