Description:
When we create a exception table with wrong schema for “Same timestamp wins” conflict resolution, and run MTR with the test case. We will get wrong result.
The info in exception table are not correct: some rows didn't write into exception table when conflict occurred.
How to repeat:
1: in rpl_ndb_conflict_old.test file. create a exception table like:
create table `test`.`t1$EX`
(
server_id int unsigned,
master_server_id int unsigned,
master_epoch bigint unsigned,
count int unsigned,
a int not null,
d varchar(9) not null,
primary key(server_id, master_server_id)) engine ndb;
2: Then do MTR:
./mysql_test_run.pl --do-test=rpl_ndb_conflict_old
3: We got wrong test result:
*** slave - check conflict info, change depends on calling test
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFL
ICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFL
ICT_FN_OLD";
VARIABLE_VALUE-@init_ndb_conflict_fn_old
5
SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id master_server_id master_epoch count a d
2 1 # 1 # #
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id master_server_id master_epoch count a d
2 1 # # 1 111
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
Suggested fix:
We need to check schema(primary key) or write all conflict info into exception table.