Bug #33438 Result not correct if creating exception table with wrong schema
Submitted: 21 Dec 2007 5:30 Modified: 3 Apr 2008 14:05
Reporter: li zhou Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.1.22-ndb-6.3.7
Triage: Triaged: D3 (Medium)

[21 Dec 2007 5:30] li zhou
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.
[3 Apr 2008 14:05] Sveta Smirnova
Thank you for the report.

Verified with results like in bug #33440