MySQL two logs: Binlog:serverinnodb redo log:engine Two logs sequential consistency: otherwise, the primary and standby inconsistencies two logs: Atomicity, at the same time, there is no 2PC two-phase co-righteousness: The first phase: The second phase of the preparatory segment: submission phase Buy a House Sample prep segment: The Housing Authority confirms: the buyer: Whether the money is ready seller: Whether the house is available for sale submission sector: Government Affairs Center: Buyer: Confirm fingerprint Seller: Confirm by fingerprint----------------------------------------------------------------MySQL Log two-phase commit: Brush log prep phase: Innodb_prepare Binlog_prepare commit Phase Binlog_commit Innodb_commit Optimized state: Prep stage: Innodb_prepare Binlog_prepare//Binlog Commit Merge to this operation??? Submission Phase Innodb_commit-------------------------------------------------------------------two kinds of log exception handling: Binlog's commit log and InnoDB's commit log exist simultaneously: Prepare log with no operation Binlog, InnoDB log with prepare exists simultaneously: Innod B commit Binlog's prepare log exists, InnoDB's prepare log does not exist: RE-play InnoDB Binlog prepare log does not exist, InnoDB's prepare log exists: rollback (whichever is binlog, master-slave principle) MySQL log GP OUP commit MySQL database InnoDB storage has always been a bug, that is, when the Binlog is turned on, the group commit is not possible, the reason is to ensure that the InnoDB storage of the transaction log and Binlog log sequence consistency The mutex needs to be acquired before prepare until the commit is complete, which also disables the group commit feature mariadb completely resolves the problem with this set of submitted MySQL data synchronization1Total dump data before a point in time, and remember the location of the database log when full dump is complete2. Load the full amount of backups to MySQL3from the beginning of the full-volume dump, log to SQL executable, remote load to MySQL4by constantly applying log, let MySQL slowly catch up with the main library5. Set the user's database to read-only, continue to apply the log to MySQL until full sync MySQL flashback feature Binlog_format must be row mode download dedicated Mysqlbinlog tool temporarily supports insert update D Elete do flash back MYSQL Flashback feature operation step:1. View Binlog in position including start position and stop position confirm where to flash back to point MySQL>show Binlog Eventsinch "Xxxx.log"; 2. Execute the Flashback command Mysqlbinlog-b-v--start-position= ---stop-position=8836/home/mysql/binlog.000002|MySQL Test
MySQL 2PC two phase covariance and log flashback