Experiment: Non-security based on statement replication "MySQL Troubleshooting guide page83-85"

Source: Internet
Author: User

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"

Related Article

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.