4

For a single database operation, it may affect multiple pages. For example, an insert operation may result in page split. As a result, databases don't use logical log for redo operation because of the inconsistency consideration (A operation affect two pages, only one page is flushed into data when system crashed). They always use physiological log or physical log for redo operation. But in ARIES algorithm or some databases (eg . mysql), they use logical log for undo, which operation may affect multiple pages. Why they can do this? How do they guarantee the rollback correctness when only some pages affected by the undo operation are flushed into the disk and the system crashed again?

4

1 回答 1

2

Aries 也会记录恢复操作,因此恢复期间的崩溃问题(您的最后一个问题)与撤消逻辑日志记录的问题是正交的。一个操作可能影响多个页面的事实本身并不会导致一致性问题。

我认为理论上您也可以将逻辑日志用于重做(原始 Aries 论文中的“重做和撤消操作可以在逻辑上执行”),但物理的最大优点是它是幂等的。UNDO 协议确保一个操作不会被多次执行。

逻辑日志有几个优点(与物理日志相比):

  • 节省空间
  • “能够执行逻辑撤消允许支持更高级别的并发”
于 2016-06-19T21:55:50.317 回答