lec3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Recap

• Which of the following makes the transaction


permanent in the database?
a) View
b) Commit
c) Rollback
d) Flashback
• In case of any shut down during transaction
before commit which of the following
statement is done automatically?
a) View
b) Commit
c) Rollback
d) Flashback
• Consistency of a transaction is a responsibility
of:
• A) User
• B) DBMS
• C) Recovery subsystem
• D) Programmer
• In order to maintain the consistency during
transactions, DBMS provides
• a) Commit
• b) Atomic
• c) Flashback
• d) Retain
Characterizing Schedules Based on
Recoverability

1. Recoverable schedules
2. Cascading rollback
3. Strict schedule
Recoverable schedules
• once a transaction T is committed, it should
never be necessary to roll back T. This ensures
that the durability property of transactions is
not violated.
• Recoverable schedules: The schedules that
theoretically meet this criterion.
• A schedule where a committed transaction
may have to be rolled back during recovery is
called nonrecoverable and hence should not
be permitted by the DBMS.
• Note:
If r2(X) came after w1(X), then c1 should be
executed before c2 to be recoverable.

Example:
Sa: r1(X); r2(X); w1(X); r1(Y); w2(X); c2; w1(Y); c1;
Sa is recoverable, , even though it suffers from
the lost update problem; this problem is
handled by serializability theory.
• Sc: r1(X); w1(X); r2(X); r1(Y); w2(X); c2; a1;
Sc is not recoverable because T2 reads item X
from T1, but T2 commits before T1 commits.

• Sd: r1(X); w1(X); r2(X); r1(Y); w2(X); w1(Y); c1; c2;


• Se: r1(X); w1(X); r2(X); r1(Y); w2(X); w1(Y); a1; a2;
Sd and Se are recoverable.
Cascading rollback (or cascading abort)
• occur in some recoverable schedules, where
an uncommitted transaction has to be rolled
back because it read an item from a
transaction that failed.
• Example:
Se: r1(X); w1(X); r2(X); r1(Y); w2(X); w1(Y); a1; a2;
where transaction T2 has to be rolled back
because it read item X from T1, and T1 then
aborted.
• Because cascading rollback can be time-
consuming—since numerous transactions can be
rolled back, it is important to characterize the
schedules where cascading rollback is guaranteed
not to occur.
• A schedule is said to be cascadeless, or to avoid
cascading rollback: if every transaction in the
schedule reads only items that were written by
committed transactions. In this case, all items
read will not be discarded because the
transactions that wrote them have commit- ted,
so no cascading rollback will occur.
• Sd: r1(X); w1(X); c1; r2(X); r1(Y); w2(X); c2;
3- Strict schedule
• Transactions can neither read nor write an item X
until the last transaction that wrote X has
committed (or aborted).
• Note:
1. Any strict schedule is also cascadeless, and any
cascade- less schedule is also recoverable.
2. To check any schedule is strict or cascadeless, or
recoverable: we start with conditions of strict if
it is not we then check the condition of
cascadeless, if it is not then we check the
condition of recoverable if it is not, then it is
non-recoverable schedule.
Examples
• Recoverable Schedule
S1: R1(x), W1(x), R2(x), R1(y), R2(y), W2(x), 1(y),
C1, C2;

• Unrecoverable schedule
S2: R1(x), R2(x), R1(z), R3(x), R3(y), W1(x),W3(y),
R2(y), W2(z), W2(y), C1, C2, C3;
• Cascadeless schedule
S3: R1(x), R2(z), R3(x), R1(z), R2(y), R3(y), W1(x),
C1,
W2(z), W3(y), W2(y), C3, C2;

• Strict Schedule
S4: R1(x), R2(x), R1(z), R3(x), R3(y), W1(x), C1,
W3(y), C3, R2(y), W2(z), W2(y), C2;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy