diff options
Diffstat (limited to 'mysql-test/suite/rpl_ndb')
37 files changed, 1372 insertions, 322 deletions
diff --git a/mysql-test/suite/rpl_ndb/my.cnf b/mysql-test/suite/rpl_ndb/my.cnf new file mode 100644 index 00000000000..58fec36eedd --- /dev/null +++ b/mysql-test/suite/rpl_ndb/my.cnf @@ -0,0 +1,75 @@ +!include include/default_mysqld.cnf +!include include/default_ndbd.cnf + +[cluster_config.1] +NoOfReplicas= 2 +ndbd=, +ndb_mgmd= +mysqld=, + +[cluster_config.slave] +NoOfReplicas= 1 +ndbd= +ndb_mgmd= +mysqld= + +[mysqld] +# Make all mysqlds use cluster +ndbcluster +# Turn on bin logging +log-bin= master-bin + +[mysqld.1.1] + +[mysqld.1.1] + +[mysqld.1.slave] + +# Append <testname>-slave.opt file to the list of argument used when +# starting the mysqld +#!use-slave-opt + +# Connect mysqld in the second cluster as save to first mysqld +# Hardcode the host to 127.0.0.1 until running on more +# than one host and it probably need to be masked anyway +# master-host= @mysqld.1.#host +master-host= 127.0.0.1 +master-port= @mysqld.1.1.port +master-password= @mysqld.1.1.#password +master-user= @mysqld.1.1.#user +master-connect-retry= 1 + +log-bin= slave-bin +relay-log= slave-relay-bin + +init-rpl-role= slave +log-slave-updates +master-retry-count= 10 + +# Values reported by slave when it connect to master +# and shows up in SHOW SLAVE STATUS; +report-host= 127.0.0.1 +report-port= @mysqld.1.slave.port +report-user= root + +loose-skip-innodb +skip-slave-start + +# Directory where slaves find the dumps generated by "load data" +# on the server. The path need to have constant length otherwise +# test results will vary, thus a relative path is used. +slave-load-tmpdir= ../../../tmp + +rpl-recovery-rank= @mysqld.1.slave.server-id + + +[ENV] +NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring +MASTER_MYPORT= @mysqld.1.1.port +MASTER_MYPORT1= @mysqld.2.1.port + +NDB_CONNECTSTRING_SLAVE= @mysql_cluster.slave.ndb_connectstring +SLAVE_MYPORT= @mysqld.1.slave.port +SLAVE_MYSOCK= @mysqld.1.slave.socket + +NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result index 84b60b599d8..28ca1ac43b9 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result @@ -8,6 +8,7 @@ SET storage_engine=ndb; === NDB -> MYISAM === +set @old_slave_exec_mode= @@global.slave_exec_mode; set @@global.slave_exec_mode= 'IDEMPOTENT'; CREATE TABLE mysql.ndb_apply_status ( server_id INT UNSIGNED NOT NULL, @@ -803,3 +804,4 @@ TRUNCATE TABLE t1; --- Do Cleanup -- DROP TABLE IF EXISTS t1; drop table mysql.ndb_apply_status; +set @@global.slave_exec_mode= @old_slave_exec_mode; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result index b5b3dc6b66c..b16a63ec5ad 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result @@ -180,7 +180,7 @@ Last_IO_Error <Last_IO_Error> Last_SQL_Errno <Last_SQL_Errno> Last_SQL_Error <Last_SQL_Error> set GLOBAL slave_transaction_retries=10; -START SLAVE; +include/start_slave.inc select * from t1 order by nid; nid nom prenom 1 LOCK ABC1 diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result index e4b5e9b9216..2daacb351a9 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result @@ -52,8 +52,8 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error +Last_IO_Errno # +Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error SELECT * FROM t1 ORDER BY a; @@ -95,8 +95,8 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error +Last_IO_Errno # +Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error STOP SLAVE; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result new file mode 100644 index 00000000000..b7d4a3d76db --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result @@ -0,0 +1,64 @@ +STOP SLAVE; +STOP SLAVE; +STOP SLAVE; +STOP SLAVE; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +RESET MASTER; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +RESET MASTER; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +RESET MASTER; +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +RESET MASTER; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_MYPORT,master_user='root'; +START SLAVE; +RESET SLAVE; +CHANGE MASTER TO master_host='127.0.0.1',master_port=SLAVE_MYPORT1,master_user='root'; +START SLAVE; + +*** Check server_id of mysqld servers *** +SHOW VARIABLES LIKE "server_id"; +Variable_name Value +server_id 1 +SET auto_increment_offset = 1; +SET auto_increment_increment = 2; +SHOW VARIABLES LIKE "server_id"; +Variable_name Value +server_id 1 +SET auto_increment_offset = 1; +SET auto_increment_increment = 2; +SHOW VARIABLES LIKE "server_id"; +Variable_name Value +server_id 2 +SET auto_increment_offset = 2; +SET auto_increment_increment = 2; +SHOW VARIABLES LIKE "server_id"; +Variable_name Value +server_id 2 +SET auto_increment_offset = 2; +SET auto_increment_increment = 2; + +*** Preparing data *** +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb; + +*** Basic testing *** +Insert rows via all hosts +Check data on both clusters +Comparing tables master:test.t1 and slave:test.t1 +*** Transaction testing *** +BEGIN; +BEGIN; +COMMIT; +COMMIT; +Check data on both clusters +Comparing tables master:test.t1 and slave:test.t1 +BEGIN; +BEGIN; +ROLLBACK; +ROLLBACK; +Check data on both clusters +Comparing tables master:test.t1 and slave:test.t1 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; + diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result index 18c00583df1..01f8d94da48 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result @@ -49,8 +49,8 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error +Last_IO_Errno # +Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error SELECT * FROM t1 ORDER BY a; @@ -98,7 +98,7 @@ Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error +Last_IO_Errno # +Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result index 75151f45419..a6e2144f532 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result @@ -11,8 +11,6 @@ show variables like "%character_set_ser%"; Variable_name Value character_set_server ucs2 DROP TABLE IF EXISTS t1; -create table t1 (a int) ENGINE=NDB; -drop table t1; CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', `nom` char(4) default NULL, `prenom` char(4) default NULL, @@ -25,3 +23,5 @@ nid nom prenom select * from t1 order by nid; nid nom prenom 1 XYZ1 ABC1 +==== clean up ==== +DROP TABLE t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result index 148e6247b03..7c3f331958f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result @@ -23,11 +23,11 @@ select count(*) from t2; count(*) 0 begin; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns @@ -49,11 +49,11 @@ count(*) delete from t1; delete from t2; begin; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns @@ -77,11 +77,11 @@ delete from t2; begin; insert into t2 values(3),(4); insert into t1 values(3),(4); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; Warnings: Warning 1262 Row 1 was truncated; it contained more data than there were input columns Warning 1262 Row 2 was truncated; it contained more data than there were input columns diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result index 18558c57140..5b6ca5f5097 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result @@ -4,7 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -stop slave; +include/stop_slave.inc reset master; reset slave; start slave; @@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=NDB; insert into t1 values (NULL); drop table t1; create table t1 (word char(20) not null)ENGINE=NDB; -load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines; +load data infile 'LOAD_FILE' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 @@ -117,10 +117,6 @@ Aberdeen Abernathy aberrant aberration - -let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ; - ---source include/wait_slave_status.inc select * from t1 order by 1 asc; word Aarhus @@ -193,7 +189,8 @@ Abernathy aberrant aberration flush logs; -stop slave; +include/stop_slave.inc +include/start_slave.inc create table t2 (n int)ENGINE=NDB; insert into t2 values (1); show binlog events from <binlog_start>; @@ -227,13 +224,12 @@ master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000002 # Query 1 # COMMIT show binary logs; Log_name File_size -master-bin.000001 1760 -master-bin.000002 623 -start slave; +master-bin.000001 # +master-bin.000002 # show binary logs; Log_name File_size -slave-bin.000001 1855 -slave-bin.000002 202 +slave-bin.000001 # +slave-bin.000002 # show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 @@ -308,13 +304,23 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +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 table t1(a int auto_increment primary key, b int); insert into t1 values (NULL, 1); -reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int) +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result new file mode 100644 index 00000000000..da60b0bbbbf --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result @@ -0,0 +1,457 @@ +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 TABLE tmyisam (a int) ENGINE = MYISAM; +CREATE TABLE tinnodb (a int) ENGINE = INNODB; +CREATE TABLE tndb (a int) ENGINE = NDB; +SHOW CREATE TABLE tmyisam; +Table Create Table +tmyisam CREATE TABLE `tmyisam` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE tinnodb; +Table Create Table +tinnodb CREATE TABLE `tinnodb` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE tndb; +Table Create Table +tndb CREATE TABLE `tndb` ( + `a` int(11) DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +[on master] +==== Single-engine transactions ==== +---- autocommitted ---- +SET AUTOCOMMIT = 1; +INSERT INTO tmyisam VALUES (0); +INSERT INTO tinnodb VALUES (1); +INSERT INTO tndb VALUES (2); +---- committed with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (3); +INSERT INTO tmyisam VALUES (4); +COMMIT; +BEGIN; +INSERT INTO tinnodb VALUES (5); +INSERT INTO tinnodb VALUES (6); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (7); +INSERT INTO tndb VALUES (8); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (9); +INSERT INTO tmyisam VALUES (10); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tinnodb VALUES (11); +INSERT INTO tinnodb VALUES (12); +ROLLBACK; +BEGIN; +INSERT INTO tndb VALUES (13); +INSERT INTO tndb VALUES (14); +ROLLBACK; +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tmyisam VALUES (15); +INSERT INTO tmyisam VALUES (16); +COMMIT; +INSERT INTO tinnodb VALUES (17); +INSERT INTO tinnodb VALUES (18); +COMMIT; +INSERT INTO tndb VALUES (19); +INSERT INTO tndb VALUES (20); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tmyisam VALUES (21); +INSERT INTO tmyisam VALUES (22); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tinnodb VALUES (23); +INSERT INTO tinnodb VALUES (24); +ROLLBACK; +INSERT INTO tndb VALUES (25); +INSERT INTO tndb VALUES (26); +ROLLBACK; +SET AUTOCOMMIT = 1; +==== MyISAM + InnoDB ==== +---- committed with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (27); +INSERT INTO tinnodb VALUES (28); +COMMIT; +BEGIN; +INSERT INTO tinnodb VALUES (29); +INSERT INTO tmyisam VALUES (30); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (31); +INSERT INTO tinnodb VALUES (32); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tinnodb VALUES (33); +INSERT INTO tmyisam VALUES (34); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tmyisam VALUES (35); +INSERT INTO tinnodb VALUES (36); +COMMIT; +INSERT INTO tinnodb VALUES (37); +INSERT INTO tmyisam VALUES (38); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tmyisam VALUES (39); +INSERT INTO tinnodb VALUES (40); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tinnodb VALUES (41); +INSERT INTO tmyisam VALUES (42); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SET AUTOCOMMIT = 1; +==== MyISAM + NDB ==== +---- committed with BEGIN---- +BEGIN; +INSERT INTO tmyisam VALUES (43); +INSERT INTO tndb VALUES (44); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (45); +INSERT INTO tmyisam VALUES (46); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (47); +INSERT INTO tndb VALUES (48); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tndb VALUES (49); +INSERT INTO tmyisam VALUES (50); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tmyisam VALUES (51); +INSERT INTO tndb VALUES (52); +COMMIT; +INSERT INTO tndb VALUES (53); +INSERT INTO tmyisam VALUES (54); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tmyisam VALUES (55); +INSERT INTO tndb VALUES (56); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tndb VALUES (57); +INSERT INTO tmyisam VALUES (58); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SET AUTOCOMMIT = 1; +==== InnoDB + NDB ==== +---- committed with BEGIN ---- +BEGIN; +INSERT INTO tinnodb VALUES (59); +INSERT INTO tndb VALUES (60); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (61); +INSERT INTO tinnodb VALUES (62); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tinnodb VALUES (63); +INSERT INTO tndb VALUES (64); +ROLLBACK; +BEGIN; +INSERT INTO tndb VALUES (65); +INSERT INTO tinnodb VALUES (66); +ROLLBACK; +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tinnodb VALUES (67); +INSERT INTO tndb VALUES (68); +COMMIT; +INSERT INTO tndb VALUES (69); +INSERT INTO tinnodb VALUES (70); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tinnodb VALUES (71); +INSERT INTO tndb VALUES (72); +ROLLBACK; +INSERT INTO tndb VALUES (73); +INSERT INTO tinnodb VALUES (74); +ROLLBACK; +SET AUTOCOMMIT = 1; +==== MyISAM + InnoDB + NDB ==== +---- committed with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (75); +INSERT INTO tinnodb VALUES (76); +INSERT INTO tndb VALUES (77); +COMMIT; +BEGIN; +INSERT INTO tmyisam VALUES (78); +INSERT INTO tndb VALUES (79); +INSERT INTO tinnodb VALUES (80); +COMMIT; +BEGIN; +INSERT INTO tinnodb VALUES (81); +INSERT INTO tmyisam VALUES (82); +INSERT INTO tndb VALUES (83); +COMMIT; +BEGIN; +INSERT INTO tinnodb VALUES (84); +INSERT INTO tndb VALUES (85); +INSERT INTO tmyisam VALUES (86); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (87); +INSERT INTO tmyisam VALUES (88); +INSERT INTO tinnodb VALUES (89); +COMMIT; +BEGIN; +INSERT INTO tndb VALUES (90); +INSERT INTO tinnodb VALUES (91); +INSERT INTO tmyisam VALUES (92); +COMMIT; +---- rolled back with BEGIN ---- +BEGIN; +INSERT INTO tmyisam VALUES (93); +INSERT INTO tinnodb VALUES (94); +INSERT INTO tndb VALUES (95); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tmyisam VALUES (96); +INSERT INTO tndb VALUES (97); +INSERT INTO tinnodb VALUES (98); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tinnodb VALUES (99); +INSERT INTO tmyisam VALUES (100); +INSERT INTO tndb VALUES (101); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tinnodb VALUES (102); +INSERT INTO tndb VALUES (103); +INSERT INTO tmyisam VALUES (104); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tndb VALUES (105); +INSERT INTO tmyisam VALUES (106); +INSERT INTO tinnodb VALUES (107); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO tndb VALUES (108); +INSERT INTO tinnodb VALUES (109); +INSERT INTO tmyisam VALUES (110); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +---- committed with AUTOCOMMIT = 0 ---- +SET AUTOCOMMIT = 0; +INSERT INTO tmyisam VALUES (111); +INSERT INTO tinnodb VALUES (112); +INSERT INTO tndb VALUES (113); +COMMIT; +INSERT INTO tmyisam VALUES (114); +INSERT INTO tndb VALUES (115); +INSERT INTO tinnodb VALUES (116); +COMMIT; +INSERT INTO tinnodb VALUES (117); +INSERT INTO tmyisam VALUES (118); +INSERT INTO tndb VALUES (119); +COMMIT; +INSERT INTO tinnodb VALUES (120); +INSERT INTO tndb VALUES (121); +INSERT INTO tmyisam VALUES (122); +COMMIT; +INSERT INTO tndb VALUES (123); +INSERT INTO tmyisam VALUES (124); +INSERT INTO tinnodb VALUES (125); +COMMIT; +INSERT INTO tndb VALUES (126); +INSERT INTO tinnodb VALUES (127); +INSERT INTO tmyisam VALUES (128); +COMMIT; +---- rolled back with AUTOCOMMIT = 0 ---- +INSERT INTO tmyisam VALUES (129); +INSERT INTO tinnodb VALUES (130); +INSERT INTO tndb VALUES (131); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tmyisam VALUES (132); +INSERT INTO tndb VALUES (133); +INSERT INTO tinnodb VALUES (134); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tinnodb VALUES (135); +INSERT INTO tmyisam VALUES (136); +INSERT INTO tndb VALUES (137); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tinnodb VALUES (138); +INSERT INTO tndb VALUES (139); +INSERT INTO tmyisam VALUES (140); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tndb VALUES (141); +INSERT INTO tmyisam VALUES (142); +INSERT INTO tinnodb VALUES (143); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +INSERT INTO tndb VALUES (144); +INSERT INTO tinnodb VALUES (145); +INSERT INTO tmyisam VALUES (146); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SET AUTOCOMMIT = 1; +==== Verify the result ==== +SELECT * FROM tmyisam ORDER BY a; +a +0 +3 +4 +9 +10 +15 +16 +21 +22 +27 +30 +31 +34 +35 +38 +39 +42 +43 +46 +47 +50 +51 +54 +55 +58 +75 +78 +82 +86 +88 +92 +93 +96 +100 +104 +106 +110 +111 +114 +118 +122 +124 +128 +129 +132 +136 +140 +142 +146 +SELECT * FROM tinnodb ORDER BY a; +a +1 +5 +6 +17 +18 +28 +29 +36 +37 +59 +62 +67 +70 +76 +80 +81 +84 +89 +91 +112 +116 +117 +120 +125 +127 +SELECT * FROM tndb ORDER BY a; +a +2 +7 +8 +19 +20 +44 +45 +52 +53 +60 +61 +68 +69 +77 +79 +83 +85 +87 +90 +113 +115 +119 +121 +123 +126 +[on slave] +Comparing tables master:test.tmyisam and slave:test.tmyisam +Comparing tables master:test.tinnodb and slave:test.tinnodb +Comparing tables master:test.tndb and slave:test.tndb +==== Clean up ==== +[on master] +DROP TABLE tmyisam, tinnodb, tndb; +[on slave] diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result index 760114f3639..f8eb5ebdd89 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result @@ -26,10 +26,10 @@ stop slave; SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ; @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) -106 master-bin1.000001 +106 master-bin.000001 CHANGE MASTER TO master_port=<MASTER_PORT1>, -master_log_file = 'master-bin1.000001', +master_log_file = 'master-bin.000001', master_log_pos = 106 ; start slave; INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); @@ -52,4 +52,6 @@ c1 c2 c3 row3 C 3 row4 D 4 row5 E 5 +==== clean up ==== +DROP TABLE t1; STOP SLAVE; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result index 56bb31e329d..7f75bdedd65 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result @@ -5,8 +5,8 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; CREATE TABLE t1 (word CHAR(20) NOT NULL); -LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1; -LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1; +LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; +LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1; SELECT * FROM t1 ORDER BY word LIMIT 10; word Aarhus diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result index f2a1ba410b9..c788893e055 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result @@ -25,12 +25,8 @@ hex(c2) hex(c3) c1 0 1 BCDEF 1 0 CD 0 0 DEFGHIJKL -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM test.backup_info; -@the_backup_id:=backup_id -<the_backup_id> +CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; UPDATE t1 SET c2=0 WHERE c3="row2"; SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result deleted file mode 100644 index bbd0a873dc8..00000000000 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result +++ /dev/null @@ -1,110 +0,0 @@ -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 TABLE tmyisam (a int) ENGINE = MYISAM; -CREATE TABLE tinnodb (a int) ENGINE = INNODB; -CREATE TABLE tndb (a int) ENGINE = NDB; -SHOW CREATE TABLE tmyisam; -Table Create Table -tmyisam CREATE TABLE `tmyisam` ( - `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW CREATE TABLE tinnodb; -Table Create Table -tinnodb CREATE TABLE `tinnodb` ( - `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE tndb; -Table Create Table -tndb CREATE TABLE `tndb` ( - `a` int(11) DEFAULT NULL -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 -==== Test 1: Non-XA Engines ==== ---- on master --- -SET AUTOCOMMIT = 1; -INSERT INTO tndb VALUES (1); -INSERT INTO tmyisam VALUES (1); -BEGIN; -INSERT INTO tndb VALUES (2); -INSERT INTO tndb VALUES (3); -COMMIT; -BEGIN; -INSERT INTO tmyisam VALUES (2); -INSERT INTO tmyisam VALUES (3); -COMMIT; -BEGIN; -INSERT INTO tndb VALUES (4); -INSERT INTO tmyisam VALUES (4); -COMMIT; -BEGIN; -INSERT INTO tndb VALUES (5); -INSERT INTO tndb VALUES (6); -ROLLBACK; -BEGIN; -INSERT INTO tmyisam VALUES (5); -INSERT INTO tmyisam VALUES (6); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -BEGIN; -INSERT INTO tndb VALUES (7); -INSERT INTO tmyisam VALUES (7); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -SELECT * FROM tndb ORDER BY a; -a -1 -2 -3 -4 -SELECT * FROM tmyisam ORDER BY a; -a -1 -2 -3 -4 -5 -6 -7 ---- on slave --- -SELECT * FROM tndb ORDER BY a; -a -1 -2 -3 -4 -SELECT * FROM tmyisam ORDER BY a; -a -1 -2 -3 -4 -5 -6 -7 -==== Test 2: Master crash before writing XID event on XA engine ==== ---- on master --- -INSERT INTO tinnodb VALUES (1); -SELECT * FROM tinnodb ORDER BY a; -a -1 ---- on slave --- -STOP SLAVE; -SELECT "" AS Slave_IO_State; -Slave_IO_State - -SELECT "" AS Last_SQL_Error; -Last_SQL_Error - -SELECT "" AS Last_IO_Error; -Last_IO_Error - -SELECT * FROM tinnodb ORDER BY a; -a ---- on master --- -DROP TABLE tmyisam, tinnodb, tndb; -DROP TABLE tmyisam, tinnodb, tndb; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result index aa9d3132cbb..409397cb3d1 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result @@ -423,10 +423,10 @@ a b c **** On Master **** DELETE FROM t1; **** Resetting master and slave **** -STOP SLAVE; +include/stop_slave.inc RESET SLAVE; RESET MASTER; -START SLAVE; +include/start_slave.inc **** On Master **** INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); **** On Master **** diff --git a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def index ebc99feeac6..694f7098980 100644 --- a/mysql-test/suite/rpl_ndb/t/disabled.def +++ b/mysql-test/suite/rpl_ndb/t/disabled.def @@ -10,7 +10,7 @@ # ############################################################################## -rpl_ndb_circular : Bug#33849 COMMIT event missing in cluster circular replication. -rpl_ndb_circular_simplex : Bug#33849 COMMIT event missing in cluster circular replication. +rpl_ndb_circular : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash +rpl_ndb_circular_simplex : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test index 43ad901d746..3b075808481 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test @@ -12,6 +12,14 @@ -- connection slave -- source include/have_innodb.inc + +# Remove any old ndb_apply_status from slaves datadir +let $datadir= `SELECT @@datadir`; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.frm; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.ndb; + set @@global.slave_exec_mode= 'IDEMPOTENT'; CREATE TABLE mysql.ndb_apply_status ( server_id INT UNSIGNED NOT NULL, diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test index b19116ffd78..560efec255b 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test @@ -11,6 +11,14 @@ -- source include/master-slave.inc -- connection slave + +# Remove any old ndb_apply_status from slaves datadir +let $datadir= `SELECT @@datadir`; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.frm; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.ndb; + set @@global.slave_exec_mode= 'IDEMPOTENT'; CREATE TABLE mysql.ndb_apply_status ( server_id INT UNSIGNED NOT NULL, diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test index 1657a6902ba..e954c72fd1d 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test @@ -5,6 +5,7 @@ # to other engines (innodb, myisam), see also rpl_ndb_2other.test ############################################################## --source include/have_binlog_format_mixed_or_row.inc +--source include/have_ndb.inc --source include/ndb_master-slave.inc # On master use NDB as storage engine. diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test index 67e8f7cea42..41f91d62dec 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test @@ -17,6 +17,15 @@ SET storage_engine=ndb; --echo === NDB -> MYISAM === --echo connection slave; + +# Remove any old ndb_apply_status from slaves datadir +let $datadir= `SELECT @@datadir`; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.frm; +--error 0,1 +remove_file $datadir/mysql/ndb_apply_status.ndb; + +set @old_slave_exec_mode= @@global.slave_exec_mode; set @@global.slave_exec_mode= 'IDEMPOTENT'; CREATE TABLE mysql.ndb_apply_status ( server_id INT UNSIGNED NOT NULL, @@ -38,3 +47,4 @@ SET storage_engine=innodb; connection slave; drop table mysql.ndb_apply_status; +set @@global.slave_exec_mode= @old_slave_exec_mode; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test index ce951f01212..b90e6fff8bc 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test @@ -73,7 +73,7 @@ CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL, # # create "BANK" application # ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT # # start main loop @@ -88,9 +88,9 @@ while ($2) # # start "BANK" application # ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT & ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT & ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT & +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT & +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT & +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT & # # let the "BANK" run for a while @@ -114,10 +114,10 @@ CREATE DATABASE BANK; # start by taking a backup on master --connection master RESET MASTER; ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT # there is no neat way to find the backupid, this is a hack to find it... ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat CREATE TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM mysql.backup_info; LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ','; @@ -128,8 +128,8 @@ let the_backup_id=`select @the_backup_id`; # restore on slave, first check that nothing is there --connection slave ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT # # now setup replication to continue from last epoch @@ -150,7 +150,7 @@ while ($1) --replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error> SHOW SLAVE STATUS; STOP SLAVE; - --exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT + --exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT START SLAVE; --dec $1 } diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test index c7d8db8ef8b..5903cd223ad 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test @@ -184,22 +184,21 @@ set GLOBAL slave_transaction_retries=1; --echo **** On Master **** UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; +--echo **** On Slave **** # Wait for deadlock to be detected. # When detected, the slave will stop, so we just wait for it to stop. +connection slave; source include/wait_for_slave_sql_to_stop.inc; # Replication should have stopped, since max retries were not enough. # verify with show slave status ---connection slave ---echo **** On Slave **** --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error> --query_vertical SHOW SLAVE STATUS; # now set max retries high enough to succeed, and start slave again set GLOBAL slave_transaction_retries=10; -START SLAVE; -source include/wait_for_slave_to_start.inc; +source include/start_slave.inc; # Wait for deadlock to be detected and retried. # We want to wait until at least one retry has been made, but before # the slave stops. currently, there is no safe way to do that: we diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test index c1a48d08c53..2cc46e2420e 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test @@ -5,11 +5,13 @@ --connection slave RESET MASTER; + --connection master --replace_result $SLAVE_MYPORT SLAVE_PORT --eval CHANGE MASTER TO master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root" START SLAVE; + # create the table on the "slave" --connection slave CREATE TABLE t1 (a int key, b int) ENGINE=ndb; @@ -37,13 +39,15 @@ INSERT INTO t1 VALUES (2,3); --connection slave SELECT * FROM t1 ORDER BY a; #SELECT * FROM t2 ORDER BY a; ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # +# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36 +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical show slave status; # connect to master and ensure data it there. --connection master SELECT * FROM t1 ORDER BY a; #SELECT * FROM t2 ORDER BY a; ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # +# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36 +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # --query_vertical show slave status; # stop replication on "master" as not to replicate diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf new file mode 100644 index 00000000000..b1b010ef0f3 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf @@ -0,0 +1,31 @@ +!include ../my.cnf + +[mysqld.1.1] +server-id= 1 +log-bin + +[mysqld.2.1] +server-id= 1 +log-bin + +[mysqld.1.slave] +server-id= 2 +log-bin +skip-slave-start + +[mysqld.2.slave] +server-id= 2 +master-host= 127.0.0.1 +master-port= @mysqld.2.1.port +master-password= @mysqld.2.1.#password +master-user= @mysqld.2.1.#user +master-connect-retry= 1 +init-rpl-role= slave +log-bin +skip-slave-start +ndb_connectstring= @mysql_cluster.slave.ndb_connectstring + +[ENV] + +SLAVE_MYPORT1= @mysqld.2.slave.port +SLAVE_MYSOCK1= @mysqld.2.slave.socket diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test new file mode 100644 index 00000000000..8721e85780d --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test @@ -0,0 +1,172 @@ +############################################################# +# Author: Serge Kozlov <skozlov@mysql.com> +# Date: 03/17/2008 +# Purpose: Testing cluster circular replication based on two +# independent channels between two clusters +############################################################# +--source include/have_ndb.inc +--source include/ndb_master-slave_2ch.inc +--source include/have_binlog_format_mixed_or_row.inc +--echo + +# Check server_id and set auto_increment_* variables +--echo *** Check server_id of mysqld servers *** +--connection master +SHOW VARIABLES LIKE "server_id"; +SET auto_increment_offset = 1; +SET auto_increment_increment = 2; +--connection master1 +SHOW VARIABLES LIKE "server_id"; +SET auto_increment_offset = 1; +SET auto_increment_increment = 2; +--connection slave +SHOW VARIABLES LIKE "server_id"; +SET auto_increment_offset = 2; +SET auto_increment_increment = 2; +--connection slave1 +SHOW VARIABLES LIKE "server_id"; +SET auto_increment_offset = 2; +SET auto_increment_increment = 2; +--echo + +# Preparing data. +--echo *** Preparing data *** +--connection master +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb; + +let $wait_binlog_event= CREATE TABLE t1; +--source include/wait_for_binlog_event.inc +--connection master1 +--source include/wait_for_binlog_event.inc +--connection slave +--source include/wait_for_binlog_event.inc +--connection slave1 +--source include/wait_for_binlog_event.inc +--echo + +# +# Testing +# + +--echo *** Basic testing *** +# insert data via all hosts +--echo Insert rows via all hosts +--disable_query_log +let $counter= 10; +while ($counter) { + --connection master + INSERT INTO t1(b,c) VALUES('master',1); + --connection master1 + INSERT INTO t1(b,c) VALUES('master1',1); + --connection slave + INSERT INTO t1(b,c) VALUES('slave',1); + --connection slave1 + INSERT INTO t1(b,c) VALUES('slave1',1); + dec $counter; +} +--connection master +--enable_query_log + +# Wait replication between clusters +let $wait_condition= SELECT COUNT(*)=40 FROM t1 WHERE c = 1; +--source include/wait_condition.inc +--connection slave +--source include/wait_condition.inc + +# Check data +--echo Check data on both clusters +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; + +source include/diff_tables.inc; + +--echo *** Transaction testing *** +# Start transaction for one mysqld and do mass of inserts for other. +# Do it for for both clusters + +--connection master +BEGIN; +--connection slave1 +BEGIN; +let $counter= 100; +--connection master +--disable_query_log +while ($counter) { + --connection master + INSERT INTO t1(b,c) VALUES('master',2); + --connection master1 + INSERT INTO t1(b,c) VALUES('master1',2); + --connection slave + INSERT INTO t1(b,c) VALUES('slave',2); + --connection slave1 + INSERT INTO t1(b,c) VALUES('slave1',2); + dec $counter; +} +--connection master +--enable_query_log +COMMIT; +--connection slave1 +COMMIT; + +# Wait replication between clusters +--connection master +let $wait_condition= SELECT COUNT(*)=400 FROM t1 WHERE c = 2; +--source include/wait_condition.inc +--connection slave +--source include/wait_condition.inc + +--echo Check data on both clusters +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; + +source include/diff_tables.inc; + +# Start transaction and then roll back + +--connection master +BEGIN; +--connection slave1 +BEGIN; +let $counter= 100; +--connection master +--disable_query_log +while ($counter) { + --connection master + INSERT INTO t1(b,c) VALUES('master',3); + --connection master1 + INSERT INTO t1(b,c) VALUES('master1',3); + --connection slave + INSERT INTO t1(b,c) VALUES('slave',3); + --connection slave1 + INSERT INTO t1(b,c) VALUES('slave1',3); + dec $counter; +} +--connection master +--enable_query_log +ROLLBACK; +--connection slave1 +ROLLBACK; + +# Wait replication between clusters +--connection master +let $wait_condition= SELECT COUNT(*)=200 FROM t1 WHERE c = 3; +--source include/wait_condition.inc +--connection slave +--source include/wait_condition.inc + +--echo Check data on both clusters +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; + +source include/diff_tables.inc; + +# Clean up +--connection master +DROP TABLE t1; +--connection slave +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +--echo + +# End of test 5.1 diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test index fcbff1392f4..d5ddfc2b739 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test @@ -49,7 +49,7 @@ sync_with_master; # Check that there is no error in replication --replace_result $SLAVE_MYPORT SLAVE_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # query_vertical SHOW SLAVE STATUS; # Check that we have the data on the master @@ -76,5 +76,5 @@ SELECT * FROM t1 ORDER BY a; # Check that there is no error in replication --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # query_vertical SHOW SLAVE STATUS; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test index be7fd1acd2e..8d5ad334766 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test @@ -22,10 +22,7 @@ show variables like "%character_set_ser%"; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings -create table t1 (a int) ENGINE=NDB; -drop table t1; ---connection master CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', `nom` char(4) default NULL, `prenom` char(4) default NULL, @@ -35,8 +32,12 @@ CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', INSERT INTO t1 VALUES(1,"XYZ1","ABC1"); select * from t1 order by nid; ---sync_slave_with_master +sync_slave_with_master; # connect to slave and ensure data it there. ---connection slave +connection slave; select * from t1 order by nid; +--echo ==== clean up ==== +connection master; +DROP TABLE t1; +sync_slave_with_master; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test index 2f2414ba578..fcc2928c5e2 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test @@ -21,8 +21,8 @@ select count(*) from t2; connection master; begin; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; rollback; select count(*) from t1; @@ -35,8 +35,8 @@ connection master; delete from t1; delete from t2; begin; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; rollback; select count(*) from t1; @@ -51,8 +51,8 @@ delete from t2; begin; insert into t2 values(3),(4); insert into t1 values(3),(4); -load data infile '../std_data_ln/rpl_loaddata.dat' into table t2; -load data infile '../std_data_ln/rpl_loaddata.dat' into table t1; +load data infile '../../../std_data/rpl_loaddata.dat' into table t2; +load data infile '../../../std_data/rpl_loaddata.dat' into table t1; rollback; select count(*) from t1; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test index a695eee3221..75fe2688b4a 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test @@ -62,5 +62,5 @@ CREATE TABLE SERVER # # start "load" application # ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT ---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT +--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt index 627becdbfb5..627becdbfb5 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test new file mode 100644 index 00000000000..14b76722fa6 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test @@ -0,0 +1,450 @@ +# ==== Purpose ==== +# +# Tests that transactions containing multiple table types are +# replicated correctly to the slave. +# +# This test was previously part of rpl_ndb_transactions. +# +# +# ==== Method ==== +# +# Try all combinations of the following: +# - Committed/rollback transactions. +# - Transactions started by AUTOCOMMIT = 0 or BEGIN. +# - Transactions using myisam, innodb, or ndb tables, or combinations +# of them. For combinations, we use the engines in all possible +# orders. +# For single-engine transactions, we also try with AUTOCOMMIT = 1. +# +# +# ==== Related bugs ==== +# +# BUG#26395: if crash during autocommit update to transactional table on master, slave fails + + +source include/have_ndb.inc; +source include/ndb_master-slave.inc; +source include/have_innodb.inc; + +CREATE TABLE tmyisam (a int) ENGINE = MYISAM; +CREATE TABLE tinnodb (a int) ENGINE = INNODB; +CREATE TABLE tndb (a int) ENGINE = NDB; + +SHOW CREATE TABLE tmyisam; +SHOW CREATE TABLE tinnodb; +SHOW CREATE TABLE tndb; + + +--echo [on master] + + +--echo ==== Single-engine transactions ==== + +--echo ---- autocommitted ---- + +SET AUTOCOMMIT = 1; + +INSERT INTO tmyisam VALUES (0); +INSERT INTO tinnodb VALUES (1); +INSERT INTO tndb VALUES (2); + +--echo ---- committed with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (3); +INSERT INTO tmyisam VALUES (4); +COMMIT; + +BEGIN; +INSERT INTO tinnodb VALUES (5); +INSERT INTO tinnodb VALUES (6); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (7); +INSERT INTO tndb VALUES (8); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (9); +INSERT INTO tmyisam VALUES (10); +ROLLBACK; + +BEGIN; +INSERT INTO tinnodb VALUES (11); +INSERT INTO tinnodb VALUES (12); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (13); +INSERT INTO tndb VALUES (14); +ROLLBACK; + + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tmyisam VALUES (15); +INSERT INTO tmyisam VALUES (16); +COMMIT; + +INSERT INTO tinnodb VALUES (17); +INSERT INTO tinnodb VALUES (18); +COMMIT; + +INSERT INTO tndb VALUES (19); +INSERT INTO tndb VALUES (20); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tmyisam VALUES (21); +INSERT INTO tmyisam VALUES (22); +ROLLBACK; + +INSERT INTO tinnodb VALUES (23); +INSERT INTO tinnodb VALUES (24); +ROLLBACK; + +INSERT INTO tndb VALUES (25); +INSERT INTO tndb VALUES (26); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== MyISAM + InnoDB ==== + +--echo ---- committed with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (27); +INSERT INTO tinnodb VALUES (28); +COMMIT; + +BEGIN; +INSERT INTO tinnodb VALUES (29); +INSERT INTO tmyisam VALUES (30); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (31); +INSERT INTO tinnodb VALUES (32); +ROLLBACK; + +BEGIN; +INSERT INTO tinnodb VALUES (33); +INSERT INTO tmyisam VALUES (34); +ROLLBACK; + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tmyisam VALUES (35); +INSERT INTO tinnodb VALUES (36); +COMMIT; + +INSERT INTO tinnodb VALUES (37); +INSERT INTO tmyisam VALUES (38); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tmyisam VALUES (39); +INSERT INTO tinnodb VALUES (40); +ROLLBACK; + +INSERT INTO tinnodb VALUES (41); +INSERT INTO tmyisam VALUES (42); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== MyISAM + NDB ==== + +--echo ---- committed with BEGIN---- + +BEGIN; +INSERT INTO tmyisam VALUES (43); +INSERT INTO tndb VALUES (44); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (45); +INSERT INTO tmyisam VALUES (46); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (47); +INSERT INTO tndb VALUES (48); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (49); +INSERT INTO tmyisam VALUES (50); +ROLLBACK; + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tmyisam VALUES (51); +INSERT INTO tndb VALUES (52); +COMMIT; + +INSERT INTO tndb VALUES (53); +INSERT INTO tmyisam VALUES (54); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tmyisam VALUES (55); +INSERT INTO tndb VALUES (56); +ROLLBACK; + +INSERT INTO tndb VALUES (57); +INSERT INTO tmyisam VALUES (58); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== InnoDB + NDB ==== + +--echo ---- committed with BEGIN ---- + +BEGIN; +INSERT INTO tinnodb VALUES (59); +INSERT INTO tndb VALUES (60); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (61); +INSERT INTO tinnodb VALUES (62); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tinnodb VALUES (63); +INSERT INTO tndb VALUES (64); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (65); +INSERT INTO tinnodb VALUES (66); +ROLLBACK; + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tinnodb VALUES (67); +INSERT INTO tndb VALUES (68); +COMMIT; + +INSERT INTO tndb VALUES (69); +INSERT INTO tinnodb VALUES (70); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tinnodb VALUES (71); +INSERT INTO tndb VALUES (72); +ROLLBACK; + +INSERT INTO tndb VALUES (73); +INSERT INTO tinnodb VALUES (74); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== MyISAM + InnoDB + NDB ==== + +--echo ---- committed with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (75); +INSERT INTO tinnodb VALUES (76); +INSERT INTO tndb VALUES (77); +COMMIT; + +BEGIN; +INSERT INTO tmyisam VALUES (78); +INSERT INTO tndb VALUES (79); +INSERT INTO tinnodb VALUES (80); +COMMIT; + +BEGIN; +INSERT INTO tinnodb VALUES (81); +INSERT INTO tmyisam VALUES (82); +INSERT INTO tndb VALUES (83); +COMMIT; + +BEGIN; +INSERT INTO tinnodb VALUES (84); +INSERT INTO tndb VALUES (85); +INSERT INTO tmyisam VALUES (86); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (87); +INSERT INTO tmyisam VALUES (88); +INSERT INTO tinnodb VALUES (89); +COMMIT; + +BEGIN; +INSERT INTO tndb VALUES (90); +INSERT INTO tinnodb VALUES (91); +INSERT INTO tmyisam VALUES (92); +COMMIT; + +--echo ---- rolled back with BEGIN ---- + +BEGIN; +INSERT INTO tmyisam VALUES (93); +INSERT INTO tinnodb VALUES (94); +INSERT INTO tndb VALUES (95); +ROLLBACK; + +BEGIN; +INSERT INTO tmyisam VALUES (96); +INSERT INTO tndb VALUES (97); +INSERT INTO tinnodb VALUES (98); +ROLLBACK; + +BEGIN; +INSERT INTO tinnodb VALUES (99); +INSERT INTO tmyisam VALUES (100); +INSERT INTO tndb VALUES (101); +ROLLBACK; + +BEGIN; +INSERT INTO tinnodb VALUES (102); +INSERT INTO tndb VALUES (103); +INSERT INTO tmyisam VALUES (104); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (105); +INSERT INTO tmyisam VALUES (106); +INSERT INTO tinnodb VALUES (107); +ROLLBACK; + +BEGIN; +INSERT INTO tndb VALUES (108); +INSERT INTO tinnodb VALUES (109); +INSERT INTO tmyisam VALUES (110); +ROLLBACK; + +--echo ---- committed with AUTOCOMMIT = 0 ---- + +SET AUTOCOMMIT = 0; + +INSERT INTO tmyisam VALUES (111); +INSERT INTO tinnodb VALUES (112); +INSERT INTO tndb VALUES (113); +COMMIT; + +INSERT INTO tmyisam VALUES (114); +INSERT INTO tndb VALUES (115); +INSERT INTO tinnodb VALUES (116); +COMMIT; + +INSERT INTO tinnodb VALUES (117); +INSERT INTO tmyisam VALUES (118); +INSERT INTO tndb VALUES (119); +COMMIT; + +INSERT INTO tinnodb VALUES (120); +INSERT INTO tndb VALUES (121); +INSERT INTO tmyisam VALUES (122); +COMMIT; + +INSERT INTO tndb VALUES (123); +INSERT INTO tmyisam VALUES (124); +INSERT INTO tinnodb VALUES (125); +COMMIT; + +INSERT INTO tndb VALUES (126); +INSERT INTO tinnodb VALUES (127); +INSERT INTO tmyisam VALUES (128); +COMMIT; + +--echo ---- rolled back with AUTOCOMMIT = 0 ---- + +INSERT INTO tmyisam VALUES (129); +INSERT INTO tinnodb VALUES (130); +INSERT INTO tndb VALUES (131); +ROLLBACK; + +INSERT INTO tmyisam VALUES (132); +INSERT INTO tndb VALUES (133); +INSERT INTO tinnodb VALUES (134); +ROLLBACK; + +INSERT INTO tinnodb VALUES (135); +INSERT INTO tmyisam VALUES (136); +INSERT INTO tndb VALUES (137); +ROLLBACK; + +INSERT INTO tinnodb VALUES (138); +INSERT INTO tndb VALUES (139); +INSERT INTO tmyisam VALUES (140); +ROLLBACK; + +INSERT INTO tndb VALUES (141); +INSERT INTO tmyisam VALUES (142); +INSERT INTO tinnodb VALUES (143); +ROLLBACK; + +INSERT INTO tndb VALUES (144); +INSERT INTO tinnodb VALUES (145); +INSERT INTO tmyisam VALUES (146); +ROLLBACK; + +SET AUTOCOMMIT = 1; + + +--echo ==== Verify the result ==== + +SELECT * FROM tmyisam ORDER BY a; +SELECT * FROM tinnodb ORDER BY a; +SELECT * FROM tndb ORDER BY a; + +--echo [on slave] +--sync_slave_with_master + +let $diff_table_1=master:test.tmyisam; +let $diff_table_2=slave:test.tmyisam; +source include/diff_tables.inc; + +let $diff_table_1=master:test.tinnodb; +let $diff_table_2=slave:test.tinnodb; +source include/diff_tables.inc; + +let $diff_table_1=master:test.tndb; +let $diff_table_2=slave:test.tndb; +source include/diff_tables.inc; + + +--echo ==== Clean up ==== + +--echo [on master] +connection master; +DROP TABLE tmyisam, tinnodb, tndb; + +--echo [on slave] +sync_slave_with_master; + +source include/master-slave-end.inc; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test index 1ee9aaf5372..eb128cfa2ce 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test @@ -64,4 +64,9 @@ sync_slave_with_master; connection slave; SELECT * FROM t1 ORDER BY c3; +--echo ==== clean up ==== +connection server2; +DROP TABLE t1; +sync_slave_with_master; + STOP SLAVE; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test index 116f0879ca0..88572c3e9a2 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test @@ -39,8 +39,8 @@ SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; # we should have no tables SHOW TABLES; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT # # BUG#11960 @@ -50,8 +50,8 @@ SHOW TABLES; DROP DATABASE ndbsynctest; CREATE DATABASE ndbsynctest; USE ndbsynctest; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT +--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT # continue test SHOW TABLES; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt deleted file mode 100644 index 5411960b4aa..00000000000 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb --debug=d,do_not_write_xid diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test deleted file mode 100644 index 5700e0fa422..00000000000 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test +++ /dev/null @@ -1,131 +0,0 @@ -# Tests that transactions are replicated correctly, with various -# combinations of non-transactional and transactional non-XA tables. -# Also tests that an XA transaction where the master crashes just -# before writing the XID log event is executed correctly. See below -# for implementation details. - -source include/ndb_master-slave.inc; -source include/have_ndb.inc; -source include/have_debug.inc; - -CREATE TABLE tmyisam (a int) ENGINE = MYISAM; -CREATE TABLE tinnodb (a int) ENGINE = INNODB; -CREATE TABLE tndb (a int) ENGINE = NDB; - -SHOW CREATE TABLE tmyisam; -SHOW CREATE TABLE tinnodb; -SHOW CREATE TABLE tndb; - - ---echo ==== Test 1: Non-XA Engines ==== -# Test that everything works fine with non-XA engines. We just try -# all ways to do transactions involving ndb and/or myisam, with -# rollback or commit. - ---echo --- on master --- - -SET AUTOCOMMIT = 1; - -INSERT INTO tndb VALUES (1); -INSERT INTO tmyisam VALUES (1); - -BEGIN; -INSERT INTO tndb VALUES (2); -INSERT INTO tndb VALUES (3); -COMMIT; - -BEGIN; -INSERT INTO tmyisam VALUES (2); -INSERT INTO tmyisam VALUES (3); -COMMIT; - -BEGIN; -INSERT INTO tndb VALUES (4); -INSERT INTO tmyisam VALUES (4); -COMMIT; - -BEGIN; -INSERT INTO tndb VALUES (5); -INSERT INTO tndb VALUES (6); -ROLLBACK; - -BEGIN; -INSERT INTO tmyisam VALUES (5); -INSERT INTO tmyisam VALUES (6); -#--warning 1196 -ROLLBACK; - -BEGIN; -INSERT INTO tndb VALUES (7); -INSERT INTO tmyisam VALUES (7); -#--warning 1196 -ROLLBACK; - -SELECT * FROM tndb ORDER BY a; -SELECT * FROM tmyisam ORDER BY a; - ---echo --- on slave --- ---sync_slave_with_master -SELECT * FROM tndb ORDER BY a; -SELECT * FROM tmyisam ORDER BY a; - - ---echo ==== Test 2: Master crash before writing XID event on XA engine ==== -# We now want to test the following scenario, to verify that BUG#26395 -# has been fixed: - -# "master and slave have a transactional table that uses XA. Master -# has AUTOCOMMIT on and executes a statement (in this case an -# INSERT). Master crashes just before writing the XID event." - -# In this scenario, master will roll back, so slave should not execute -# the statement, and slave should roll back later when master is -# restarted. - -# However, we want the master to be alive so that we are sure it -# replicates the statement to the slave. So in the test case, we must -# therefore not crash the master. Instead, we fake the crash by just -# not writing the XID event to the binlog. This is done by the -# --debug=d,do_not_write_xid flag in the .opt file. - -# So, unlike if the master had crashed, the master *will* execute the -# statement. But the slave should not execute it. Hence, after the -# first test is executed, the expected result on master is a table -# with one row, and on slave a table with no rows. - -# To simulate the slave correctly, we wait until everything up to the -# XID is replicated. We cannot sync_slave_with_master, because that -# would wait for the transaction to end. Instead, we wait for -# "sufficiently long time". Then we stop the slave. - -# Note: since this puts the master binlog in an inconsistent state, -# this should be the last test of the file. - ---echo --- on master --- ---connection master - -INSERT INTO tinnodb VALUES (1); -SELECT * FROM tinnodb ORDER BY a; - ---echo --- on slave --- ---connection slave ---sleep 3 -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; -let $tmp= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1); -eval SELECT "$tmp" AS Slave_IO_State; -let $tmp= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); -eval SELECT "$tmp" AS Last_SQL_Error; -let $tmp= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1); -eval SELECT "$tmp" AS Last_IO_Error; -SELECT * FROM tinnodb ORDER BY a; - -# Clean up. We cannot do it on master and replicate over, because -# master binlog is in a bad state after last test. So we do it both on -# master and on slave. ---echo --- on master --- -connection master; -DROP TABLE tmyisam, tinnodb, tndb; - -connection slave; -DROP TABLE tmyisam, tinnodb, tndb; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test index 5067722bb79..543393b980d 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test @@ -4,8 +4,8 @@ -- source include/ndb_master-slave.inc --exec echo Running ndbapi_simple_dual ---exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" $SLAVE_MYSOCK "localhost:$NDBCLUSTER_PORT_SLAVE" >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "$NDB_CONNECTSTRING" $SLAVE_MYSOCK "$NDB_CONNECTSTRING_SLAVE" >> $NDB_EXAMPLES_OUTPUT --exec echo Running mgmapi_logevent ---exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" "localhost:$NDBCLUSTER_PORT_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT +--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" "$NDB_CONNECTSTRING_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT |