Bug #33393 Didn't write conflict resolution exception table when missing reqired columns
Submitted: 20 Dec 2007 8:10 Modified: 3 Apr 2008 11:03
Reporter: li zhou Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S2 (Serious)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.1.22-ndb-6.3.7
Triage: Triaged: D2 (Serious)

[20 Dec 2007 8:10] li zhou
Description:
In testing “Same timestamp wins” conflict resolution, if we missing some required columns when creating exception table, records will not insert into exception table if conflict occurred.

How to repeat:
I test this error using MTR, and modify 2 files.

1:
./mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test, 
removing 'server_id' column when creating exception table.

==========OLD ONE=================
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, master_epoch, count)) engine ndb;
===========NEW ONE=======================
create table `test`.`t1$EX`
  (
   master_server_id int unsigned,
   master_epoch bigint unsigned,
   count int unsigned,
   a int not null,
   d varchar(9) not null,
   primary key(master_server_id, master_epoch, count)) engine ndb;
=======================================

2:
include/ndb_conflict_info.inc
Removing order by clause.

========OLD ONE========
SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
========NEW ONE========
SELECT * FROM `t1$EX`;

Then do ./mysql-test-run.pl --do-test=rpl_ndb_conflict_old
from the result, you can see nothing exist in t1$EX table.

Suggested fix:
Two suggestion:
1: Should check required column of exception table. In this case, we didn't check all required columns
2: Fill records in excetion table if conflict occurred.
[20 Dec 2007 8:57] li zhou
The same problem when we add additional columns in exception table.

---master_id is additional column
CREATE TABLE original_table$EX  (
    master_id bool, 
    server_id INT UNSIGNED,
    master_server_id INT UNSIGNED, 
    master_epoch BIGINT UNSIGNED,
    count INT UNSIGNED,
    original_table_pk_columns,
    [additional_columns,]
PRIMARY KEY
(server_id, master_server_id, master_epoch, count)
) ENGINE=NDB;
[20 Dec 2007 15:18] li zhou
Also didn't write conflict resolution exception table when missing original_table_pk_columns.
[3 Apr 2008 11:03] Sveta Smirnova
Thank you for the report.

Second case verified as described. First case seems to be fixed:

create table `test`.`t1$EX`
  (
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, master_epoch, count)) engine ndb' failed: 1072: Key column 'server_id' doesn't exist in table