Download presentation
Presentation is loading. Please wait.
Published byGriffin Tucker Modified over 9 years ago
1
ARIES Recovery
2
ARIES Lightweight db recovery !FORCE/STEAL semantics Physical redo Logical undo Recovery protocol: –Analysis –Redo –Undo
3
ARIES Example LSNTypeTidPrevLSNData 1 2 3 WA,B CP WC WD WB WA WE CRASH Flush 1SOT1 2UP11A 3 12B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E
4
ARIES - What is Logged “ Physiological Logging ” –REDO Records Updates to data pages and index pages are logged separately, and usually physically But may use operational logging (e.g., INCREMENT/DECREMENT) –Because escrow locks allow multiple writers –UNDO Records are Purely Logical Only one record for index and data pages May use operational logging
5
ARIES Data Structures 1 2 3 WA,B CP WC WD WB WA WE CRASH Flush lastLSNTID 11 xactionTable pgNorecLSN dirtyPgTable xactionTable dirtyPgTable Checkpoint PagepageLSN A? B? C? D? E? Disk lastLSNTID 21 lastLSNTID 31 lastLSNTID 31 53 lastLSNTID 133 pgNorecLSN A2 B3 pgNorecLSN A2 B3 C6 PagepageLSN A2 B3 C6 D? E? pgNorecLSNpgNorecLSN D8 pgNorecLSN D8 B10 pgNorecLSN D8 B10 A11 pgNorecLSN D8 B10 A11 E13 xactionTable3 - 1 dirtyPgTableA - 2, B - 3
6
Study Break: Checkpointing Draw a timeline for this log. What is its transaction table and dirty page table after LSN 12? (presume there is no flushing) LSNTypeTIDPrev LSN Data 1SOT1 2UP12A 3SOT2 4CP 5SOT3 6UP23B 7 35C 8 26A 9EOT12 10UP37D 11UP28E 12EOT310
7
Study Break Solution T1 T2 CP T3 SOT WA WC WD SOT WB WA WE EOT Transaction Table T2: LastLSN 11 Dirty Pages A – 2 B – 6 C – 7 D – 10 E – 11
8
Crash Recovery 3 Phases –Analysis Rebuild data structures Determine winners & losers –Redo “ Repeat history ” Why? –Undo Undo Losers
9
Analysis LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E
10
Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 31 pgNorecLSN A2 B3 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk
11
Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 31 53 pgNorecLSN A2 B3 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk
12
Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 31 53 pgNorecLSN A2 B3 C6 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk
13
Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 31 53 72 pgNorecLSN A2 B3 C6 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk
14
Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 31 53 72 pgNorecLSN A2 B3 C6 D8 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk
15
Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 133 pgNorecLSN A2 B3 C6 D8 E13 PagepageLSN A2 B3 C6 D? E? xactionTable dirtyPgTable Disk Dirty page table doesn ’ t reflect true state on disk
16
Redo Where to begin? –Checkpoint? –Min(recLSN)! What to REDO –Everything? Slow Problematic if using operational (escrow) logging –Redo an update UNLESS: Page is not in dirtyPgTable –Page flushed prior to checkpoint, didn’t redirty LSN < recLSN –Page flushed & redirtied prior to checkpoint LSN <= pageLSN –Page flushed after checkpoint pgNorecLSN A2 B3 C6 D8 E13 dirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk
17
Redo Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E pgNorecLSN A2 B3 C6 D8 E13 Redo UNLESS Page is not in dirtyPgTable LSN < recLSN LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN B3 C6 D8 E13
18
Redo Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E pgNorecLSN B3 C6 D8 E13 Redo UNLESS Page is not in dirtyPgTable LSN < recLSN LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN C6 D8 E13
19
Redo Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E pgNorecLSN C6 D8 E13 Redo UNLESS Page is not in dirtyPgTable LSN < recLSN LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN D8 E13
20
Redo Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E pgNorecLSN D8 E13 Redo UNLESS Page is not in dirtyPgTable LSN < recLSN LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk
21
Redo Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E pgNorecLSN D8 E13 Redo UNLESS Page is not in dirtyPgTable LSN < recLSN LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN B10 D8 E13
22
Redo Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E pgNorecLSN B10 D8 E13 Redo UNLESS Page is not in dirtyPgTable LSN < recLSN LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN A11 B10 D8 E13
23
Redo Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E pgNorecLSN A11 B10 D8 E13 Redo UNLESS Page is not in dirtyPgTable LSN < recLSN LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk State identical to pre-crash state
24
Undo Walk backwards, following prevLSNs to UNDO losers LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 133 xactionTable
25
Undo Walk backwards, following prevLSNs to UNDO losers LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 133 xactionTable
26
Undo Walk backwards, following prevLSNs to UNDO losers LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 133 xactionTable Why can we just blindly apply UNDOs?
27
UNDO Wrinkles Logical UNDO –Why? “ Compensation Log Records ” -- CLRs –Avoid repeating UNDO work –Why?
28
UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E Losers: 3
29
UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E
30
UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR31310
31
UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR313E, 10
32
UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR313E, 10 15CLR314B, 5
33
UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR313E, 10 15CLR314B, 5
34
UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR313E, 10 15CLR314B, 5
35
UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR313E, 10 15CLR314B, 5 16EOT315
36
REDO with CLR REDO CLRs on crash recovery –Use REDO rules to check if updates in CLRs have already been done Avoids repeating operational (escrow) operations –After processing CLR, update lastLSN field in dirtyPgTable Allows UNDO to start from the right place
37
Study Break: Recovery Steps For this log, at what LSN does the analysis phase begin? What LSN is processed first for the REDO phase? What LSN is processed first for the UNDO phase?
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.