Recovery¶
约 392 个字 21 张图片 预计阅读时间 2 分钟
Failure Classification¶


事务的物理实现¶

日志记录¶

事务恢复¶

一个事务的Commit标志:日志写入稳定存储器
A transaction is said to have committed when its commit log record is output to stable storage
- All previous log records of the transaction must have been output already
这时的修改不一定写到了磁盘
立即修改
The immediate-modification scheme allows updates of an uncommitted transaction to be made to the buffer, or the disk itself, before the transaction commits
redo undo
- redo 历史重演
- undo 需要记录日志 redo-only,完成后,记录\
- 正常执行过程中的回滚
- 系统崩溃后恢复发现没有结束
Check Point¶

fuzzy check point

事务回滚¶
补偿日志记录

缓冲区管理¶

log force 将缓冲的日志强行写到Disk

Logical Undo¶
Redo是按照物理执行


ARIES¶
- 每个记录一个日志顺序号 LSN
Typically an offset from beginning of log file to allow fast access
- 在数据页中记录一个LSN - Page LSN
- 更新发生,日志的LSN记录进去
- 防止 重复的 redo

- Log Record

-
Special redo-only log record called compensation log record (CLR) used to log actions taken during recovery that never need to be undone
- 在回滚时,有助于跳过已经回滚的日志
-
Physiological redo
-
Dirty Page Table
- 在后台周期性写回,而不是在Check Point
记录脏页
- Fuzzy Check Point
only records information about dirty pages, and does not require dirty pages to be written out at checkpoint time

流程¶

-
分析
- 得到redo的位置RedoLSN —— 至少在Check Point 之前,对脏页Table的Rec取Min
- undo-list
从Check Point 往下扫描,完善undo list - 更新脏页表

-
Redo
- 脏页表,注意是跟log record中的LSN比较
- 磁盘页
- Undo

