Description of the three functions undo

1rollback

  1 , the beginning of a transaction, a transaction generates the above mentioned id (look for the transaction counter )

  2 , the system reads the transaction table, find a rollback (looking relatively free), read rollback segment header block (segment head there are many rows, wherein the free line found, the transaction id written into, the write Once inside a transaction begins, a tank-contained transaction transaction id , that is to say a transaction started a transaction needs to find the groove transaction id write into it) and a number of rollback pages (transaction data block) (I would like to modify a data OK, in the rows of data in the transaction need to id write in, to find one behind undo data before bloom modified block), rollpointer (rollback pointer) points to the old data in full bloom last undo block, a block before the final point to a block chain are up. When the rollback, first find the last undo block forward against read sequentially, to restore dirty block into the original data block.

 

2 , do not block readers write

  Rollpointer uses data row indicator, combining undo data, read data value before the modification, configuration read consistency to avoid dirty reads.

  To avoid dirty reads, you do not need to read write-blocking way to avoid dirty reads.

 

3 , crash recovery ( redo roll forward, Use the undo rollback uncommitted transaction rollback initiative, uncommitted transaction information is written in the transaction slot)

  Database during operation, a sudden collapse, after the database started, you need to redo roll forward, there will be a lot of uncommitted transactions also roll back, there are many uncommitted transactions in the system, and the session broke these matters, it is impossible continue completed, you need to roll back the uncommitted transaction, all information uncommitted transactions in the transaction have kept inside the slot, the slot read transaction, roll back the uncommitted transactions.

Guess you like

Origin www.cnblogs.com/5945yang/p/11265866.html