mariadb/mysql-test/t/rpl_ndb_auto_inc.test

117 lines
3.1 KiB
Text
Raw Normal View History

#
# Test of auto_increment in CRBR
#
First set of rpl test updated for NDB and general test cleanup mysql-test/t/rpl000004.test: Updated test so it would not fail when MyISAM was not default Engine mysql-test/r/rpl000004.result: Updated test so it would not fail when MyISAM was not default Engine mysql-test/extra/rpl_tests/rpl000006.test: Updated test so that it would not fail when other engines are set as default engine mysql-test/r/rpl000006.result: Updated test so that it would not fail when other engines are set as default engine mysql-test/r/rpl_relay_space_myisam.result: Rename: mysql-test/r/rpl000005.result -> mysql-test/r/rpl_relay_space_myisam.result mysql-test/extra/rpl_tests/rpl_sv_relay_space.test: Had to split the test cases out to use for each engine. Reason being that the data goes applies to ndb in different order. So it has to have its own result file and I want to ensure that it is not used for other tests when ndb is used as default engine. Old test case was called rpl000009.test, so it was renamed as well to give the test more meaning mysql-test/t/rpl_relay_space_innodb-master.opt: Wrapper for old test case called rpl000009.test mysql-test/t/rpl_relay_space_innodb-slave.opt: Wrapper for old test case called rpl000009.test mysql-test/t/rpl_relay_space_innodb.test: Wrapper for old test case called rpl000009.test mysql-test/t/rpl_relay_space_myisam.test: Wrapper for old test case called rpl000009.test mysql-test/t/rpl_ndb_relay_space.test: Wrapper for old test case called rpl000009.test mysql-test/r/rpl_ndb_relay_space.result: Result file for wrapper for old test case called rpl000009.test mysql-test/r/rpl_relay_space_innodb.result: Result file for wrapper for old test case called rpl000009.test mysql-test/r/rpl_relay_space_ndb.result: Result file for wrapper for old test case called rpl000009.test mysql-test/t/rpl000009.test: updated to work when ndb is default engine mysql-test/r/rpl000009.result: updated to work when ndb is default engine mysql-test/t/rpl_LD_INFILE.test: Plan test cleanup mysql-test/r/rpl_LD_INFILE.result: Plan test cleanup mysql-test/t/rpl_auto_increment-slave.opt: needed to ensure test does not fail if default engine is specified mysql-test/extra/rpl_tests/rpl_auto_increment.test: Sorry, forgot to cleanup from debugging mysql-test/t/rpl_ndb_auto_inc.test: New wrapper for NDB mysql-test/t/rpl_ndb_auto_inc-master.opt: New wrapper for NDB mysql-test/r/rpl_ndb_auto_inc.result: New wrapper for NDB mysql-test/t/disabled.def: Updated
2006-02-03 01:59:02 +01:00
#####################################
# By: JBM
# Date: 2006-02-10
# Change: Augmented test to use with cluster
First set of rpl test updated for NDB and general test cleanup mysql-test/t/rpl000004.test: Updated test so it would not fail when MyISAM was not default Engine mysql-test/r/rpl000004.result: Updated test so it would not fail when MyISAM was not default Engine mysql-test/extra/rpl_tests/rpl000006.test: Updated test so that it would not fail when other engines are set as default engine mysql-test/r/rpl000006.result: Updated test so that it would not fail when other engines are set as default engine mysql-test/r/rpl_relay_space_myisam.result: Rename: mysql-test/r/rpl000005.result -> mysql-test/r/rpl_relay_space_myisam.result mysql-test/extra/rpl_tests/rpl_sv_relay_space.test: Had to split the test cases out to use for each engine. Reason being that the data goes applies to ndb in different order. So it has to have its own result file and I want to ensure that it is not used for other tests when ndb is used as default engine. Old test case was called rpl000009.test, so it was renamed as well to give the test more meaning mysql-test/t/rpl_relay_space_innodb-master.opt: Wrapper for old test case called rpl000009.test mysql-test/t/rpl_relay_space_innodb-slave.opt: Wrapper for old test case called rpl000009.test mysql-test/t/rpl_relay_space_innodb.test: Wrapper for old test case called rpl000009.test mysql-test/t/rpl_relay_space_myisam.test: Wrapper for old test case called rpl000009.test mysql-test/t/rpl_ndb_relay_space.test: Wrapper for old test case called rpl000009.test mysql-test/r/rpl_ndb_relay_space.result: Result file for wrapper for old test case called rpl000009.test mysql-test/r/rpl_relay_space_innodb.result: Result file for wrapper for old test case called rpl000009.test mysql-test/r/rpl_relay_space_ndb.result: Result file for wrapper for old test case called rpl000009.test mysql-test/t/rpl000009.test: updated to work when ndb is default engine mysql-test/r/rpl000009.result: updated to work when ndb is default engine mysql-test/t/rpl_LD_INFILE.test: Plan test cleanup mysql-test/r/rpl_LD_INFILE.result: Plan test cleanup mysql-test/t/rpl_auto_increment-slave.opt: needed to ensure test does not fail if default engine is specified mysql-test/extra/rpl_tests/rpl_auto_increment.test: Sorry, forgot to cleanup from debugging mysql-test/t/rpl_ndb_auto_inc.test: New wrapper for NDB mysql-test/t/rpl_ndb_auto_inc-master.opt: New wrapper for NDB mysql-test/r/rpl_ndb_auto_inc.result: New wrapper for NDB mysql-test/t/disabled.def: Updated
2006-02-03 01:59:02 +01:00
#####################################
-- source include/master-slave.inc
--echo ***************** Test 1 ************************
--echo
CREATE TABLE t1 (a INT NOT NULL auto_increment,b INT, PRIMARY KEY (a)) ENGINE=NDB auto_increment=3;
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=NDB;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where b=4;
insert into t1 values (NULL,5),(NULL,6);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
# Insert with 2 insert statements to get better testing of logging
insert into t1 values (NULL),(5),(NULL);
insert into t1 values (250),(NULL);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
insert into t1 values (1000);
set @@insert_id=400;
insert into t1 values(NULL),(NULL);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
# Insert with 2 insert statements to get better testing of logging
insert into t1 values (NULL),(5),(NULL),(NULL);
insert into t1 values (500),(NULL),(502),(NULL),(600);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
set @@insert_id=600;
# We expect a duplicate key error that we will ignore below
--error 1022
insert into t1 values(600),(NULL),(NULL);
set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
#
# Test that auto-increment works when slave has rows in the table
#
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
sync_slave_with_master;
insert into t1 values(2),(12),(22),(32),(42);
connection master;
insert into t1 values (NULL),(NULL);
insert into t1 values (3),(NULL),(NULL);
--echo ******* Select from Master *************
--echo
select * from t1 ORDER BY a;
sync_slave_with_master;
--echo ******* Select from Slave *************
--echo
--echo ** Slave should have 2, 12, 22, 32, 42 **
--echo ** Master will have 2 but not 12, 22, 32, 42 **
--echo
select * from t1 ORDER BY a;
connection master;
drop table t1;
# End cleanup
sync_slave_with_master;