Presentation is loading. Please wait.

Presentation is loading. Please wait.

ARIES Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 1 2 3 WA,B CP WC WD WB WA.

Similar presentations


Presentation on theme: "ARIES Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 1 2 3 WA,B CP WC WD WB WA."— Presentation transcript:

1 ARIES Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E WA,B CP WC WD WB WA WE CRASH Flush

2 ARIES - What is Logged “Physiological Logging” –REDO Records Updates to data pages and index pages are logged separately 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

3 ARIES Data Structures 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 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

4 Crash Recovery 3 Phases –Analysis Rebuild data structures Determine winners & losers –Redo “Repeat history” Why? –Undo Undo Losers

5 Analysis LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E

6 Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID 31 pgNorecLSN A2 B3 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk

7 Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID pgNorecLSN A2 B3 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk

8 Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID pgNorecLSN A2 B3 C6 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk

9 Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID pgNorecLSN A2 B3 C6 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk

10 Analysis LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E lastLSNTID pgNorecLSN A2 B3 C6 D8 PagepageLSN A2 B3 C6 D? E? xactionTabledirtyPgTable Disk

11 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 Not the same as just before crash (note disk state)

12 Redo Where to begin? –Checkpoint? –Min(recLSN)! What to REDO –Everything? Slow Problematic if using operational (escrow) logging –Redo an update UNLESS: pgNorecLSN A2 B3 C6 D8 E13 dirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk

13 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 If LSN < recLSN If LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN B3 C6 D8 E13

14 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 If LSN < recLSN If LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN C6 D8 E13

15 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 If LSN < recLSN If LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN D8 E13

16 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 If LSN < recLSN If LSN <= pageLSN 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 D8 E13 Redo UNLESS Page is not in dirtyPgTable If LSN < recLSN If LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN B10 D8 E13

18 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 If LSN < recLSN If LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk pgNorecLSN A11 B10 D8 E13

19 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 If LSN < recLSN If LSN <= pageLSN DirtyPgTable PagepageLSN A2 B3 C6 D? E? Disk State identical to pre-crash state

20 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

21 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

22 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?

23 UNDO Wrinkles Logical UNDO –Why? “Compensation Log Records” -- CLRs –Avoid repeating UNDO work –Why?

24 UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E Losers: 3

25 UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E

26 UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR3E

27 UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR310E

28 UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR310E 15CLR35B

29 UNDO with CLR LSNTypeTidPrevLSNData 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 14CLR310E 15CLR35B 16EOT3-

30 REDO with CLR REDO CLRs on crash recovery –Use REDO rules to check if updates in CLRs have already been done –After processing CLR, update lastLSN field in dirtyPgTable to point to prevLSN of CLR Allows UNDO to start from the right place


Download ppt "ARIES Example LSNTypeTidPrevLSNData 1SOT1 2UP12A 3 13B 4CP 5SOT3 6UP13C 7SOT2 8UP27D 9EOT16 10UP35B 11UP28A 12EOT211 13UP310E 1 2 3 WA,B CP WC WD WB WA."

Similar presentations


Ads by Google