Files
rikako-note/mysql/mysql底层/redo log & undo log.md
2023-01-10 21:59:13 +08:00

5 lines
794 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# redo log & undo log
* ## undo log
* undo log通常用于事务的回滚操作用来保证事务的原子性。
* 每当发生数据修改操作时update、insert、delete关于当前修改操作的相反操作会被记录到undo log中通常用于在回滚时将数据回复到修改之前的值。
* undo log默认被记录到mysql的表空间中因而对undo log进行追加时对表中页数据进行修改时也会产生redo log对undo log的追加会通过fsync操作持久化到redo log中。这样即使在一个事务尚未被提交或是回滚之前mysql服务器崩溃下次重启时也可以通过redo log恢复对数据的修改和undo log的内容回滚事务时也能将数据恢复到崩溃前尚未被事务修改的状态。