/
Lecture 13 – ARIES Recovery Lecture 13 – ARIES Recovery

Lecture 13 – ARIES Recovery - PowerPoint Presentation

deborah
deborah . @deborah
Follow
0 views
Uploaded On 2024-03-13

Lecture 13 – ARIES Recovery - PPT Presentation

Lecture 13 2023 Survey project meetings Stable Diffusion a ram in cyberpunk style in space Recovery Recap What happens during crash Memory is reset State on disk persists After a crash recovery ensures ID: 1048149

undo log aries lsn log undo lsn aries redo data page structures123wa crash table 1dirtypgtablea time state disk diskxactiontabledirtypgtablexactiontable3

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Lecture 13 – ARIES Recovery" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1. Lecture 13 – ARIES RecoveryLecture 13, 2023Survey, project meetingsStable Diffusion: a ram in cyberpunk style in space

2. Recovery RecapWhat happens during crash:Memory is resetState on disk persistsAfter a crash, recovery ensures:Atomicity: partially finished xactions are rolled backDurability: committed xactions are on stable storage (disk)Brings database into a transaction consistent state, where committed transactions are fully reflected, and uncommitted transactions are completely undone

3. Database StateP1P2…Buffer ManagerDiskTablesLogMemoryAfter crash, memory is gone!Problem 1: Some transactions may have written their uncommitted state to tables – need to UNDOProblem 2: Some transactions may not have flushed all of their state to tables prior to commit – need to REDOLog records start and end of transactions, and contents of writes done to tables so we can solve both problems

4. Types of Log RecordsStart (SOT) Log Sequence Number (LSN), Transaction ID (TID)LSN is a monotonically increasing log record numberEnd (EOT) LSN, TID, outcome (commit or abort)UNDO LSN, TID, before imageREDO LSN, TID, after imageFor ARIES:CHECKPOINT LSN, TID, state to limit how much is loggedCLR(Compensation Log Records) LSN, TID, allows us to restart recovery 

5. Write Ahead LoggingWrite what we plan to do, before we do it

6. Recovery with NO FORCE / STEALAfter crash, we must:REDO “winner” transactions that had committedUNDO “loser” transactions that had not committed Winners are transactions with SOT and COMMIT in logLosers are those with SOT and no EOT, or ABORTNeed to REDO winners from start to endNeed to UNDO losers in reverse, from end to startAlso need to UNDO aborted transactions

7. Hard Problems with RecoveryB-Tree: Problem 1: Logical Inserts create different BtreesProblem 2: Crash while updating a multi-page B-Tree or inconsistency between B-Tree and data pagesCost of checkpoints (do we have to block the system while checkpointing?)Recovery time (how long do we have to wait until the system is again available)Crash during recoveryEscrow updates….

8. ARIESGold standard in loggingSpecifies all the detailsNO FORCE/STEALRecoverable recovery“Physiological” LoggingLow-overhead CheckpointsSupport for escrow operationsE.g., increment / decrements

9. It might be hard to appreciate how “cool” ARIES is

10. ARIES Approach: 3 Log PassesAnalysis, to see what needs to be done (FW)Redo, to ensure DB reflects updates that are in the log but not in tables (FW) Including those that belong to txns that will eventually be rolled back! Why? Ensures “action consistent” state -- which will allow logical  undo.  “Repeating History”Undo, to rollback losers (BW)FW = Forward Pass; BW = Backward Pass

11. Log Record FormatLSN TID prevLSNUndo Image(logical)Redo Image(physical)pageLSNLog RecordDisk PageEvery time a page is written, the latest LSN associated with that log record is included as the  pageLSN. Every log record has an LSN associated with it. Update records have both UNDO and REDO information.The previous LSN written by this transaction

12. Log Record FormatLSN TID prevLSNUndo Image(logical)Redo Image(physical)pageLSNLog RecordDisk PageEvery time a page is written, the latest LSN associated with that log record is included as the  pageLSN. Every log record has an LSN associated with it. Update records have both UNDO and REDO information.The previous LSN written by this transactionInnovation Check

13. “Physiological” LoggingREDO is PhysicalUNDO is Logical

14. REDO must be physicalAt time of crash, database may not be in an “action consistent” stateSome ops can encompass multiple non-atomic physical operationsMuch easier to replay with physical loggingINSERT VALUE X INTO TABLE YIdxX might be  reflected in an index but not the table, or vice versa, if system crashed halfway through operation.PageREDO: Insert XLogical LogCRASH!

15. UNDO must be logicalWe only UNDO some actionsImplies state when UNDOing may not be same as when the log was writtenPhysical logging (e.g., of the specific before and after images in the page) would fail

16. UNDO Example1: T1SOT2: T2SOT3: T2WB4: T1WA5: T1COMMIT~%!CRASH!This will also be the state when LSN 3 is UNDOne!Different from state when record was writtenDemands logical undo (B is on a different page!)Not needed in REDO, because we "repeat history" and replay everythingPhysical modifications  made to the database since last time will still be correct. At time LSN 3 is writtenIdxBPage iAt time LSN 4 is writtenIdxBPage iAPage i+1

17. UNDO Example1: T1SOT2: T2SOT3: T2WB4: T1WA5: T1COMMIT~%!CRASH!This will also be the state when LSN 3 is UNDOne!Different from state when record was writtenDemands logical undo (B is on a different page!)Not needed in REDO, because we "repeat history" and replay everythingPhysical modifications  made to the database since last time will still be correct. At time LSN 3 is writtenIdxBPage iAt time LSN 4 is writtenIdxBPage iAPage i+1Innovation Check

18. ARIES Normal OperationTwo key data structures:Transaction table -- list of active transactionsDirty page table -- List of pages that have been modified and not yet written to diskData structures updates as system runs:Pages asynchronously flushed to diskLog forced before flush (but not before write)Flushed are not loggedLog forced before COMMIT ack’d

19. Transaction TableAll active transactions in tablelastLSN: most recent log record  written by that transaction xactionTablelastLSNTID133

20. Dirty Page TableOne entry for each page that has been modified but not flushed to diskrecLSN: log record that first dirtied the pagedirtyPgTablepgNorecLSND8B10A11E13Recall, dirty pages are periodically flushed to disk by a background process.On flush, remove from dirtyPageTable

21. CheckpointsTaken periodically Log record that contains:the state of the dirty page table andthe transaction tableDoesn’t require pages to be flushed to disk during checkpointAllow us to limit amount of log we have to keep and replay during crash

22. ARIES ExampleLSNTypeTidPrevLSNData (Page)123WA,BCPWCWDWBWAWECRASHFlush1SOT12UP11A3UP12B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EFlush

23. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID11xactionTablepgNorecLSNdirtyPgTablexactionTabledirtyPgTableCheckpointPagepageLSNA?B?C?D?E?Disk

24. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID21xactionTablepgNorecLSNA2dirtyPgTablexactionTabledirtyPgTableCheckpointPagepageLSNA?B?C?D?E?Disk

25. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID31xactionTablepgNorecLSNA2B3dirtyPgTablexactionTabledirtyPgTableCheckpointPagepageLSNA?B?C?D?E?Disk

26. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID31xactionTablepgNorecLSNA2B3dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3

27. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID3153xactionTablepgNorecLSNA2B3dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3

28. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID6153xactionTablepgNorecLSNA2B3C6dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3

29. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID615372xactionTablepgNorecLSNA2B3C6dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3

30. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID615372xactionTablepgNorecLSNA2B3C6dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSNPagepageLSNA2B3C6D?E?

31. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID615382xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8PagepageLSNA2B3C6D?E?

32. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID615382xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8PagepageLSNA2B3C6D?E?

33. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID5382xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8PagepageLSNA2B3C6D?E?

34. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID10382xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8B10PagepageLSNA2B3C6D?E?

35. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID103112xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8B10A11PagepageLSNA2B3C6D?E?

36. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID103112xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8B10A11PagepageLSNA2B3C6D?E?

37. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID103xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8B10A11PagepageLSNA2B3C6D?E?

38. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID133xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8B10A11E13PagepageLSNA2B3C6D?E?

39. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID133xactionTablepgNorecLSNA2B3C5dirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DiskxactionTabledirtyPgTablexactionTable3-1dirtyPgTableA-2, B-3pgNorecLSND8B10A11E13PagepageLSNA2B3C6D?E?Innovation Check

40. ARIES Data Structures123WA,BCPWCWDWBWAWECRASHFlushlastLSNTID11xactionTablepgNorecLSNdirtyPgTablexactionTabledirtyPgTableCheckpointPagepageLSNA?B?C?D?E?DisklastLSNTID21lastLSNTID31lastLSNTID3153lastLSNTID133pgNorecLSNA2B3pgNorecLSNA2B3C6PagepageLSNA2B3C6D?E?pgNorecLSNpgNorecLSND8pgNorecLSND8B10pgNorecLSND8B10A11pgNorecLSND8B10A11E13xactionTable3 - 1dirtyPgTableA - 2, B - 3

41. Crash Recovery3 PhasesAnalysisRebuild data structuresDetermine winners & losersRedo“Repeat history”Why?UndoUndo Losers

42. Analysis PassGoal: reconstruct the state of the transaction table and the dirty page table at  the time the crash occurred. Play log forwardAdd and remove xactions to/from the transaction table on SOT and COMMIT/ABORTUpdate the lastLSN on writesUpdate the dirty page table as writes happen

43. State After AnalysisAfter analysis, what can we say about dirty page table and transaction table? Txn table tells us what to UNDODirty pages is a conservative list of pages that need to be REDOne Why is it conservative?Because we don’t actually know what is on disk; some pages may already have updates applied

44. Where to Begin AnalysisBeginning of log?Ok, but may require us to scan a lot of logLast checkpoint!How do we find it?Keep a pointer to the checkpoint at a well-known place on disk

45. AnalysisLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310E

46. AnalysisLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID31pgNorecLSNA2B3PagepageLSNA2B3C6D?E?xactionTabledirtyPgTableDisk

47. AnalysisLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID3153pgNorecLSNA2B3PagepageLSNA2B3C6D?E?xactionTabledirtyPgTableDisk

48. AnalysisLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID6153pgNorecLSNA2B3C6PagepageLSNA2B3C6D?E?xactionTabledirtyPgTableDisk

49. AnalysisLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID615372pgNorecLSNA2B3C6PagepageLSNA2B3C6D?E?xactionTabledirtyPgTableDisk

50. AnalysisLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID615382pgNorecLSNA2B3C6D8PagepageLSNA2B3C6D?E?xactionTabledirtyPgTableDisk

51. AnalysisLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID133pgNorecLSNA2B3C6D8E13PagepageLSNA2B3C6D?E?xactionTabledirtyPgTableDiskLosersDirty page table doesn’treflect true state on disk.Conservative: at least all previousLSNs are on disk

52. RedoWhere to begin?Checkpoint?Min(recLSN)! – earliest unflushed updateWhat to REDOEverything?SlowProblematic if using logical (escrow) loggingRedo an update UNLESS:Page is not in dirtyPgTablePage flushed prior to checkpoint, didn’t redirtyLSN < recLSNPage flushed & redirtied prior to checkpointLSN <= pageLSNPage flushed after checkpointpgNorecLSNA2B3C6D8E13dirtyPgTablePagepageLSNA2B3C6D?E?DiskOnly step that requires going to disk

53. REDO Conditions Example 2: WB3: WA4: WC5: WB6:WCFlushpgNorecLSNB5C4dirtyPgTable@ CPMin(recLSN)CheckpointRedo an update UNLESS:Page is not in dirtyPgTablePage flushed prior to checkpoint, didn’t redirtyLSN < recLSNPage flushed & redirtied prior to checkpointLSN <= pageLSNPage flushed after checkpointA/LSN 3B/LSN 2C/LSN 6PagepageLSNA3B5C6DiskFlush

54. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSNA2B3C6D8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskpgNorecLSNB3C6D8E13Flush

55. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSNB3C6D8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskpgNorecLSNC6D8E13Flush

56. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSNC6D8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskpgNorecLSND8E13Flush

57. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSND8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskFlush

58. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSND8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskpgNorecLSNB10D8E13Flush

59. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSNB10D8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskpgNorecLSNA11B10D8E13Flush

60. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSNA11B10D8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskState identical to pre-crash stateFlush

61. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSNA11B10D8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskState identical to pre-crash stateFlushInnovation Check

62. UndoWalk backwards, following prevLSNs to UNDO losersLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID133xactionTable

63. UndoLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID133xactionTableWalk backwards, following prevLSNs to UNDO losers

64. UndoLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ElastLSNTID133xactionTableWhy can we just blindly apply UNDOs?Repeated history!Walk backwards, following prevLSNs to UNDO losers

65. Redo ExampleLSNTypeTidPrevLSNData1SOT12UP12A3UP13B4CP5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310EpgNorecLSNA11B10D8E13Redo UNLESSPage is not in dirtyPgTableLSN < recLSNLSN <= pageLSNDirtyPgTablePagepageLSNA2B3C6D?E?DiskState identical to pre-crash stateFlushInnovation Check

66. “Imaginary” Case: Action Figure + Water PistolCensoredCensored

67. Study BreakNo flushes occur during the execution of these transactions. At the time of checkpoint1, the dirty page table and the transaction table are both empty. LSNTxn IDTypePage ID / ObjectPage ID / Object10Checkpoint11T1SOT12T1UPP1/A13T2SOT14T3SOT15T2UPP5/B16T2Commit17T3UPP3/C18Checkpoint19T3UPP3/C20T3Commit

68. Study BreakWhat must the status of the tables have been at the time of the crash?LSNTxn IDTypePage ID / ObjectPage ID / Object10Checkpoint11T1SOT12T1UPP1/A13T2SOT14T3SOT15T2UPP5/B16T2Commit17T3UPP3/C18Checkpoint19T3UPP3/C20T3CommitP1 12P3 17P5 15T1 12recLSN = first LSN that dirtied the pagelastLSN = most recent log record written by the transaction

69. Study Break # 2No flushes occur during the execution of these transactions. At the time of checkpoint1, the dirty page table and the transaction table are both empty. 1. At what LSN does the analysis phase begin? 2. At what LSN does the REDO phase begin? 3. What is the first LSN that is undone? LSNTxn IDTypePage ID / ObjectPage ID / Object10Checkpoint11T1SOT12T1UPP1/A13T2SOT14T3SOT15T2UPP5/B16T2Commit17T3UPP3/C18Checkpoint19T3UPP3/C20T3Commit18Min(recLSN) = 12 12

70. Truncating LogDo we have to keep log forever?What is the earliest point in the log we will ever look at? min(last checkpoint,min(recLSN))we can safely truncate anything earlier

71. Are we done?

72. Compensation Log Records (CLRs)CLR record written after each UNDOAvoid repeating UNDO workWhy?Because UNDO Is logical, and we don't check if records have already been UNDONE.  Could get into trouble if re-undid some logical operation.

73. UNDO with CLRLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310ELosers: 3

74. UNDO with CLRLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310E

75. UNDO with CLRLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310E14CLR31310

76. UNDO with CLRLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310E14CLR313E, 10

77. UNDO with CLRLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310E14CLR313E, 1015CLR314B, 5

78. UNDO with CLRLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310E14CLR313E, 1015CLR314B, 5

79. UNDO with CLRLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310E14CLR313E, 1015CLR314B, 5

80. UNDO with CLRLSNTypeTidPrevLSNData5SOT36UP13C7SOT28UP27D9EOT1610UP35B11UP28A12EOT21113UP310E14CLR313E, 1015CLR314B, 516EOT315

81. REDO with CLRREDO CLRs on crash recoveryUse REDO rules to check if updates in CLRs have already been doneAvoids repeating operational (escrow) operationsAfter processing CLR, update lastLSN field in xactionTableAllows UNDO to start from the right place, should we checkpoint while UNDOing

82.

83. ARIES/Logging RecapNO FORCE, STEAL loggingUse write ahead logging protocolMust FORCE log on COMMITPeriodically take (lightweight) checkpointsAsynchronously flush disk pages (without logging)

84. Disaster RecoveryWhat if:Disk on machine failsComputer won’t restartData center loses power…Solution: replication

85. ReplicationTypical approach: dedicated “hot standby”Kept up to date via “log shipping” – it executes operations in the log in identical order to the primaryMay have several replicas, one nearby in local data center, one further away“Half-width of a hurricane”Replicas often used for read-only queriesHave excess capacity because they are not processing xactions, just replaying log

86. Replica Fail OverOn failure, start directing queries to replicaBring up new replicaUsing, e.g., nightly backup + logComplex in practice:Have to be really sure the database failedMany organizations rely on manual failoverFailover needs to be tested frequentlyReplication load can be significant

87. Transactions SummaryTransactions provide a powerful way to isolate concurrent operations on the DBStudied two concurrency control methods two-phase locking and OCCSaw how write-ahead logging can be used to provide recoverability and roll-backNext time: distributed DBs, and distributed txns

88. Thank You