LEC13、14
LOGGING in DBMS
>> UNDO without REDO
Ensure Atomicity, so to ensure durability, it can use FORCE:
1. Force the writing of updates to disk before committing
2. Force is expensive in disk operations
>> REDO without UNDO
Ensure durability, so to ensure atomicity, it can use No Steal:
1. No Steal means that uncommitted data may not overwrite committed data on disk
2. No Steal is expensive to ensure
>> Without Force / No Steal, it is hard and expensive to ensure Atomicity of UNDO and durability of REDO
>> CHECKPOINT
一段一段地checkpoint the log,这样就不用undo在Checkpoint之前的transactions了
Time 0-10(??我觉得应该是到10吧,但是ppt确实是标到8) 就是上图里logfile的部分,是在写changes to disk所以不用undo
Time 11-19 是checkpoint的部分,<CHECKPOINT> 写在Time 19 下面,用来检查数据是否从缓存传输到了disk,因为本来write()就只是把数据传输到了buffer,到了output()才传输到disk,所以checkpoint检查是否传输到了disk(), Transaction 3 直到 checkpoint 完成后才开始进行
>> ARIES checkpoints
>> Dirty reads
当事务B读取了事务A更新的内容,但这次数据的更改并没有commit并且可能在之后再次更改,于是事务B就读取了错误的值且发生了脏读
>> Cascading Rollback 级联回滚
单个事务(Ti)失败会导致一系列事务回滚(以递归的方式),如果这些事务读取了Ti所写的数据
>> Cascadeless Schedules
如果事务Ti的读写和commit都在事务Tj之前,那么就不会发生cascading rollback以及dirty read的情况
当然的事务Ti的读写和commit都在事务Tj之前,那么这个schedule肯定也是recoverable的:Cascadeless schedules are recoverable
>> Recoverable schedule
如果一个事务T1读取了事务T2的数据,那么事务T2应该先于事务T1commit
>> Strict schedules
A schedule is strict if each transaction in it reads and writes only values that were written by transactions that have already committed.
>> Strict two-phase locking
必须同时满足:Conflict-serialisability and Strict schdules
Strict locking condition (in addition to 2PL condition):
A transaction T must not release any lock (that allows T to write data 其实就是除了exclusive locks 就是在x-lock之后可以unlock,其他时候都需要满足以下条件了再unlock) until :
T has committed or aborted, and
the commit/abort log record has been written to disk
x-lock之后可以unlock():
例子:认真分清每一个概念