Description:
This one took me a while to track down, but I think it is a good one.
Fixing rpl_auto_increment.test to work with NDB I cp it to rpl_ndb_auto_inc.test and
switch the innodb enigine for ndb. Running the test with ndb produces duplicate key
error.
So I used MyISAM to help break down the test case and results.
NOTE: This clone was pulled fresh and built this morning.
*** auto_increment_increment=100; ***
NDB Results:
! set @@session.auto_increment_increment=100;
! show variables like "%auto_inc%";
! Variable_name Value
! auto_increment_increment 100
! auto_increment_offset 1
! Create table t2 (a int not null auto_increment, primary key (a)) engine=NDB;
! insert into t2 values (NULL);
! insert into t2 values (NULL);
! select * from t2;
a
! 101
! 1
MyISAM Results:
+ set @@session.auto_increment_increment=100;
+ show variables like "%auto_inc%";
+ Variable_name Value
+ auto_increment_increment 100
+ auto_increment_offset 1
+ Create table t2 (a int not null auto_increment, primary key (a)) engine=myisam;
+ insert into t2 values (NULL);
+ insert into t2 values (NULL);
+ select * from t2;
+ a
+ 1
+ 101
**** auto_increment_offset=10;*****
NDB Results:
! set @@session.auto_increment_offset=10;
! show variables like "%auto_inc%";
! Variable_name Value
! auto_increment_increment 1
! auto_increment_offset 10
! Create table t2 (a int not null auto_increment, primary key (a)) engine=NDB;
! insert into t2 values (NULL);
! insert into t2 values (NULL);
! select * from t2;
a
! 1
! 2
MyISAM results:
+ set @@session.auto_increment_offset=10;
+ show variables like "%auto_inc%";
+ Variable_name Value
+ auto_increment_increment 1
+ auto_increment_offset 10
+ Create table t2 (a int not null auto_increment, primary key (a)) engine=myisam;
+ insert into t2 values (NULL);
+ insert into t2 values (NULL);
+ select * from t2;
+ a
+ 1
+ 2
***** Using both setting together ****
NDB Results:
Errors are (from
/home/ndbdev/jmiller/clones/mysql-5.1-new/mysql-test/var/log/mysqltest-time) :
mysqltest: At line 12: query 'insert into t2 values (NULL)' failed: 1062: Duplicate entry
'10' for key 1
(the last lines may be the most important ones)
MyISAM Results:
+ set @@session.auto_increment_increment=100;
+ set @@session.auto_increment_offset=10;
+ show variables like "%auto_inc%";
+ Variable_name Value
+ auto_increment_increment 100
+ auto_increment_offset 10
+ Create table t2 (a int not null auto_increment, primary key (a)) engine=myisam;
+ insert into t2 values (NULL);
+ insert into t2 values (NULL);
+ select * from t2;
+ a
+ 10
+ 110
How to repeat:
1) vi ./t/rpl_ndb_1.test and added test case listed below
2) touch ./r/rpl_ndb_1.result
3) run test:
./mysql-test-run --force --ndb-extra-test --with-ndbcluster-all
--mysqld=--default-storage-engine=ndb --do-test=rpl_ndb_1
Note: You can swtich out NDB and MyISAM in the ENGINE= section and comment out the
session.auto_increment_increment and auto_increment_offset as need to recreate results
above.
TEST CASE:
-- source include/master-slave.inc
--disable_warnings
DROP TABLE IF EXISTS t2;
--enable_warnings
set @@session.auto_increment_increment=100;
set @@session.auto_increment_offset=10;
show variables like "%auto_inc%";
Create table t2 (a int not null auto_increment, primary key (a)) engine=NDB;
insert into t2 values (NULL);
insert into t2 values (NULL);
select * from t2;
DROP TABLE t2;
Suggested fix:
should act just like MyISAM