Bug #74538 Need to change the style of SQL apply on slave mode for Update statement
Submitted: 24 Oct 2014 7:38
Reporter: Fangxin Flou (OCA) Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:All OS:Any
Assigned to: CPU Architecture:Any
Tags: binlog, replication

[24 Oct 2014 7:38] Fangxin Flou
Description:
I want to use MySQL in mission critical situation, the inconsistent between master and slave are not allowed, but I am worring about the replication of update statement.

Support I create a table and insert one row using the following script.

create table t_item(col1 int not null primary key, col2 int);
insert into t_item values (1, 10000);

Then I do an update statement of col2.

Update t_item set col2=col2 - 1 where col1 = 1;

On Slave, how it works (we use row format replication)?

a) Update t_item set col2=col2 - 1 where col1 = 1;
b) Update t_item set col2=9999 where col1 = 1;
c) Update t_item set col2=9999 where col1 = 1 and col2=10000;

I hope that when slave apply the event, it can check that the col2 should be have an current value of 10000, else it should raise an error as (row doesn't found or mismatch) delete statement does.

But not it just execute the event as (b), so we are not able to detect the data inconsistent between master and slave in time.

Thanks.

How to repeat:
N/A

Suggested fix:
Help you give me an answer!
[3 Nov 2014 15:15] Mats Kindahl
This is a replication bug, so re-assigning to replication team.