The Undo log rollback log is saved in the shared tablespace ibdata1 file, and as the business keeps running, the ibdata1 file becomes larger and more difficult and complex to reclaim (shrinking space size), you must first mysqldump-a the entire library and then delete the data directory, Then re-initialize the installation, and finally the whole library of SQL file import, using this method to Ibdata1 file recovery.
In MySQL5.6, the Undo log rollback logs can be separated out into a separate table space, please refer to: http://hcymysql.blog.51cto.com/5223301/973450, but the drawback is that you cannot reclaim (shrink) the size of the space. Online shrinkage is not supported until MySQL5.7.
The Innodb_undo_log_truncate parameter is set to 1, which enables the online recycle (shrink) Undo log log file to support dynamic settings. The innodb_undo_tablespaces parameter must be greater than or equal to 2, that is, when you recycle (shrink) An undo log log file, make sure that another undo log is available. Innodb_undo_logs:undo the number of rollback segments, at least greater than or equal to 35, by default of 128. Innodb_max_undo_log_size: When this threshold is exceeded (the default is 1G), the truncate recovery (contraction) action is triggered, and the truncate space is reduced to 10M. Innodb_purge_rseg_truncate_frequency: Controls how often the undo log is recycled (shrunk). The Undo log space does not shrink until its rollback segment is released, and to increase the frequency of releasing the rollback interval, the Innodb_purge_rseg_truncate_frequency setting value is lowered.
Verification process:
For a 1 million sbtest table, update the whole table 4 times, such as:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4E/53/wKioL1RgdBOBBGZbAAJUujfvDjw197.jpg "title=" cc.jpg "alt=" Wkiol1rgdbobbgzbaajuujfvdjw197.jpg "/>
You will then find the undo log space growing rapidly, such as:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4E/55/wKiom1Rgc-mhJySsAADkvtWGqPo071.jpg "title=" aa.jpg "alt=" Wkiom1rgc-mhjyssaadkvtwgqpo071.jpg "/>
Then use Sysbench to do the stress test, let the database run, observe the error log, will automatically put the undo log space for recycling (contraction), such as:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4E/54/wKioL1RgdRGzrwuGAAPmBf1k6iA093.jpg "title=" bb.jpg "alt=" Wkiol1rgdrgzrwugaapmbf1k6ia093.jpg "/>
Again by observing the physical file, the default 10M size has been recycled.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4E/55/wKioL1RgdYDhQQhEAADjmLNYACA460.jpg "title=" dd.jpg "alt=" Wkiol1rgdydhqqheaadjmlnyaca460.jpg "/>
Summarize:
This feature reduces disk space usage (local tyrants, of course), and speeds up the xtrabackup hot backup.
This article is from the "Spring Yang Technical column" blog, please be sure to keep this source http://hcymysql.blog.51cto.com/5223301/1575050
MySQL5.7 can reclaim (shrink) Undo Log Rollback Log physical file space