日期:2014-05-16 浏览次数:20395 次
没事看MVCC,看网上中文一堆堆的,各个说法都不一样,上google搜索了一下,发现MySQL User Guide里面有描述,还是把原文给翻译一下,供大家学习学习
请阅读本文前先参考前一篇文章,有助于理解
Because InnoDB
is a multi-versioned storage
engine, it must keep information about old versions of rows in the tablespace. This information is stored in a data structure called a rollback
segment (after an analogous data structure in Oracle).
InnoDB是一个多版本的存储引擎,所以它必须在表空间中保存row的旧的版本。这些row的旧的版本被保存在称为rollback segment的数据结构中。
Internally, InnoDB
adds three fields to
each row stored in the database. A 6-byte DB_TRX_ID
field
indicates the transaction identifier for the last transaction that inserted or updated the row. Also, a deletion is treated internally as an update where a special bit in the row is set to mark it as deleted. Each row also contains a 7-byteDB_ROLL_PTR
field
called the roll pointer. The roll pointer points to an undo log record written to the rollback segment. If the row was updated, the undo log record contains the information necessary to rebuild the content of the row before it was updated. A 6-byte DB_ROW_ID
field
contains a row ID that increases monotonically as new rows are inserted. If InnoDB
generates
a clustered index automatically, the index contains row ID values. Otherwise, the