70 likes | 183 Vues
CS 415 Operating Systems Principles Logging and Recovery. Dr. Edward C. Cheng. Logging and Recovery. Background System Model of the Logging System A Disintegration Model of Activity Recording 2-Phase Commit Protocol Rollback Recovery.
E N D
CS 415 Operating Systems Principles Logging and Recovery Dr. Edward C. Cheng
Logging and Recovery • Background • System Model of the Logging System • A Disintegration Model of Activity Recording • 2-Phase Commit Protocol • Rollback Recovery
Fig 1. With OJS, multiple data streams can be open per AP/RM Fig 2. Data streams are managed through life-cycle states 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
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
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
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?
Next Class Security