【COMP207 LEC13,LEC14】

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():

例子:认真分清每一个概念

​​​​​​​

                 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值