nessun titolo diapositiva - polito.it · d b m g 14 execution of a checkpoint 1. the tids of all...
TRANSCRIPT
![Page 1: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/1.jpg)
DBMG
Database Management Systems
Reliability Management
1
![Page 2: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/2.jpg)
DBMG
2
DBMS Architecture
OPTIMIZER
MANAGEMENT OF ACCESS
METHODS
BUFFER MANAGER
CONCURRENCY CONTROL
RELIABILITY MANAGEMENT
SQL INSTRUCTION
System
Catalog
Index Files
Data Files
DATABASEDATABASE
![Page 3: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/3.jpg)
DBMG
33
Reliability Manager
It is responsible of the atomicity and durabilityACID properties
It implements the following transactional commands
begin transaction (B, usually implicit)
commit work (C)
rollback work (A, for abort)
It provides the recovery primitives
warm restart
for main memory failures
cold restart
![Page 4: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/4.jpg)
DBMG
4
Reliability Manager
It manages the reliability of read/write requests by interacting with the buffer manager
It may generate new read/write requests for reliability purposes
It exploits the log file
a persistent archive recording DBMS activity
stored on stable memory
It prepares data for performing recovery by means of the operations
checkpoint
dump
![Page 5: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/5.jpg)
DBMG
55
Stable memory
Memory that is resistant to failure
it is an abstraction
it is approximated by means of
redundancy
robust write protocols
Failures in stable memory are considered catastrophic
![Page 6: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/6.jpg)
DBMG
Log file
Sequential file written in stable memory
It records transaction activities in chronological order
Log record types
Transaction records
System records
Writing the log
Records are written in the current block in sequential order
Records belonging to different transactions are interleaved
66
![Page 7: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/7.jpg)
DBMG
Transaction records
Describe the activities performed by each transaction in execution order
Transaction delimiters
Begin B(T)
Commit C(T)
Abort/Rollback A(T)
where T is the Transaction Identifier
7
![Page 8: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/8.jpg)
DBMG
Transaction records
Data modifications
Insert I(T, O, AS)
Delete D(T, O, BS)
Update U(T, O, BS, AS)
where
O is the written object (RID)
AS is the After State (state of object O after the modification)
BS is the Before State (state of object O before the modification)
8
![Page 9: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/9.jpg)
DBMG
9
System records
Record system operations saving data on disk or other tertiary (or off-line) storage
Dump
Checkpoint CK(L)
where L = T1, T2, …, Tn
is the set of TIDs of active transactions
![Page 10: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/10.jpg)
DBMG
10
Log example
DUMP CHECKPOINT
B(T1)
B(T2) I(T1,O1,AS1)
U(T2,O2,BS2,AS2) C(T1)
D(T2,O3,BS3)
time
Top of the log
![Page 11: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/11.jpg)
DBMG
11
Undoing and redoing actions
Undo of an action on an object O
Redo of an action on an object O
Action Undo action
insert O delete O
update O write the before state (BS) of O
delete O write the before state (BS) of O
Action Redo action
insert O write the after state (AS) of O
update O write the after state (AS) of O
delete O delete O
![Page 12: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/12.jpg)
DBMG
12
Undoing and redoing actions
Idempotency property
Undo or Redo can be repeated an arbitary number of times without changing the final outcome
UNDO (UNDO(action)) = UNDO(action)
Useful for managing crashes during the recovery process
![Page 13: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/13.jpg)
DBMG
Checkpoint
Operation periodically requested by the Reliability Manager to the Buffer Manager
It allows a faster recovery process
During the checkpoint, the DBMS
writes data on disk for all completed transactions
synchronous write
records the active transactions
1313
![Page 14: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/14.jpg)
DBMG
1414
Execution of a checkpoint
1. The TIDs of all active transactions are recorded
after the checkpoint is started, no transaction can commit until the checkpoint ends
2. The pages of concluded transactions (committed or aborted) are synchronously written on disk
by means of the force primitive
3. At the end of step 2, a checkpoint record is synchronously written on the log
it contains the set of active transactions
it is written by means of the force primitive
![Page 15: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/15.jpg)
DBMG
1515
Checkpoint
After a checkpoint
The effect of all committed transactions is permanently stored on disk
The state of data pages written by active transactions is unknown
![Page 16: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/16.jpg)
DBMG
1616
Dump
It creates a complete copy of the database
typically performed when the system is offline
the database copy is stored in stable memory
tertiary storage or off-line storage
the copy may be incremental
At the end, a dump record is written in the log file
Date and time of the dump
Dump device used
![Page 17: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/17.jpg)
DBMG
17
Rules for writing the log
Designed to allow recovery in presence of failure
WAL
Commit precedence
![Page 18: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/18.jpg)
DBMG
18
Write Ahead Log
The before state (BS) of data in a log record is written in stable memory before database data is written on disk
During recovery, it allows the execution of undo operations on data already written on disk
![Page 19: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/19.jpg)
DBMG
Commit precedence
The after state (AS) of data in a log record is written in stable memory before commit
During recovery, it allows the execution of redo operations for transactions that already committed, but were not written on disk
19
![Page 20: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/20.jpg)
DBMG
Practical rules for writing the log
BS and AS are written together
WAL
The log must be written before the record in the database
Commit precedence
The log must be written before commit
2020
![Page 21: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/21.jpg)
DBMG
Practical rules for writing the log
The log is written synchronously (force)
for data modifications written on disk
on commit
The log is written asynchronously
for abort/rollback
2121
![Page 22: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/22.jpg)
DBMG
2222
Commit record
The commit record on the log is a border line
If it is not written in the log, the transaction should be undone upon failure
If it is written, the transaction should be redoneupon failure
![Page 23: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/23.jpg)
DBMG
2323
Protocols for writing the log and the database
All database disk writes are performed beforecommit
It does not require redo of committed transactions
Time
Log
B(T) U(T, x, BSx, ASx) U(T, y, BSy, ASy) C(T)
DB
W(x) W(y)
![Page 24: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/24.jpg)
DBMG
2424
Protocols for writing the log and the database
All database disk writes are performed aftercommit
It does not require undo of uncommitted transactions
Time
Log
B(T) U(T, x, BSx, ASx) U(T, y, BSy, ASy) C(T)
DB
W(x) W(y)
![Page 25: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/25.jpg)
DBMG
2525
Protocols for writing the log and the database
Disk writes for the database take place both before and after commit
It requires both the undo and redo operations
Mixed approach adopted in real systems
Time
Log
B(T) U(T, x, BSx, ASx) U(T, y, BSy, ASy) C(T)
DB
W(x) W(y)
![Page 26: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/26.jpg)
DBMG
26
Writing the log
The usage of robust protocols to guarantee reliability is costly
Comparable with database update cost
It is required to guarantee the ACID properties
Log writing is optimized
Compact format
Parallelism
Commit of groups of transactions
![Page 27: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/27.jpg)
DBMG
Database Management Systems
Recovery Management
27
![Page 28: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/28.jpg)
DBMG
28
Types of failures
System failure
Caused by software problems or power supply interruptions
It causes losing the main memory content (DBMS buffer) but not the disk (both database and log)
Media failure
Caused by failure of devices managing secondary memory
It causes losing the database content on disk, but not the log content (stored in stable storage)
![Page 29: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/29.jpg)
DBMG
29
Fail-stop model
NormalOperation
STOP
RECOVERY
![Page 30: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/30.jpg)
DBMG
Recovery
When a failure occurs
The system is stopped
Recovery depends on the failure type
Warm restart
performed for system failures
Cold restart
performed for media failures
When recovery ends
the system becomes again available to transactions
3030
![Page 31: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/31.jpg)
DBMG
Database Management Systems
Warm Restart
31
![Page 32: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/32.jpg)
DBMG
32
Transaction categories
timetC tF
tC = time of the last checkpoint
tF = time of failure
T1
T2
T3
T4
T5
crash!
![Page 33: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/33.jpg)
DBMG
3333
Transaction categories
Transactions completed before the checkpoint
(T1)
No recovery action is needed
Transactions which committed, but for which some writes on disk may not have been done yet (T2 and T4)
redo is needed
Active transactions at the time of failure
(T3 and T5)
they did not commit
undo is needed
![Page 34: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/34.jpg)
DBMG
3434
Checkpoint record
The checkpoint record is not needed to enable recovery
It provides a faster warm restart
Without checkpoint record
The entire log needs to be read until the last dump
![Page 35: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/35.jpg)
DBMG
Warm restart algorithm
1. Read backwards the log until the last checkpoint record
2. Detect transactions which should be undone/redone
a) At the last checkpoint
UNDO = { Active transactions at checkpoint }
REDO = { } (empty)
35
![Page 36: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/36.jpg)
DBMG
Warm restart algorithm
b) Read forward the log
UNDO = Add all transactions for which the begin record is found
REDO = Move transactions from UNDO to REDO list when the commit record is found
Transactions ending with rollback remain in the UNDO list
At the end of step 2
UNDO = list of transactions to be undone
REDO = list of transactions to be redone
36
![Page 37: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/37.jpg)
DBMG
37
Warm restart algorithm
timetC tF
T1
T2
T3
T4
T5
UNDO = {T2,T3} REDO = { }
tC = time of last checkpoint
tF = time of failure
![Page 38: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/38.jpg)
DBMG
38
Warm restart algorithm
timetC tF
T1
T2
T3
T4
T5
UNDO = {T2,T3,T4} REDO = { }
t1
tC = time of last checkpoint
tF = time of failure
![Page 39: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/39.jpg)
DBMG
39
Warm restart algorithm
timetC tF
T1
T2
T3
T4
T5
UNDO = {T3,T4} REDO = {T2}
t1
tC = time of last checkpoint
tF = time of failure
t2
![Page 40: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/40.jpg)
DBMG
40
Warm restart algorithm
timetC tF
T1
T2
T3
T4
T5
UNDO = {T3,T4,T5} REDO = {T2}
t1
tC = time of last checkpoint
tF = time of failure
t2 t3
![Page 41: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/41.jpg)
DBMG
41
Warm restart algorithm
timetC tF
T1
T2
T3
T4
T5
UNDO = {T3,T5} REDO = {T2,T4}
t1
tC = time of last checkpoint
tF = time of failure
t2 t3 t4
Final lists
![Page 42: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/42.jpg)
DBMG
4242
Warm restart algorithm
3. Data Recovery
a) The log is read backwards from the time of failure until the beginning of the oldest transaction in the UNDO list
Actions performed by all transactions in the UNDO list are undone
For each transaction the begin record should be reached
even if it is earlier than the last checkpoint
![Page 43: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/43.jpg)
DBMG
4343
Warm restart algorithm
b) The log is read forward from the beginning of the oldest transaction in the REDO list
Actions of transactions in the REDO list are applied to the database
For each transaction, the starting point is its begin record
![Page 44: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/44.jpg)
DBMG
44
Warm restart example
Log snippet
B(T1) B(T2) U(T2, O1, B1 , A1) I(T1, O2, A2) B(T3) C(T1) B(T4) U(T3, O2, B3, A3) U(T4, O3, B4, A4) CK(T2, T3, T4) C(T4) B(T5) U(T3, O3, B5, A5) U(T5, O4, B6, A6) D(T3, O3, B7) A(T3) C(T5) I(T2, O6, A8) failure
![Page 45: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/45.jpg)
DBMG
45
Warm restart example
Log snippet
B(T1) B(T2) U(T2, O1, B1 , A1) I(T1, O2, A2) B(T3) C(T1) B(T4) U(T3, O2, B3, A3) U(T4, O3, B4, A4) CK(T2, T3, T4) C(T4) B(T5) U(T3, O3, B5, A5) U(T5, O4, B6, A6) D(T3, O3, B7) A(T3) C(T5) I(T2, O6, A8)
1. At the checkpoint
UNDO = {T2,T3,T4}
REDO = { }
![Page 46: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/46.jpg)
DBMG
46
Warm restart example
B(T1) B(T2) U(T2, O1, B1 , A1) I(T1, O2, A2) B(T3) C(T1) B(T4) U(T3, O2, B3, A3) U(T4, O3, B4, A4) CK(T2, T3, T4) C(T4) B(T5) U(T3, O3, B5, A5) U(T5, O4, B6, A6) D(T3, O3, B7) A(T3) C(T5) I(T2, O6, A8)
2. Read the log forward
Operation UNDO REDO
CK {T2,T3,T4} { }
![Page 47: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/47.jpg)
DBMG
47
Warm restart example
B(T1) B(T2) U(T2, O1, B1 , A1) I(T1, O2, A2) B(T3) C(T1) B(T4) U(T3, O2, B3, A3) U(T4, O3, B4, A4) CK(T2, T3, T4) C(T4) B(T5) U(T3, O3, B5, A5) U(T5, O4, B6, A6) D(T3, O3, B7) A(T3) C(T5) I(T2, O6, A8)
2. Read the log forward
Operation UNDO REDO
CK {T2,T3,T4} { }
C(T4) {T2,T3} {T4}
B(T5) {T2,T3,T5} {T4}
A(T3) {T2,T3,T5} {T4}
C(T5) {T2,T3} {T4,T5}Final lists
![Page 48: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/48.jpg)
DBMG
48
Warm restart example
B(T1) B(T2) U(T2, O1, B1 , A1) I(T1, O2, A2) B(T3) C(T1) B(T4) U(T3, O2, B3, A3) U(T4, O3, B4, A4) CK(T2, T3, T4) C(T4) B(T5) U(T3, O3, B5, A5) U(T5, O4, B6, A6) D(T3, O3, B7) A(T3) C(T5) I(T2, O6, A8)
3. Undo transactions in UNDO = {T2,T3}
a) DELETE O6
b) INSERT O3 = B7
c) O3 = B5
d) O2 = B3
e) O1 = B1
![Page 49: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/49.jpg)
DBMG
49
Warm restart example
B(T1) B(T2) U(T2, O1, B1 , A1) I(T1, O2, A2) B(T3) C(T1) B(T4) U(T3, O2, B3, A3) U(T4, O3, B4, A4) CK(T2, T3, T4) C(T4) B(T5) U(T3, O3, B5, A5) U(T5, O4, B6, A6) D(T3, O3, B7) A(T3) C(T5) I(T2, O6, A8)
4. Redo transactions in REDO = {T4,T5}
a) O3 = A4
b) O4 = A6
![Page 50: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/50.jpg)
DBMG
5050
Warm restart example
timetC tF
REDO = {T4,T5}UNDO = {T2,T3}
T1
T2
T3
T4
T5
tF = time of failure
Abort
![Page 51: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/51.jpg)
DBMG
Database Management Systems
Cold Restart
51
![Page 52: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/52.jpg)
DBMG
5252
Cold restart
It manages failures damaging (a portion of) the database on disk
Main steps
1. Access the last dump to restore the damaged portion of the database on disk
2. Starting from the last dump record, read the log forward and redo all actions on the database and transaction commit/rollback
3. Perform a warm restart
![Page 53: Nessun titolo diapositiva - polito.it · D B M G 14 Execution of a checkpoint 1. The TIDs of all active transactions are recorded after the checkpoint is started, no transaction can](https://reader033.vdocument.in/reader033/viewer/2022042306/5ed23dab3f1c3402ff00b43d/html5/thumbnails/53.jpg)
DBMG
53
Cold restart
Alternative to steps 2 and 3
Perform only actions of committed transactions
It requires two log reads
Detect committed transactions
build a REDO list
Redo actions of transactions in REDO list