diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test index e7ea85f9f71..42f8fcfc5fb 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test @@ -1,6 +1,15 @@ # # Test of auto_increment with offset # +##################################### +# By: JBM +# Date: 2006-02-10 +# Change: NDB does not support auto inc +# in this usage. Currently there is no +# plan to implment. Skipping test when +# NDB is default engine. +##################################### +-- source include/not_ndb_default.inc -- source include/master-slave.inc eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2 auto_increment=3; diff --git a/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-test/extra/rpl_tests/rpl_row_blob.test index a1beafc32e1..13f49f1c3da 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_blob.test +++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test @@ -30,7 +30,6 @@ data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type; INSERT INTO test.t1 VALUES (NULL, NULL); INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024)); INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024)); -CHECK TABLE test.t1; --echo --echo **** Data Insert Validation Master Section test.t1 **** @@ -60,6 +59,9 @@ UPDATE t1 set data=repeat('c',17*1024) where c1 = 2; --echo SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; +# Sleep is needed for NDB to allow time for +# Injector thread to populate the bin log. +sleep 10; save_master_pos; connection slave; sync_with_master; @@ -155,6 +157,9 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) FROM test.t2 WHERE c1=1; SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) FROM test.t2 WHERE c1=2; +# Sleep is needed for NDB to allow time for +# Injector thread to populate the bin log. +sleep 15; save_master_pos; connection slave; sync_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test index 2073fb41264..0934e2d6f98 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test @@ -46,7 +46,10 @@ CALL test.p2(); SELECT release_lock("test"); SELECT * FROM test.t1; #show binlog events; - +# Added sleep for use with NDB to ensure that +# the injector thread will populate log before +# we switch to the slave. +sleep 5; sync_slave_with_master; connection slave; SELECT * FROM test.t1; diff --git a/mysql-test/include/not_ndb_default.inc b/mysql-test/include/not_ndb_default.inc new file mode 100644 index 00000000000..1c148732a47 --- /dev/null +++ b/mysql-test/include/not_ndb_default.inc @@ -0,0 +1,4 @@ +--require r/true.require +disable_query_log; +select convert(@@table_type using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE"; +enable_query_log; diff --git a/mysql-test/r/rpl_multi_delete.result b/mysql-test/r/rpl_multi_delete.result index e94a4e7947e..4831502eb88 100644 --- a/mysql-test/r/rpl_multi_delete.result +++ b/mysql-test/r/rpl_multi_delete.result @@ -4,7 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create table t1 (a int); +create table t1 (a int primary key); create table t2 (a int); insert into t1 values (1); insert into t2 values (1); diff --git a/mysql-test/r/rpl_multi_delete2.result b/mysql-test/r/rpl_multi_delete2.result index 73db9f62eb4..87abe60b268 100644 --- a/mysql-test/r/rpl_multi_delete2.result +++ b/mysql-test/r/rpl_multi_delete2.result @@ -24,7 +24,7 @@ use mysqltest_to; select * from a; i 3 -create table t1 (a int); +create table t1 (a int primary key); create table t2 (a int); insert into t1 values (1); insert into t2 values (1); diff --git a/mysql-test/r/rpl_ndb_auto_inc.result b/mysql-test/r/rpl_ndb_auto_inc.result index 9eca51ad2d9..71217442698 100644 --- a/mysql-test/r/rpl_ndb_auto_inc.result +++ b/mysql-test/r/rpl_ndb_auto_inc.result @@ -4,116 +4,94 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3; +***************** Test 1 ************************ + +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); -select * from t1; +******* Select from Master ************* + +select * from t1 ORDER BY a; a b -12 1 -22 2 -32 3 -select * from t1; +3 1 +4 2 +5 3 +******* Select from Slave ************* + +select * from t1 ORDER BY a; a b -12 1 -22 2 -32 3 +3 1 +4 2 +5 3 drop table t1; -create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam; +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); -select * from t1; +******* Select from Master ************* + +select * from t1 ORDER BY a; a b 1 1 2 2 3 3 -22 5 -32 6 -select * from t1; +5 5 +6 6 +******* Select from Slave ************* + +select * from t1 ORDER BY a; a b 1 1 2 2 3 3 -22 5 -32 6 +5 5 +6 6 drop table t1; -set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10; -show variables like "%auto_inc%"; -Variable_name Value -auto_increment_increment 100 -auto_increment_offset 10 -create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; +create table t1 (a int not null auto_increment, primary key (a)) engine=NDB; insert into t1 values (NULL),(5),(NULL); insert into t1 values (250),(NULL); -select * from t1; +******* Select from Master ************* + +select * from t1 ORDER BY a; a +1 5 -10 -110 +6 250 -310 +251 insert into t1 values (1000); set @@insert_id=400; insert into t1 values(NULL),(NULL); -select * from t1; +******* Select from Master ************* + +select * from t1 ORDER BY a; a +1 5 -10 -110 +6 250 -310 +251 400 -410 1000 -select * from t1; +1001 +******* Select from Slave ************* + +select * from t1 ORDER BY a; a +1 5 -10 -110 +6 250 -310 +251 400 -410 1000 +1001 drop table t1; -create table t1 (a int not null auto_increment, primary key (a)) engine=innodb; -insert into t1 values (NULL),(5),(NULL); -insert into t1 values (250),(NULL); -select * from t1; -a -5 -10 -110 -250 -310 -insert into t1 values (1000); -set @@insert_id=400; -insert into t1 values(NULL),(NULL); -select * from t1; -a -5 -10 -110 -250 -310 -400 -410 -1000 -select * from t1; -a -5 -10 -110 -250 -310 -400 -410 -1000 -drop table t1; -set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; -create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; +create table t1 (a int not null auto_increment, primary key (a)) engine=NDB; insert into t1 values (NULL),(5),(NULL),(NULL); -insert into t1 values (500),(NULL),(502),(NULL),(NULL); -select * from t1; +insert into t1 values (500),(NULL),(502),(NULL),(600); +******* Select from Master ************* + +select * from t1 ORDER BY a; a 1 5 @@ -123,13 +101,15 @@ a 501 502 503 -504 +600 set @@insert_id=600; insert into t1 values(600),(NULL),(NULL); -ERROR 23000: Duplicate entry '600' for key 1 +ERROR 23000: Can't write; duplicate key in table 't1' set @@insert_id=600; insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL); -select * from t1; +******* Select from Master ************* + +select * from t1 ORDER BY a; a 1 5 @@ -139,11 +119,14 @@ a 501 502 503 -504 600 +603 +604 610 611 -select * from t1; +******* Select from Slave ************* + +select * from t1 ORDER BY a; a 1 5 @@ -153,33 +136,39 @@ a 501 502 503 -504 600 +603 +604 610 611 drop table t1; -set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1; -create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; +create table t1 (a int not null auto_increment, primary key (a)) engine=NDB; insert into t1 values(2),(12),(22),(32),(42); insert into t1 values (NULL),(NULL); insert into t1 values (3),(NULL),(NULL); -select * from t1; -a -1 -3 -11 -21 -31 -select * from t1; +******* Select from Master ************* + +select * from t1 ORDER BY a; a 1 2 3 -11 +4 +5 +******* Select from Slave ************* + +** Slave should have 2, 12, 22, 32, 42 ** +** Master will have 2 but not 12, 22, 32, 42 ** + +select * from t1 ORDER BY a; +a +1 +2 +3 +4 +5 12 -21 22 -31 32 42 drop table t1; diff --git a/mysql-test/r/rpl_ndb_blob2.result b/mysql-test/r/rpl_ndb_blob2.result new file mode 100644 index 00000000000..055efffbd6a --- /dev/null +++ b/mysql-test/r/rpl_ndb_blob2.result @@ -0,0 +1,156 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +DROP TABLE IF EXISTS test.t1; +DROP TABLE IF EXISTS test.t2; +***** Table Create Section **** + +CREATE TABLE test.t1 (c1 int not null auto_increment, +data LONGBLOB, PRIMARY KEY(c1))ENGINE=#; + +**** Data Insert Section test.t1 ***** + +INSERT INTO test.t1 VALUES (NULL, NULL); +INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024)); +INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024)); + +**** Data Insert Validation Master Section test.t1 **** + +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1; +LENGTH(data) +NULL +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; +LENGTH(data) +1024 +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3; +LENGTH(data) +16384 + +**** Data Insert Validation Slave Section test.t1 **** + +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1; +LENGTH(data) +NULL +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; +LENGTH(data) +1024 +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3; +LENGTH(data) +16384 + +**** Data Update Section test.t1 **** + +UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1; +UPDATE t1 set data=repeat('c',17*1024) where c1 = 2; + +**** Data Update Validation Master Section test.t1 **** + +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1; +LENGTH(data) +18432 +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; +LENGTH(data) +17408 + +**** Data Update Validation Slave Section test.t1 **** + +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1; +LENGTH(data) +18432 +SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; +LENGTH(data) +17408 + +**** End Test Section test.t1 **** + +**** Create Table test.t2 **** + +CREATE TABLE test.t2 ( +c1 INT NOT NULL PRIMARY KEY, +c2 TEXT, +c3 INT, +c4 LONGBLOB, +KEY(c3))ENGINE=#; + +*** Setup Values For test.t2 *** +set @x0 = '01234567012345670123456701234567'; +set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0); +set @b1 = 'b1'; +set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1); +set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1); +set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1); +set @b1 = concat(@b1,@x0); +set @d1 = 'dd1'; +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); +set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); +set @b2 = 'b2'; +set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); +set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); +set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); +set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); +set @d2 = 'dd2'; +set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2); +set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2); +set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2); +set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2); + +**** Data Insert Section test.t2 ***** + +INSERT INTO test.t2 VALUES(1,@b1,111,@d1); +INSERT INTO test.t2 VALUES(2,@b2,222,@d2); + +**** Data Insert Validation Master Section test.t2 **** + +SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) +FROM test.t2 WHERE c1=1; +c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) +1 2256 b1 3000 dd1 +SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) +FROM test.t2 WHERE c1=2; +c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) +2 20000 b2 30000 dd2 + +**** Data Insert Validation Slave Section test.t2 **** + +SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) +FROM test.t2 WHERE c1=1; +c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) +1 2256 b1 3000 dd1 +SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) +FROM test.t2 WHERE c1=2; +c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) +2 20000 b2 30000 dd2 + +**** Data Update Section test.t2 **** + +UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1; +UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2; + +**** Data Update Validation Master Section test.t2 **** + +SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) +FROM test.t2 WHERE c1=1; +c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) +1 20000 b2 30000 dd2 +SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) +FROM test.t2 WHERE c1=2; +c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) +2 2256 b1 3000 dd1 + +**** Data Update Validation Slave Section test.t2 **** + +SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) +FROM test.t2 WHERE c1=1; +c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) +1 20000 b2 30000 dd2 +SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) +FROM test.t2 WHERE c1=2; +c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3) +2 2256 b1 3000 dd1 + +DROP TABLE IF EXISTS test.t1; +DROP TABLE IF EXISTS test.t2; diff --git a/mysql-test/r/rpl_ndb_disk.result b/mysql-test/r/rpl_ndb_dd_basic.result similarity index 100% rename from mysql-test/r/rpl_ndb_disk.result rename to mysql-test/r/rpl_ndb_dd_basic.result diff --git a/mysql-test/r/rpl_ndb_idempotent.result b/mysql-test/r/rpl_ndb_idempotent.result index 054ff599c23..3315e05f97e 100644 --- a/mysql-test/r/rpl_ndb_idempotent.result +++ b/mysql-test/r/rpl_ndb_idempotent.result @@ -70,3 +70,4 @@ row2 new on slave 2 SHOW SLAVE STATUS; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master 127.0.0.1 root MASTER_PORT 1 master-bin.000001 master-bin.000001 Yes Yes 0 0 None 0 No +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/rpl_ndb_sp003.result b/mysql-test/r/rpl_ndb_sp003.result new file mode 100644 index 00000000000..94f320f387b --- /dev/null +++ b/mysql-test/r/rpl_ndb_sp003.result @@ -0,0 +1,49 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +DROP PROCEDURE IF EXISTS test.p1; +DROP PROCEDURE IF EXISTS test.p2; +DROP TABLE IF EXISTS test.t1; +CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=NDBCLUSTER; +CREATE PROCEDURE test.p1() +BEGIN +INSERT INTO test.t1 VALUES (4); +SELECT get_lock("test", 100); +UPDATE test.t1 set a=a+4 WHERE a=4; +END| +CREATE PROCEDURE test.p2() +BEGIN +UPDATE test.t1 SET a=a+1; +END| +SELECT get_lock("test", 200); +get_lock("test", 200) +1 + CALL test.p1(); +CALL test.p2(); +SELECT release_lock("test"); +release_lock("test") +1 +SELECT * FROM test.t1; +a +5 +SELECT * FROM test.t1; +a +5 +DROP TABLE IF EXISTS test.t1; +CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=NDBCLUSTER; +CALL test.p2(); +CALL test.p1(); +get_lock("test", 100) +0 +SELECT * FROM test.t1; +a +8 +SELECT * FROM test.t1; +a +8 +DROP PROCEDURE IF EXISTS test.p1; +DROP PROCEDURE IF EXISTS test.p2; +DROP TABLE IF EXISTS test.t1; diff --git a/mysql-test/r/rpl_ndb_sp006.result b/mysql-test/r/rpl_ndb_sp006.result new file mode 100644 index 00000000000..6d32f26b280 --- /dev/null +++ b/mysql-test/r/rpl_ndb_sp006.result @@ -0,0 +1,45 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +create database if not exists mysqltest1; +DROP PROCEDURE IF EXISTS mysqltest1.p1; +DROP PROCEDURE IF EXISTS mysqltest1.p2; +DROP TABLE IF EXISTS mysqltest1.t2; +DROP TABLE IF EXISTS mysqltest1.t1; +CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=NDBCLUSTER; +CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=NDBCLUSTER; +CREATE PROCEDURE mysqltest1.p1() +BEGIN +DECLARE done INT DEFAULT 0; +DECLARE spa CHAR(16); +DECLARE spb INT; +DECLARE cur1 CURSOR FOR SELECT name, +(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5) +------------------------- +CALL test.p1(12); +Warnings: +Note 1051 Unknown table 't1' +SELECT * FROM test.t1; +num +12 + +< ---- Slave selects-- > +------------------------ +SELECT * FROM test.t1; +num +12 + +< ---- Master selects-- > +------------------------- +CALL test.p1(13); +SELECT * FROM test.t1; +num +13 + +< ---- Slave selects-- > +------------------------ +SELECT * FROM test.t1; +num +13 +DROP PROCEDURE IF EXISTS test.p1; +DROP TABLE IF EXISTS test.t1; diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result index e17c9b99e12..5f465dc427c 100644 --- a/mysql-test/r/rpl_ndb_sync.result +++ b/mysql-test/r/rpl_ndb_sync.result @@ -25,11 +25,13 @@ hex(c2) hex(c3) c1 0 1 BCDEF 1 0 CD 0 0 DEFGHIJKL -CREATE TEMPORARY TABLE cluster_replication.backup_info (id INT, backup_id INT) ENGINE=HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP; +DELETE FROM cluster_replication.backup_info; LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info; @the_backup_id:=backup_id +DROP TABLE cluster_replication.backup_info; UPDATE t1 SET c2=0 WHERE c3="row2"; SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; hex(c1) hex(c2) c3 diff --git a/mysql-test/r/rpl_ps.result b/mysql-test/r/rpl_ps.result index c969575de76..9127ba0d686 100644 --- a/mysql-test/r/rpl_ps.result +++ b/mysql-test/r/rpl_ps.result @@ -11,7 +11,7 @@ set @var1= "from-master-1"; execute stmt1 using @var1; set @var1= "from-master-2-'',"; execute stmt1 using @var1; -select * from t1; +SELECT * FROM t1 ORDER BY n; n from-master-1 from-master-2-'', @@ -19,7 +19,7 @@ set @var2= 'insert into t1 values (concat("from-var-", ?))'; prepare stmt2 from @var2; set @var1='from-master-3'; execute stmt2 using @var1; -select * from t1; +SELECT * FROM t1 ORDER BY n; n from-master-1 from-master-2-'', diff --git a/mysql-test/r/rpl_trigger.result b/mysql-test/r/rpl_trigger.result index 7613f2547f0..ccfa1b5e66b 100644 --- a/mysql-test/r/rpl_trigger.result +++ b/mysql-test/r/rpl_trigger.result @@ -4,6 +4,9 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t3; create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null); create table t2 (a int auto_increment, primary key (a), b int); create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null); diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 7555df95b04..14f3cca88cd 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -9,7 +9,6 @@ # Do not use any TAB characters for whitespace. # ############################################################################## - events : Test case instability - infinite locking. To be fixed. func_group : Bug#15448 func_math : Bug#15448 @@ -28,6 +27,7 @@ rpl_ddl : Bug#15963 SBR does not show "Definer" correctly rpl_ndb_auto_inc : Bug#17086 rpl_ndb_basic : Bug#16228 [IN REVIEW] rpl_ndb_relay_space : Bug#16993 +rpl_ndb_sp007 : Bug #17290 rpl_sp : Bug#16456 rpl_until : Unstable test case, bug#15886 sp-goto : GOTO is currently is disabled - will be fixed in the future diff --git a/mysql-test/t/rpl_loadfile.test b/mysql-test/t/rpl_loadfile.test index 1e7f2c5fdfe..598e89586b2 100644 --- a/mysql-test/t/rpl_loadfile.test +++ b/mysql-test/t/rpl_loadfile.test @@ -36,6 +36,9 @@ delimiter ;| CALL test.p1(); SELECT * FROM test.t1 ORDER BY blob_column; save_master_pos; +# Need to allow some time when NDB engine is used for +# the injector thread to have time to populate binlog +sleep 10; sync_slave_with_master; connection slave; SELECT * FROM test.t1 ORDER BY blob_column; diff --git a/mysql-test/t/rpl_multi_delete.test b/mysql-test/t/rpl_multi_delete.test index 2fd7b820b1a..a251cbf8833 100644 --- a/mysql-test/t/rpl_multi_delete.test +++ b/mysql-test/t/rpl_multi_delete.test @@ -1,10 +1,11 @@ source include/master-slave.inc; -create table t1 (a int); +create table t1 (a int primary key); create table t2 (a int); insert into t1 values (1); insert into t2 values (1); + delete t1.* from t1, t2 where t1.a = t2.a; save_master_pos; diff --git a/mysql-test/t/rpl_multi_delete2.test b/mysql-test/t/rpl_multi_delete2.test index c50311de363..81379d4056b 100644 --- a/mysql-test/t/rpl_multi_delete2.test +++ b/mysql-test/t/rpl_multi_delete2.test @@ -36,7 +36,7 @@ select * from a; # BUG#3461 connection master; -create table t1 (a int); +create table t1 (a int primary key); create table t2 (a int); insert into t1 values (1); diff --git a/mysql-test/t/rpl_ndb_auto_inc-master.opt b/mysql-test/t/rpl_ndb_auto_inc-master.opt deleted file mode 100644 index a8a6af19da9..00000000000 --- a/mysql-test/t/rpl_ndb_auto_inc-master.opt +++ /dev/null @@ -1 +0,0 @@ ---auto-increment-increment=10 --auto-increment-offset=2 diff --git a/mysql-test/t/rpl_ndb_auto_inc.test b/mysql-test/t/rpl_ndb_auto_inc.test index c64fe1d2f8f..a9cc9563d88 100644 --- a/mysql-test/t/rpl_ndb_auto_inc.test +++ b/mysql-test/t/rpl_ndb_auto_inc.test @@ -1,7 +1,116 @@ +# +# Test of auto_increment in CRBR +# ##################################### -# Wrapper for rpl_auto_increment.test# +# By: JBM +# Date: 2006-02-10 +# Change: Augmented test to use with cluster ##################################### --- source include/have_innodb.inc -let $engine_type=NDB; -let $engine_type2=myisam; --- source extra/rpl_tests/rpl_auto_increment.test +-- 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; diff --git a/mysql-test/t/rpl_ndb_blob2.test b/mysql-test/t/rpl_ndb_blob2.test new file mode 100644 index 00000000000..2e8f02eaf75 --- /dev/null +++ b/mysql-test/t/rpl_ndb_blob2.test @@ -0,0 +1,9 @@ +################################# +# Wrapper for rpl_row_blob.test # +# Using wrapper to share test # +# code between engine tests # +################################# +-- source include/have_ndb.inc +let $engine_type=NDBCLUSTER; +-- source extra/rpl_tests/rpl_row_blob.test + diff --git a/mysql-test/t/rpl_ndb_disk.test b/mysql-test/t/rpl_ndb_dd_basic.test similarity index 100% rename from mysql-test/t/rpl_ndb_disk.test rename to mysql-test/t/rpl_ndb_dd_basic.test diff --git a/mysql-test/t/rpl_ndb_idempotent.test b/mysql-test/t/rpl_ndb_idempotent.test index 1f14ce59a2e..bb33dfaf701 100644 --- a/mysql-test/t/rpl_ndb_idempotent.test +++ b/mysql-test/t/rpl_ndb_idempotent.test @@ -109,3 +109,8 @@ SELECT * FROM t1; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 7 8 9 16 22 23 33 SHOW SLAVE STATUS; + +connection master; +DROP TABLE IF EXISTS t1; + +# End of 5.1 Test diff --git a/mysql-test/t/rpl_ndb_sp003.test b/mysql-test/t/rpl_ndb_sp003.test new file mode 100644 index 00000000000..75ad9f0a488 --- /dev/null +++ b/mysql-test/t/rpl_ndb_sp003.test @@ -0,0 +1,9 @@ +################################# +# Wrapper for rpl_row_sp003.test# +# These tests have been wrapped # +# so the same code can be used # +# For different engines # +################################# +-- source include/have_ndb.inc +let $engine_type=NDBCLUSTER; +-- source extra/rpl_tests/rpl_row_sp003.test diff --git a/mysql-test/t/rpl_ndb_sp006.test b/mysql-test/t/rpl_ndb_sp006.test new file mode 100644 index 00000000000..590facc3648 --- /dev/null +++ b/mysql-test/t/rpl_ndb_sp006.test @@ -0,0 +1,9 @@ +################################# +# Wrapper for rpl_row_sp006.test# +# These tests have been wrapped # +# so the same code can be used # +# For different engines # +################################# +-- source include/have_ndb.inc +let $engine_type=NDBCLUSTER; +-- source extra/rpl_tests/rpl_row_sp006.test diff --git a/mysql-test/t/rpl_ndb_sp007.test b/mysql-test/t/rpl_ndb_sp007.test new file mode 100644 index 00000000000..767fd105518 --- /dev/null +++ b/mysql-test/t/rpl_ndb_sp007.test @@ -0,0 +1,9 @@ +################################# +# Wrapper for rpl_row_sp007.test# +# These tests have been wrapped # +# so the same code can be used # +# For different engines # +################################# +-- source include/have_ndb.inc +let $engine_type=NDBCLUSTER; +-- source extra/rpl_tests/rpl_row_sp007.test diff --git a/mysql-test/t/rpl_ndb_sync.test b/mysql-test/t/rpl_ndb_sync.test index 143ff6d6651..5c990cd4842 100644 --- a/mysql-test/t/rpl_ndb_sync.test +++ b/mysql-test/t/rpl_ndb_sync.test @@ -27,12 +27,13 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; # take a backup on master --exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat -CREATE TEMPORARY TABLE cluster_replication.backup_info (id INT, backup_id INT) ENGINE=HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP; +DELETE FROM cluster_replication.backup_info; LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ','; --replace_column 1 SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info; let the_backup_id=`select @the_backup_id` ; - +DROP TABLE cluster_replication.backup_info; # update a row UPDATE t1 SET c2=0 WHERE c3="row2"; SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; @@ -129,3 +130,5 @@ connection slave; reset slave; # should now contain nothing select * from cluster_replication.apply_status; + +# End 5.1 Test diff --git a/mysql-test/t/rpl_optimize.test b/mysql-test/t/rpl_optimize.test index c1dfaaf999a..80f0c052fc8 100644 --- a/mysql-test/t/rpl_optimize.test +++ b/mysql-test/t/rpl_optimize.test @@ -3,9 +3,14 @@ # You can replace OPTIMIZE by REPAIR. ##################################### # Change Author: JBM -# Change Date: 2006-01-17 -# Change: +# Change Date: 2006-02-09 +# Change: NDB does not and will not support +# OPTIMIZE for memory tables. If and when +# it does support for Disk Data, a new +# version of this test will be need. +# Skipping this test if default engine = ndb ##################################### +-- source include/not_ndb_default.inc -- source include/master-slave.inc create table t1 (a int not null auto_increment primary key, b int, key(b)); diff --git a/mysql-test/t/rpl_ps.test b/mysql-test/t/rpl_ps.test index adf39b1e4ab..4c8841d564d 100644 --- a/mysql-test/t/rpl_ps.test +++ b/mysql-test/t/rpl_ps.test @@ -1,6 +1,9 @@ # # Test of replicating user variables # +########################################################### +# 2006-02-08 By JBM added order by for use w/ NDB engine +########################################################### source include/master-slave.inc; #save_master_pos; @@ -20,7 +23,7 @@ set @var1= "from-master-1"; execute stmt1 using @var1; set @var1= "from-master-2-'',"; execute stmt1 using @var1; -select * from t1; +SELECT * FROM t1 ORDER BY n; set @var2= 'insert into t1 values (concat("from-var-", ?))'; prepare stmt2 from @var2; @@ -30,7 +33,7 @@ execute stmt2 using @var1; save_master_pos; connection slave; sync_with_master; -select * from t1; +SELECT * FROM t1 ORDER BY n; connection master; diff --git a/mysql-test/t/rpl_row_sp007_innodb-slave.opt b/mysql-test/t/rpl_row_sp007_innodb-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_row_sp007_innodb-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test index 0eca7308adc..498aa479b27 100644 --- a/mysql-test/t/rpl_trigger.test +++ b/mysql-test/t/rpl_trigger.test @@ -3,7 +3,14 @@ # Adding statement include due to Bug 12574 # TODO: Remove statement include once 12574 is patched --source include/have_binlog_format_statement.inc -source include/master-slave.inc; +--source include/master-slave.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t3; + +--enable_warnings # # #12482: Triggers has side effects with auto_increment values