Steal:允许未提交的事务写到磁盘上
Force:在事务提交之前该事务所有更新必须被写到磁盘上
No-Steal+Force
性能差,需要等待修改被写到磁盘上才能顺利commit
不需要undo,因为aborted事务不会被写到磁盘上
不需要redo,因为只有成功写入才能提交
Shadow Paging
将数据保存两份:master和shadow,事务在shadow上作修改,commit之后,shadow成为master
No-Steal+Force
Undo直接将root指向master,删掉shadow
不需要redo
Log-Based Recovery
Write-Ahead Logging (WAL)
DBMS must write to disk the log file records that correspond to changes made to a database object before it can flush that object to disk
Buffer Pool Policy: STEAL + NO-FORCE
<Ti start>
<Ti, X, V1, V2>
Ti:Transaction ID
X: Data object ID or Data object address
V1: value of X before the write (old value)
V2: value of X after the write (new value)
<Ti commit> / <Ti abort>
<Ti End>
Group Commit
WAL Buffer写满了会直接刷盘
此情况下T2需要确认T1的commit被刷盘才能commit
Physical and Logical
Physical:记录物理地址信息,更新了哪个页,页内偏移是多少,值等
Logical:记录做了什么逻辑操作,例如update
Physiological:记录更新哪个页面,但记录slot而不是偏移
Checkpoints
检查点之前所有的日志都被刷盘,所有被修改的数据块都被写入磁盘
对检查点之后commit的事务redo,对检查点之后没有commit的事务做undo。在检查点之前就完成的事务不做任何处理
Redo
Undo
undo 忽略<Ti,Xj,V2>