Implementation of InnoDB Chinese reference manual---multiversioning

Source: Internet
Author: User
Tags contains manual insert log reference rollback
Reference | Reference Manual | Chinese InnoDB Chinese Reference Manual---The realization of the multiversioning of Dog dog (heart sail) translation
Because InnoDB is a multiversioned database system, it must hold the advance version information of the record rows in the tablespace. This information is stored in a data structure called the rollback segment (rollback segment), which is similar to Oracle.

InnoDB adds two fields to each row of records in the database during internal processing. A 6-byte field describes the identifier of the last transaction that inserted or updated the row. The same deleted record is internally processed to update a flag bit for the row, which is used to record that it has been deleted. Each row of records also contains a 7-byte field named roll pointer (roll pointer). This pointer points to an undo log record (the Undo log) that is stored in the rollback segment. If the row is updated, the undo log contains the necessary information to reconstruct the content before it is updated.

InnoDB requires a rollback of a transaction to implement the undo operation using the information in the rollback segment. It is also used to reconstruct an earlier version of a record row for a consistent read.

The Undo log in the rollback segment is divided into insert and update undo logs. Inserting the Undo log (insert undo logs) is only required when the transaction is rolled back, and it can be discarded as soon as the transaction is committed. The update undo log (update undo logs) is also used in consistent reads, which will be discarded at the moment when there are no transactions. InnoDB assigned a snapshot of the data, and consistent read needs to update the information in the undo log to reconstruct an earlier version of the database row.

You must record the regular submission of your affairs, and the same transactions only issue consistent reads. Otherwise InnoDB cannot discard data from the update undo log, the rollback segment may increase too large to fill the entire tablespace.

The physical dimensions of the undo log records in the rollback segment are usually smaller than the corresponding inserts or updates of records. You can use this information to estimate the space needed to roll back the segment.

In the design of multiversioning, when a row is deleted with an SQL statement, the record is not immediately removed from the database. It will physically remove the corresponding record row and its index from the database only when the InnoDB discards the deleted update to undo the log record. This removal operation, called Purge, is very fast and usually executes in the same chronological order as the SQL statement that executed the deletion.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.