数据库
首页 > 数据库> > 数据库中数据存取、事务恢复处理、redo、undo和检查点

数据库中数据存取、事务恢复处理、redo、undo和检查点

作者:互联网

Data Access 数据存取

Transaction transfers data items between system buffer blocks and its private work-area using the following operations :

Log-Based Recovery

Concurrency Control and Recovery

Undo and Redo Operations

Recovering from Failure

When recovering after failure:

Checkpoints

Redo phase:

  1. Find last record, and set undo-list to L
  2. Scan forward from above record
    1. Whenever a record <Ti, Xj, V1, V2> or <Ti, Xj, V2> is found, redo it by writing V2 to Xj
    2. Whenever a log record is found, add Ti to undo-list
    3. Whenever a log record or is found, remove Ti from undo-list

Undo phase:

  1. Scan log backwards from end
    1. Whenever a log record <Ti, Xj, V1, V2> is found where Ti is in undo-list perform same actions as for transaction rollback:
      • perform undo by writing V1 to Xj
      • write a log record <Ti , Xj, V1>
    2. Whenever a log record is found where Ti is in undo-list
      • Write a log record
      • Remove Ti from undo-list
    3. Stop when undo-list is empty, i.e., has been found for every transaction in undo-list

标签:value,log,list,undo,record,检查点,Ti,redo
来源: https://blog.csdn.net/weixin_46054349/article/details/122274364