Professional Documents
Culture Documents
Lesson07 Reliability
Lesson07 Reliability
Email: eric.umuhoza@gmail.com
Twitter: @EricUmuhoza
July 9, 2023
1 / 41
Reliability Control
In this Lecture
”Things will go wrong in any given situation, if you give them a chance”
2 / 41
Reliability Control
Persistence of Memories
• Main memory
– Not persistent
• Mass memory
– Persistent but can be damaged
• Stable memory
– Cannot be damaged (it is an abstraction)
3 / 41
Reliability Control
4 / 41
Reliability Control
5 / 41
Reliability Control
Rationale
• Reuse of data in the buffer
• Deferred writing into the database
7 / 41
Reliability Control
Buffer Management
8 / 41
Reliability Control
In practice, the primitives fix and use allow the loading into the
buffer and the reading of data, and the primitive force is used by the
transactions to write data in the secondary memory. Furthermore,
the flush primitive is used by the buffer manager itself to transfer to
the secondary memory the pages that are no longer valid and remain
inactive for a long time.
9 / 41
Reliability Control
• Steal, used during the execution of the fix operation, allows the
buffer manager to select an active page allocated to another
transaction as a victim – page taken away from an active
transaction.
• No Steal, excludes this possibility.
• Force requires that all the active pages of a transaction are
transcribed in the secondary memory when at commit-work.
• No Force, entrusts the writing of the pages of a transaction to
the asynchronous mechanisms of the buffer manager.
10 / 41
Reliability Control
• Pre-flushing
– anticipates writing of de-allocated pages
– useful for accelerating page fix
11 / 41
Reliability Control
12 / 41
Reliability Control
13 / 41
Reliability Control
14 / 41
Reliability Control
15 / 41
Reliability Control
Recovery Facilities
17 / 41
Reliability Control
Transaction Log
18 / 41
Reliability Control
19 / 41
Reliability Control
20 / 41
Reliability Control
21 / 41
Reliability Control
22 / 41
Reliability Control
• Log records are smaller than a page → the buffer manager tries
to write multiple log records at once since the cost of writing into
secondary memory is high
• But logs are lost if the system crashes!
• We must impose additional requirements on the recovery
techniques to ensure transaction atomicity
23 / 41
Reliability Control
Transactional Rules
• Write–Ahead–Log
– Before-state parts of the log records must be written in the log
before carrying out the corresponding operation on the database
– Actions can be undone
• Commit Rule
– After-state parts of the log records must be written in the log before
carrying out the commit
– Actions can be redone
24 / 41
Reliability Control
25 / 41
Reliability Control
26 / 41
Reliability Control
27 / 41
Reliability Control
In Case of Failure
• Soft failure
– Loss of the contents of the main memory
– Requires warm restart
• Hard failure
– Failure of secondary memory devices
– Requires cold restart
28 / 41
Reliability Control
29 / 41
Reliability Control
Checkpoint
• Consistent time point (in which all transactions write their data
from the buffer to the disk)
• All active transactions are recorded
30 / 41
Reliability Control
Checkpoint
31 / 41
Reliability Control
Checkpoint
32 / 41
Reliability Control
Checkpoint
33 / 41
Reliability Control
Dump
34 / 41
Reliability Control
Warm Restart
35 / 41
Reliability Control
Warm Restart
• UNDO
– Active transactions before commit
• REDO
– Active transactions after commit
36 / 41
Reliability Control
Warm Restart
37 / 41
Reliability Control
• B(T1)
• B(T2)
• U(T1,O1,B1,A1)
• I(T1,O2,A2)
• U(T2,O3,B3,A3)
• UNDO=(T1,T2,T3)
• B(T3)
REDO=()
• U(T3,O4,B4,A4)
• D(T3,O5,B5) • UNDO=(T1,T3,T4)
• CKPT(T1,T2,T3) REDO=(T2)
• C(T2)
• B(T4)
• U(T4,06,B6,A6)
• A(T4)
• Failure
38 / 41
Reliability Control
• B(T1) UNDO=(T1,T2,T3)
• B(T2) REDO=(T2)
• U(T1,O1,B1,A1) O1 = B1
• I(T1,O2,A2) DELETE(O2)
• U(T2,O3,B3,A3) O3 = A3
• B(T3)
• U(T3,O4,B4,A4) O4 = B4
• D(T3,O5,B5) O5 = B
• CKPT(T1,T2,T3)
• C(T2)
• B(T4)
• U(T4,06,B6,A6) O6 = B6
• A(T4)
• Failure RESTART
39 / 41
Reliability Control
Cold Restart
40 / 41
Reliability Control
The End
41 / 41