CS 415 Operating Systems Principles Logging and Recovery
-
Upload
colin-neal -
Category
Documents
-
view
31 -
download
2
description
Transcript of CS 415 Operating Systems Principles Logging and Recovery
OCT Research Lab Edward C. Cheng
CS 415
1
CS 415Operating Systems Principles
Logging and Recovery
Dr. Edward C. Cheng
OCT Research Lab Edward C. Cheng
CS 415
2
Logging and Recovery
• Background
• System Model of the Logging System
• A Disintegration Model of Activity Recording
• 2-Phase Commit Protocol
• Rollback Recovery
OCT Research Lab Edward C. Cheng
CS 415
3
System Model of Journaling
• Tightly coupled with the resource manager or application program
• Open Journal idea introduced in the 90’s separating journaling from the RM or AP
Fig 1. With OJS, multiple data streams can be open per AP/RM
Fig 2. Data streams are managed through life-cycle states
OCT Research Lab Edward C. Cheng
CS 415
4
A Disintegration Model of Activity Recording
• Events that are not dependent on each other can have their activity records disintegrated thus provide various optimization opportunities
OCT Research Lab Edward C. Cheng
CS 415
5
2-Phase Commit (2PC) Protocol
• A protocol to support Atomicity Behavior in distributive environment
• A coordinator (parent transaction) issues a request to commit to all subordinates (children transactions)
• Each subordinate writes a journal record to ensure ability to roll-forward and rollback in case of a crash
• Each subordinate responds to the parent with a ready-to-commit or abort
• If all subordinates are ready-to-commit, the coordinate issues a commit event to all subordinates (otherwise an abort event)
• All subordinates commit their works
OCT Research Lab Edward C. Cheng
CS 415
6
Recovery
• Checkpoint – the point where all committed changes are flushed out to data pages
• Undo record: enough information to rollback the change (insert, delete, update) – mainly before and after images
• Redo record: enough information to re-execute un-flushed changes
• Upon commit, only make sure to flush out the log records so that upon recovery (after a crash), the system can redo the changes
• Changes might be flushed out to disk before commit. Locks are used to protect us from dirty read. Undo records help to undo uncommitted transactions upon recovery
• Question: what if you have changes that cannot be undone?
OCT Research Lab Edward C. Cheng
CS 415
7
Next Class
Security