Environment:
Master, Binlog_format from library = statement
Isolation level: RC
Main Library Session 1 |
Main Library Session 2 |
Main Library Session 3 |
From a library session |
|
|
Use test; CREATE TABLE F1 (char (2)) Engine=innodb; |
|
Begin
INSERT into T1 select 1; INSERT into T1 select 2; INSERT into T1 select 3; INSERT into T1 select 4; INSERT into T1 select 5; |
|
|
|
|
Begin
INSERT INTO T1 select ' a '; INSERT INTO T1 select ' B '; INSERT INTO T1 select ' C '; INSERT INTO T1 select ' d '; INSERT INTO T1 select ' E '; INSERT INTO T1 select ' F ';
Commit |
|
|
|
|
SELECT * from T1; +------+ | F1 | +------+ | A | | B | | C | | D | | e | | f | +------+ 650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/> |
SELECT * from T1; +------+ | F1 | +------+ | A | | B | | C | | D | | e | | f | +------+ |
Commit |
|
|
|
|
|
SELECT * from T1; +------+ | F1 | +------+ | 1 | | 2 | | 3 | | 4 | | 5 | | A | | B | | C | | D | | e | | f | +------+
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/> |
SELECT * from T1; +------+ | F1 | +------+ | A | | B | | C | | D | | e | | f | | 1 | | 2 | | 3 | | 4 | | 5 | +------+
|
You can see that in the last line, the data order of the master-slave library changes. If we do a similar update T1 set f1= ' A ' limit 4 in the main library at this time; This operation, the data from the library is completely messed up.
The following is a warnings alarm for the main library prompt when the update is performed.
master [localhost] {root} (Test) > master [localhost] {root} (test) > Show Warnings \g
1. Row ***************************
Level:note
code:1592
Message: Unsafe statement written to the binary log using statement format since Binlog_format = statement. The statement is unsafe because it uses a LIMIT clause. This is an unsafe because the set of rows included cannot be predicted.
1 row in Set (0.00 sec)
Experiment: Non-security based on statement replication "MySQL Troubleshooting guide page83-85"