Bug #42164 Maria's inability to rollback breaks replication
Submitted: 16 Jan 2009 16:30 Modified: 26 May 2010 17:51
Reporter: Sergei Golubchik Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S2 (Serious)
Version:5.1-maria, 6.0 OS:Any
Assigned to: CPU Architecture:Any

[16 Jan 2009 16:30] Sergei Golubchik
Description:
Maria now allows concurrent inserts. They can conflict (inserting the same value into a unique key) and one of them will be aborted. But as Maria cannot rollback already inserted rows (yet), this situation cannot be replicated statement-wise.

How to repeat:
.

Suggested fix:
Possible fixes:

1. if statement-based binlogging, automatically disable concurrent inserts
2. if in mixed binlogging mode, automatically go to row-based if concurrent inserts
[16 Jan 2009 20:49] Guilhem Bichot
Here's a testcase (I don't know if there are other scenarios):
in 5.1-maria (which, like 5.1-GA, uses statement-based binlogging by default), create rpl_maria.test like this:

source include/master-slave.inc;

connection master;
#
# an example of a deadlock
#
create table t1 (a int unique, b char(1)) transactional=1 engine=maria;
insert t1 values (0,"m");
send insert t1 values (1,"m"),(2,"m"),(3+0*sleep(2),"m");
connect(con_d,localhost,root,,);
--error 1062
insert t1 values (3,"d"),(2,"d");
connection master;
--error 1213
reap;
select * from t1;

save_master_pos;
connection slave;
sync_with_master;
select * from t1;

Then run it, and you will see that slave will not sync with master in the end, and in slave.err there will be
[ERROR] Slave SQL: Query caused different errors on master and slave.
   Error on master: 'Deadlock found when trying to get lock; try
restarting transaction' (1213), Error on slave: 'no error' (0). Default
database: 'test'. Query: 'insert t1 values
(1,"m"),(2,"m"),(3+0*sleep(2),"m")', Error_code: 0