[计算机软件及应用]斯坦福_数据库系统实现_Notes10
CS 245 Notes 10 * Logging Logical Actions Logical action typically span one block(physiological actions) Undo/redo log entry specifies undo/redo logical action Challenge: making actions idempotent Example (bad): redo insert ? key inserted multiple times! CS 245 Notes 10 * Solution: Add Log Sequence Number Log record: LSN=26 OP=insert(5,v2) into P ... 3, v1 sem lsn=25 ... 3, v1 sem lsn=26 ... 5, v2 CS 245 Notes 10 * Still Have a Problem! 3, v1 lsn=24 ... 4, v2 3, v1 lsn=25 ... 3, v1 lsn=26 ... 5, v3 T1 Del 4 T2 Ins 5 CS 245 Notes 10 * Still Have a Problem! 3, v1 lsn=24 ... 4, v2 3, v1 lsn=25 ... 3, v1 lsn=26 ... 5, v3 T1 Del 4 T2 Ins 5 3, v1 lsn=?? ... 5, v3 4, v2 undo Del 4 CS 245 Notes 10 * Still Have a Problem! 3, v1 lsn=24 ... 4, v2 3, v1 lsn=25 ... 3, v1 lsn=26 ... 5, v3 T1 Del 4 T2 Ins 5 3, v1 lsn=?? ... 5, v3 4, v2 undo Del 4 Make log entry for undo lsn=27 CS 245 Notes 10 * Compensation Log Records Log record to indicate undo (not redo) action performed Note: Compensation may not return page to exactly the initial state CS 245 Notes 10 * At Recovery: Example lsn=21 T1 a1 p1 lsn=35 T1 a2-1 p2 lsn=27 T1 a2 p2 ... ... ... ... Log: CS 245 Notes 10 * What to do with p2 (during T1 rollback)? If lsn(p2)27 then ... ? If 27 ? lsn(p2) 35 then ... ? If lsn(p2) ? 35 then ... ? Note: lsn(p2) is lsn of p copy on disk CS 245 Notes 10 * Recovery Strategy [1] Reconstruct state at time of crash Find latest valid checkpoint, Ck, and let ac be its set of active transactions Scan log from Ck to end: For each log entry [lsn, page] do:if lsn(page) lsn then redo action If log entry is start or commit, update ac CS 245 Notes 10 * Recovery Strategy [2] Abort uncommitted transactions Set ac contains transactions to abort Scan log from end to Ck : For each log entry (not undo) of an ac transaction,undo action (making log entry) For ac transactions not fully aborted,read their log entries older than Ck andundo their actions CS 245 Notes 10 * Example: What To Do Aft
您可能关注的文档
- [计算机软件及应用]如何使用ppt做科研报告.ppt
- [计算机软件及应用]安装SIEBEL的TOOLS和WEBCLIENTS.doc
- [计算机软件及应用]定点运算器的组成.ppt
- [计算机软件及应用]实训2 数据表结构设计.ppt
- [计算机软件及应用]安装过程完整记录一.doc
- [计算机软件及应用]实验三LR1分析法JAVA.doc
- [计算机软件及应用]实验 01 DHCP服务.ppt
- [计算机软件及应用]安徽省中小学学籍管理系统培训材料整合版.doc
- [计算机软件及应用]实验书.doc
- [计算机软件及应用]实验指导.ppt
- 2022年一级建造师考试《铁路工程管理与实务》真题及答案解析.docx
- 2022年一级建造师考试真题管理与实务(民航机场工程)(1).docx
- 2022年一级建造师考试《民航机场工程管理与实务》真题及答案解析真题题库.docx
- 2026年中国美容霜数据监测研究报告.docx
- 2022年一级建造师考试《民航机场工程管理与实务》真题及答案解析真题题库.docx
- 2022年一级注册建筑师建筑技术设计(作图题)考试历年真题汇总.docx
- 2022年一级建造师民航机场考试真题及答案解析(名师版).docx
- 2022年一级建造师水利水电实务真题参考答案及解析.docx
- 2022年一级建造师建筑实务考试真题及答案解析4.docx
- 2022年一级建造师市政真题及答案精编版.docx
原创力文档

文档评论(0)