Bug #33411 Didn't write exception table if reqired columns in different order
Description:
In testing “Same timestamp wins” conflict resolution, if the required columns in different order when creating exception table, records will not insert into exception table if conflict occurred.
How to repeat:
I test this error using MTR, and do the following modification:
./mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test,
create table `test`.`t1$EX`
(
a int not null,
d varchar(9) not null,
server_id int unsigned,
master_server_id int unsigned,
master_epoch bigint unsigned,
count int unsigned,
primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
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:
1: If original_table_pk_columns must following the four required column(server_id, master_server_id, master_epoch, count), we need to give warning when we put pk_columns before required_columns.
2: In fact there are another problem. from manual(http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-replication-conflict-resolution.html), we know that "Additional columns may optionally be defined following these columns(required columns), but not before any of them; ". But we didn't check this order. We can create a exception table as following:
CREATE TABLE test.t1$EX (
server_id INT UNSIGNED,
master_server_id INT UNSIGNED,
master_epoch BIGINT UNSIGNED,
mycol1 INT UNSIGNED ,
mycol2 INT UNSIGNED ,
mycol3 INT UNSIGNED ,
count INT UNSIGNED, -----count should before mycol*
a INT UNSIGNED NOT NULL,
b CHAR(25) NOT NULL,
PRIMARY KEY(server_id, master_server_id, master_epoch, count)
) ENGINE=NDB;
CREATE TABLE test.t1 (
a INT UNSIGNED NOT NULL,
b CHAR(25) NOT NULL,
mycol INT UNSIGNED ,
mycol1 INT UNSIGNED ,
mycol2 INT UNSIGNED ,
mycol3 INT UNSIGNED ,
PRIMARY KEY (a, b)
) ENGINE=NDB;
So we need warning when we create this kind of table.
I think the columns order should be explicitly descript and check.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.