diff options
Diffstat (limited to 'mysql-test/suite/rpl_ndb')
99 files changed, 11162 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result new file mode 100644 index 00000000000..f8ec4624062 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result @@ -0,0 +1,855 @@ +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; +SET storage_engine=ndb; +--- Doing pre test cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 1 Basic testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly -- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 1 Basic testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 2 partition RANGE testing -- +--- Do setup -- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY RANGE (YEAR(t)) +(PARTITION p0 VALUES LESS THAN (1901), +PARTITION p1 VALUES LESS THAN (1946), +PARTITION p2 VALUES LESS THAN (1966), +PARTITION p3 VALUES LESS THAN (1986), +PARTITION p4 VALUES LESS THAN (2005), +PARTITION p5 VALUES LESS THAN MAXVALUE); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Show table on slave -- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 2 partition RANGE testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 3 partition LIST testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY LIST(id) +(PARTITION p0 VALUES IN (2, 4), +PARTITION p1 VALUES IN (42, 142)); +--- Test 3 Alter to add partition --- +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 3 partition LIST testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 4 partition HASH testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY HASH( YEAR(t) ) +PARTITIONS 4; +--- show that tables have been created correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 4 partition HASH testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 5 partition by key testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)) +PARTITION BY KEY() +PARTITIONS 4; +--- Show that tables on master are ndbcluster tables --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Show that tables on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still right type --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 5 key partition testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result new file mode 100644 index 00000000000..8611d83f3f3 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result @@ -0,0 +1,855 @@ +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; +SET storage_engine=ndb; +--- Doing pre test cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 1 Basic testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly -- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 1 Basic testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 2 partition RANGE testing -- +--- Do setup -- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY RANGE (YEAR(t)) +(PARTITION p0 VALUES LESS THAN (1901), +PARTITION p1 VALUES LESS THAN (1946), +PARTITION p2 VALUES LESS THAN (1966), +PARTITION p3 VALUES LESS THAN (1986), +PARTITION p4 VALUES LESS THAN (2005), +PARTITION p5 VALUES LESS THAN MAXVALUE); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Show table on slave -- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 2 partition RANGE testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 3 partition LIST testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY LIST(id) +(PARTITION p0 VALUES IN (2, 4), +PARTITION p1 VALUES IN (42, 142)); +--- Test 3 Alter to add partition --- +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 3 partition LIST testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 4 partition HASH testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +PARTITION BY HASH( YEAR(t) ) +PARTITIONS 4; +--- show that tables have been created correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`t`,`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 4 partition HASH testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 5 partition by key testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), +bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)) +PARTITION BY KEY() +PARTITIONS 4; +--- Show that tables on master are ndbcluster tables --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Show that tables on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still right type --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc TEXT; +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` text, + `bc` char(255) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 5 key partition testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result new file mode 100644 index 00000000000..422379d4f55 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result @@ -0,0 +1,40 @@ +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 TABLE IF EXISTS test.t1; +CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=NDB; +INSERT INTO test.t1 VALUES(1,UUID(),UUID()); +create procedure test.p1() +begin +INSERT INTO test.t1 VALUES(2,UUID(),UUID()); +INSERT INTO test.t1 VALUES(3,UUID(),UUID()); +end| +CALL test.p1(); +create function test.fn1(x int) +returns int +begin +insert into t1 values (4+x,UUID(),UUID()); +insert into t1 values (5+x,UUID(),UUID()); +return 0; +end| +select fn1(0); +fn1(0) +0 +create table t2 (a int); +insert into t2 values(fn1(2)); +SHOW CREATE TABLE test.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL DEFAULT '0', + `blob_column` longblob, + `vchar_column` varchar(100) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +DROP PROCEDURE test.p1; +DROP FUNCTION test.fn1; +DROP TABLE test.t1; +DROP TABLE test.t2; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result new file mode 100644 index 00000000000..dd4cc90a75f --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result @@ -0,0 +1,170 @@ +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; +***************** 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 Master ************* + +select * from t1 ORDER BY a; +a b +3 1 +4 2 +5 3 +******* Select from Slave ************* + +select * from t1 ORDER BY a; +a b +3 1 +4 2 +5 3 +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); +******* Select from Master ************* + +select * from t1 ORDER BY a; +a b +1 1 +2 2 +3 3 +5 5 +6 6 +******* Select from Slave ************* + +select * from t1 ORDER BY a; +a b +1 1 +2 2 +3 3 +5 5 +6 6 +drop table t1; +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 Master ************* + +select * from t1 ORDER BY a; +a +1 +5 +6 +250 +251 +insert into t1 values (1000); +set @@insert_id=400; +insert into t1 values(NULL),(NULL); +******* Select from Master ************* + +select * from t1 ORDER BY a; +a +1 +5 +6 +250 +251 +400 +401 +1000 +******* Select from Slave ************* + +select * from t1 ORDER BY a; +a +1 +5 +6 +250 +251 +400 +401 +1000 +drop table t1; +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),(600); +******* Select from Master ************* + +select * from t1 ORDER BY a; +a +1 +5 +6 +7 +500 +501 +502 +503 +600 +set @@insert_id=600; +insert into t1 values(600),(NULL),(NULL); +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 Master ************* + +select * from t1 ORDER BY a; +a +1 +5 +6 +7 +500 +501 +502 +503 +600 +610 +611 +******* Select from Slave ************* + +select * from t1 ORDER BY a; +a +1 +5 +6 +7 +500 +501 +502 +503 +600 +610 +611 +drop table t1; +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 Master ************* + +select * from t1 ORDER BY a; +a +1 +2 +3 +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 +22 +32 +42 +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_bank.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_bank.result new file mode 100644 index 00000000000..06c005427d1 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_bank.result @@ -0,0 +1,120 @@ +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 BANK; +DROP DATABASE BANK; +CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin; +USE BANK; +CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL, +ACCOUNT_TYPE INT UNSIGNED NOT NULL, +BALANCE INT UNSIGNED NOT NULL, +DEPOSIT_COUNT INT UNSIGNED NOT NULL, +DEPOSIT_SUM INT UNSIGNED NOT NULL, +WITHDRAWAL_COUNT INT UNSIGNED NOT NULL, +WITHDRAWAL_SUM INT UNSIGNED NOT NULL, +PURGED INT UNSIGNED NOT NULL, +PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE)) +ENGINE = NDB; +CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL, +OWNER INT UNSIGNED NOT NULL, +BALANCE INT UNSIGNED NOT NULL, +ACCOUNT_TYPE INT UNSIGNED NOT NULL, +PRIMARY KEY USING HASH (ACCOUNT_ID)) +ENGINE = NDB; +CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL, +ACCOUNT INT UNSIGNED NOT NULL, +ACCOUNT_TYPE INT UNSIGNED NOT NULL, +OTHER_ACCOUNT INT UNSIGNED NOT NULL, +TRANSACTION_TYPE INT UNSIGNED NOT NULL, +TIME BIGINT UNSIGNED NOT NULL, +AMOUNT INT UNSIGNED NOT NULL, +PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT)) +ENGINE = NDB; +CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL, +VALUE BIGINT UNSIGNED NOT NULL, +PRIMARY KEY USING HASH (SYSTEM_VALUES_ID)) +ENGINE = NDB; +CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL, +DESCRIPTION CHAR(64) NOT NULL, +PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID)) +ENGINE = NDB; +STOP SLAVE; +RESET SLAVE; +CREATE DATABASE IF NOT EXISTS BANK; +DROP DATABASE BANK; +CREATE DATABASE BANK; +RESET MASTER; +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 ','; +SELECT @the_backup_id:=backup_id FROM mysql.backup_info; +@the_backup_id:=backup_id +<the_backup_id> +SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; +@the_epoch:=MAX(epoch) +<the_epoch> +SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) +FROM mysql.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1; +@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) +<the_pos> master-bin.000001 +CHANGE MASTER TO +master_log_file = 'master-bin.000001', +master_log_pos = <the_pos>; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +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 +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> +STOP SLAVE; +START SLAVE; +use test; +create table t1 (a int primary key) engine=ndb; +insert into t1 values (1); +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result new file mode 100644 index 00000000000..37217bf0ad1 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result @@ -0,0 +1,227 @@ +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` ( `nid` int(11) NOT NULL default '0', +`nom` char(4) default NULL, +`prenom` char(4) default NULL, +PRIMARY KEY (`nid`)) +ENGINE=ndbcluster DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES(1,"XYZ1","ABC1"); +select * from t1 order by nid; +nid nom prenom +1 XYZ1 ABC1 +select * from t1 order by nid; +nid nom prenom +1 XYZ1 ABC1 +delete from t1; +INSERT INTO t1 VALUES(1,"XYZ2","ABC2"); +select * from t1 order by nid; +nid nom prenom +1 XYZ2 ABC2 +select * from t1 order by nid; +nid nom prenom +1 XYZ2 ABC2 +delete from t1; +insert into t1 values(1,"AA", "AA"); +insert into t1 values(2,"BB", "BB"); +insert into t1 values(3,"CC", "CC"); +insert into t1 values(4,"DD", "DD"); +begin; +delete from t1 where nid = 1; +insert into t1 values (1,"A2", "A2"); +update t1 set nom="B2" where nid = 2; +delete from t1 where nid = 2; +update t1 set nom = "D2" where nid = 4; +delete from t1 where nid = 4; +insert into t1 values (4, "D3", "D3"); +update t1 set nom = "D4" where nid = 4; +insert into t1 values (5, "EE", "EE"); +delete from t1 where nid = 5; +commit; +select * from t1 order by 1; +nid nom prenom +1 A2 A2 +3 CC CC +4 D4 D3 +select * from t1 order by 1; +nid nom prenom +1 A2 A2 +3 CC CC +4 D4 D3 +DROP table t1; +CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', +`nom` char(4) default NULL, +`prenom` char(4) default NULL) +ENGINE=ndbcluster DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES(1,"XYZ1","ABC1"),(2,"AAA","BBB"),(3,"CCC","DDD"); +select * from t1 order by nid; +nid nom prenom +1 XYZ1 ABC1 +2 AAA BBB +3 CCC DDD +select * from t1 order by nid; +nid nom prenom +1 XYZ1 ABC1 +2 AAA BBB +3 CCC DDD +delete from t1 where nid = 2; +INSERT INTO t1 VALUES(4,"EEE","FFF"); +select * from t1 order by nid; +nid nom prenom +1 XYZ1 ABC1 +3 CCC DDD +4 EEE FFF +select * from t1 order by nid; +nid nom prenom +1 XYZ1 ABC1 +3 CCC DDD +4 EEE FFF +UPDATE t1 set nid=nid+1; +UPDATE t1 set nom="CCP" where nid = 4; +select * from t1 order by nid; +nid nom prenom +2 XYZ1 ABC1 +4 CCP DDD +5 EEE FFF +select * from t1 order by nid; +nid nom prenom +2 XYZ1 ABC1 +4 CCP DDD +5 EEE FFF +DROP table t1; +CREATE TABLE `t1` ( +`prid` int(10) unsigned NOT NULL, +`id_type` enum('IMSI','SIP') NOT NULL, +`fkimssub` varchar(50) NOT NULL, +`user_id` varchar(20) DEFAULT NULL, +`password` varchar(20) DEFAULT NULL, +`ptg_nbr` varchar(20) DEFAULT NULL, +`old_tmsi` int(10) unsigned DEFAULT NULL, +`new_tmsi` int(10) unsigned DEFAULT NULL, +`dev_capability` int(10) unsigned DEFAULT NULL, +`dev_oid` bigint(20) unsigned DEFAULT NULL, +`lac_cell_id` bigint(20) unsigned DEFAULT NULL, +`ms_classmark1` int(10) unsigned DEFAULT NULL, +`cipher_key` int(10) unsigned DEFAULT NULL, +`priid_master` int(10) unsigned DEFAULT NULL, +PRIMARY KEY (`prid`), +UNIQUE KEY `fkimssub` (`fkimssub`,`ptg_nbr`) USING HASH +) ENGINE=ndbcluster DEFAULT CHARSET=latin1; +Warnings: +Warning 1121 Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan +INSERT INTO `t1` VALUES (183342,'IMSI','config3_sub_2Privates_3Publics_imssub_36668','user_id_73336','user_id_73336','73336',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(47617,'IMSI','config3_sub_2Privates_3Publics_imssub_9523','user_id_19046','user_id_19046','19046',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(200332,'IMSI','config3_sub_2Privates_3Publics_imssub_40066','user_id_80132','user_id_80132','80132',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(478882,'IMSI','config3_sub_2Privates_3Publics_imssub_95776','user_id_191552','user_id_191552','191552',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(490146,'IMSI','config3_sub_2Privates_3Publics_imssub_98029','user_id_196057','user_id_196057','196057',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(499301,'IMSI','config3_sub_2Privates_3Publics_imssub_99860','user_id_199719','user_id_199719','199719',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(506101,'IMSI','config3_sub_2Privates_3Publics_imssub_101220','user_id_202439','user_id_202439','202439',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(510142,'IMSI','config3_sub_2Privates_3Publics_imssub_102028','user_id_204056','user_id_204056','204056',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(515871,'IMSI','config3_sub_2Privates_3Publics_imssub_103174','user_id_206347','user_id_206347','206347',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(209842,'IMSI','config3_sub_2Privates_3Publics_imssub_41968','user_id_83936','user_id_83936','83936',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(365902,'IMSI','config3_sub_2Privates_3Publics_imssub_73180','user_id_146360','user_id_146360','146360',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(11892,'IMSI','config3_sub_2Privates_3Publics_imssub_2378','user_id_4756','user_id_4756','4756',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL); +select count(*) from t1; +count(*) +12 +select count(*) from t1; +count(*) +12 +update t1 set dev_oid=dev_oid+1; +select count(*) from t1; +count(*) +12 +select count(*) from t1; +count(*) +12 +DROP table t1; +CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', +`nom` char(4) default NULL, +`prenom` char(4) default NULL, +PRIMARY KEY USING HASH (`nid`)) +ENGINE=ndbcluster DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES(1,"XYZ1","ABC1"); +**** On Slave **** +BEGIN; +UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1; +set GLOBAL slave_transaction_retries=1; +**** On Master **** +UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; +**** On Slave **** +SHOW SLAVE STATUS;; +Slave_IO_State <Slave_IO_State> +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos <Read_Master_Log_Pos> +Relay_Log_File <Relay_Log_File> +Relay_Log_Pos <Relay_Log_Pos> +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table <Replicate_Ignore_Table> +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno <Last_Errno> +Last_Error <Last_Error> +Skip_Counter 0 +Exec_Master_Log_Pos <Exec_Master_Log_Pos> +Relay_Log_Space <Relay_Log_Space> +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master <Seconds_Behind_Master> +Master_SSL_Verify_Server_Cert No +set GLOBAL slave_transaction_retries=10; +START SLAVE; +select * from t1 order by nid; +nid nom prenom +1 LOCK ABC1 +COMMIT; +select * from t1 order by nid; +nid nom prenom +1 DEAD ABC1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INT KEY) ENGINE=NDB; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +ALTER TABLE t1 ADD c2 INT; +SELECT * FROM t1 ORDER BY c1; +c1 c2 +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +6 NULL +7 NULL +8 NULL +9 NULL +10 NULL +ALTER TABLE t1 CHANGE c2 c2 TEXT CHARACTER SET utf8; +ALTER TABLE t1 CHANGE c2 c2 BLOB; +SELECT * FROM t1 ORDER BY c1 LIMIT 5; +c1 c2 +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +TRUNCATE t1; +SELECT count(*) FROM t1; +count(*) +0 +INSERT INTO t1 VALUES (101,NULL),(102,NULL),(103,NULL),(104,NULL),(105,NULL),(106,NULL),(107,NULL),(108,NULL),(109,NULL),(1010,NULL); +SELECT count(*) FROM t1; +count(*) +10 +SELECT c1 FROM t1 ORDER BY c1 LIMIT 5; +c1 +101 +102 +103 +104 +105 +DROP TABLE t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result new file mode 100644 index 00000000000..c11de8c27e3 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result @@ -0,0 +1,135 @@ +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 not null primary key, +b text not null +) engine=ndb; +insert into t1 values(1, repeat('abc',10)); +insert into t1 values(2, repeat('def',200)); +insert into t1 values(3, repeat('ghi',3000)); +select 'M', a, sha1(b) from t1 +order by a; +M a sha1(b) +M 1 8a6c4cf7cf97e66c487c3e3b717e9ae13623d07d +M 2 0ccd08c0fa6ad6a4382b27b1d36586d6ceb4fffa +M 3 75e7b3299e0b776aeac2a4d1542d5b3c0ba2e05e +select 'S', a, sha1(b) from t1 +order by a; +S a sha1(b) +S 1 8a6c4cf7cf97e66c487c3e3b717e9ae13623d07d +S 2 0ccd08c0fa6ad6a4382b27b1d36586d6ceb4fffa +S 3 75e7b3299e0b776aeac2a4d1542d5b3c0ba2e05e +drop table t1; +create table t1 ( +a int not null primary key, +b text not null, +c int, +d longblob, +e tinyblob +) engine=ndbcluster; +insert into t1 values ( +0, repeat(@s2,454), 100, repeat(@s2,345), NULL); +insert into t1 values ( +1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1)); +insert into t1 values ( +2, '', 102, '', repeat(@s2,1)); +insert into t1 values ( +3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1)); +insert into t1 values ( +4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1)); +insert into t1 values ( +5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1)); +insert into t1 values ( +6, repeat(@s1,242), 106, NULL, repeat(@s1,1)); +insert into t1 values ( +7, repeat(@s1,30), 107, repeat(@s0,161), ''); +insert into t1 values ( +8, repeat(@s1,719), 108, repeat(@s2,104), NULL); +insert into t1 values ( +9, repeat(@s2,427), NULL, NULL, NULL); +select 'M', a, sha1(b), c, sha1(d), sha1(e) +from t1 order by a; +M a sha1(b) c sha1(d) sha1(e) +M 0 9538f61e649383c0d1054de2a2f0171188129f33 100 2b6515f29c20b8e9e17cc597527e516c0de8d612 NULL +M 1 dcb9a12ca86e718ff2564be041b7c1b3ff5ea559 NULL f23e7439d9a73c3954979b85a7ef6ef35faf4e9d abfe8ae5212b22d023aa6de84beeb1344ac5668a +M 2 da39a3ee5e6b4b0d3255bfef95601890afd80709 102 da39a3ee5e6b4b0d3255bfef95601890afd80709 33deebe47470a40e960834bffa4cdc66790845a6 +M 3 ec8e06d9ac4695d6a898b519ba840590263a9bff 103 278629ad080c3c4377978c006c2e54d0992e43cc 700915801f853603510aeb67b331866d996fdbda +M 4 0392fa8c425d293c79291f0f34779d1101d13fcb 104 5084b602c7203e0e9590a163415ac605da17ac32 700915801f853603510aeb67b331866d996fdbda +M 5 0f9653f0c7a69cd1c617792d546582e974a7a24d 105 566588a04ff26d05160d61c83435292bfda2978e abfe8ae5212b22d023aa6de84beeb1344ac5668a +M 6 a37e8b0ff4fc13a42be02cdecb36186436959bae 106 NULL abfe8ae5212b22d023aa6de84beeb1344ac5668a +M 7 a6bae0cfe6b45ff8c3c12d2ce577a1cd3931190f 107 39ee712b4b9e47f2cf3ba7c9790b2bf0d8f378e8 da39a3ee5e6b4b0d3255bfef95601890afd80709 +M 8 e139adcb7b2974ee7ff227fd405709e5cb7c896c 108 ba8073b0e1a281d4111bd2d82c7722b01574c00b NULL +M 9 1fc5168fe4be566b17b658d94e7813f0b5032cdb NULL NULL NULL +select 'S', a, sha1(b), c, sha1(d), sha1(e) +from t1 order by a; +S a sha1(b) c sha1(d) sha1(e) +S 0 9538f61e649383c0d1054de2a2f0171188129f33 100 2b6515f29c20b8e9e17cc597527e516c0de8d612 NULL +S 1 dcb9a12ca86e718ff2564be041b7c1b3ff5ea559 NULL f23e7439d9a73c3954979b85a7ef6ef35faf4e9d abfe8ae5212b22d023aa6de84beeb1344ac5668a +S 2 da39a3ee5e6b4b0d3255bfef95601890afd80709 102 da39a3ee5e6b4b0d3255bfef95601890afd80709 33deebe47470a40e960834bffa4cdc66790845a6 +S 3 ec8e06d9ac4695d6a898b519ba840590263a9bff 103 278629ad080c3c4377978c006c2e54d0992e43cc 700915801f853603510aeb67b331866d996fdbda +S 4 0392fa8c425d293c79291f0f34779d1101d13fcb 104 5084b602c7203e0e9590a163415ac605da17ac32 700915801f853603510aeb67b331866d996fdbda +S 5 0f9653f0c7a69cd1c617792d546582e974a7a24d 105 566588a04ff26d05160d61c83435292bfda2978e abfe8ae5212b22d023aa6de84beeb1344ac5668a +S 6 a37e8b0ff4fc13a42be02cdecb36186436959bae 106 NULL abfe8ae5212b22d023aa6de84beeb1344ac5668a +S 7 a6bae0cfe6b45ff8c3c12d2ce577a1cd3931190f 107 39ee712b4b9e47f2cf3ba7c9790b2bf0d8f378e8 da39a3ee5e6b4b0d3255bfef95601890afd80709 +S 8 e139adcb7b2974ee7ff227fd405709e5cb7c896c 108 ba8073b0e1a281d4111bd2d82c7722b01574c00b NULL +S 9 1fc5168fe4be566b17b658d94e7813f0b5032cdb NULL NULL NULL +drop table t1; +CREATE TABLE IF NOT EXISTS t1 ( +db VARBINARY(63) NOT NULL, +name VARBINARY(63) NOT NULL, +slock BINARY(32) NOT NULL, +query BLOB NOT NULL, +node_id INT UNSIGNED NOT NULL, +epoch BIGINT UNSIGNED NOT NULL, +id INT UNSIGNED NOT NULL, +version INT UNSIGNED NOT NULL, +type INT UNSIGNED NOT NULL, +PRIMARY KEY USING HASH (db,name)) +ENGINE=NDB; +insert into t1 values ('test','t1', +'abc',repeat(@s0,10), 11,12,13,14,15); +insert into t1 values ('test','t2', +'def',repeat(@s1,100), 21,22,23,24,25); +insert into t1 values ('test','t3', +'ghi',repeat(@s2,1000),31,32,33,34,35); +insert into t1 values ('testtttttttttt','t1', +'abc',repeat(@s0,10), 11,12,13,14,15); +insert into t1 values ('testttttttttttt','t1', +'def',repeat(@s1,100), 21,22,23,24,25); +insert into t1 values ('testtttttttttttt','t1', +'ghi',repeat(@s2,1000),31,32,33,34,35); +insert into t1 values ('t','t11111111111', +'abc',repeat(@s0,10), 11,12,13,14,15); +insert into t1 values ('t','t111111111111', +'def',repeat(@s1,100), 21,22,23,24,25); +insert into t1 values ('t','t1111111111111', +'ghi',repeat(@s2,1000),31,32,33,34,35); +select 'M', db, name, sha1(query), node_id, epoch, id, version, type +from t1 order by db, name; +M db name sha1(query) node_id epoch id version type +M t t11111111111 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15 +M t t111111111111 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25 +M t t1111111111111 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35 +M test t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15 +M test t2 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25 +M test t3 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35 +M testtttttttttt t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15 +M testttttttttttt t1 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25 +M testtttttttttttt t1 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35 +select 'S', db, name, sha1(query), node_id, epoch, id, version, type +from t1 order by db, name; +S db name sha1(query) node_id epoch id version type +S t t11111111111 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15 +S t t111111111111 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25 +S t t1111111111111 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35 +S test t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15 +S test t2 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25 +S test t3 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35 +S testtttttttttt t1 8fc937d303ee7e4795c0b964d4066cedd6d74cfd 11 12 13 14 15 +S testttttttttttt t1 a5229e9f8977bc99afc3b3627c56f083e97e01bd 21 22 23 24 25 +S testtttttttttttt t1 0820e6ad3eeb06ea60e5e04d0bfe36f286b91098 31 32 33 34 35 +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result new file mode 100644 index 00000000000..055efffbd6a --- /dev/null +++ b/mysql-test/suite/rpl_ndb/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/suite/rpl_ndb/r/rpl_ndb_charset.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_charset.result new file mode 100644 index 00000000000..ed9b3cfbfa8 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_charset.result @@ -0,0 +1,201 @@ +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; +set timestamp=1000000000; +drop database if exists mysqltest2; +drop database if exists mysqltest3; +create database mysqltest2 character set latin2; +set @@character_set_server=latin5; +create database mysqltest3; + +--- --master-- +show create database mysqltest2; +Database Create Database +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */ +show create database mysqltest3; +Database Create Database +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */ + +--- --slave-- +show create database mysqltest2; +Database Create Database +mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */ +show create database mysqltest3; +Database Create Database +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */ +set @@collation_server=armscii8_bin; +drop database mysqltest3; +create database mysqltest3; + +--- --master-- +show create database mysqltest3; +Database Create Database +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */ + +--- --slave-- +show create database mysqltest3; +Database Create Database +mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */ +use mysqltest2; +create table t1 (a int auto_increment primary key, b varchar(100)); +set character_set_client=cp850, collation_connection=latin2_croatian_ci; +insert into t1 (b) values(@@character_set_server); +insert into t1 (b) values(@@collation_server); +insert into t1 (b) values(@@character_set_client); +insert into t1 (b) values(@@character_set_connection); +insert into t1 (b) values(@@collation_connection); + +--- --master-- +select * from t1 order by a; +a b +1 armscii8 +2 armscii8_bin +3 cp850 +4 latin2 +5 latin2_croatian_ci + +--- --slave-- +select * from mysqltest2.t1 order by a; +a b +1 armscii8 +2 armscii8_bin +3 cp850 +4 latin2 +5 latin2_croatian_ci +select "--- --muller--" as ""; + +--- --muller-- +set character_set_client=latin1, collation_connection=latin1_german1_ci; +truncate table t1; +insert into t1 (b) values(@@collation_connection); +insert into t1 (b) values(LEAST("Müller","Muffler")); +set collation_connection=latin1_german2_ci; +insert into t1 (b) values(@@collation_connection); +insert into t1 (b) values(LEAST("Müller","Muffler")); + +--- --master-- +select * from t1 order by a; +a b +1 latin1_german1_ci +2 Muffler +3 latin1_german2_ci +4 Müller + +--- --slave-- +select * from mysqltest2.t1 order by a; +a b +1 latin1_german1_ci +2 Muffler +3 latin1_german2_ci +4 Müller +select "--- --INSERT--" as ""; + +--- --INSERT-- +set @a= _cp850 'Müller' collate cp850_general_ci; +truncate table t1; +insert into t1 (b) values(collation(@a)); + +--- --master-- +select * from t1 order by a; +a b +1 cp850_general_ci + +--- --slave-- +select * from mysqltest2.t1 order by a; +a b +1 cp850_general_ci +drop database mysqltest2; +drop database mysqltest3; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # drop database if exists mysqltest2 +master-bin.000001 # Query # # drop database if exists mysqltest3 +master-bin.000001 # Query # # create database mysqltest2 character set latin2 +master-bin.000001 # Query # # create database mysqltest3 +master-bin.000001 # Query # # drop database mysqltest3 +master-bin.000001 # Query # # create database mysqltest3 +master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest2`; truncate table t1 +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest2`; truncate table t1 +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # drop database mysqltest2 +master-bin.000001 # Query # # drop database mysqltest3 +select "--- --global--" as ""; + +--- --global-- +set global character_set_server=latin2; +set global character_set_server=latin1; +set global character_set_server=latin2; +set global character_set_server=latin1; +select "--- --oneshot--" as ""; + +--- --oneshot-- +set one_shot @@character_set_server=latin5; +set @@max_join_size=1000; +select @@character_set_server; +@@character_set_server +latin5 +select @@character_set_server; +@@character_set_server +latin1 +set @@character_set_server=latin5; +select @@character_set_server; +@@character_set_server +latin5 +select @@character_set_server; +@@character_set_server +latin5 +set one_shot max_join_size=10; +ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server +set character_set_client=9999999; +ERROR 42000: Unknown character set: '9999999' +set collation_server=9999998; +ERROR HY000: Unknown collation: '9999998' +select "--- --3943--" as ""; + +--- --3943-- +use test; +CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255)); +SET CHARACTER_SET_CLIENT=koi8r, +CHARACTER_SET_CONNECTION=cp1251, +CHARACTER_SET_RESULTS=koi8r; +INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ'); +select hex(c1), hex(c2) from t1; +hex(c1) hex(c2) +CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 +select hex(c1), hex(c2) from t1; +hex(c1) hex(c2) +CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 +drop table t1; +select "--- --6676--" as ""; + +--- --6676-- +create table `t1` ( +`pk` varchar(10) not null default '', +primary key (`pk`) +) engine=NDB default charset=latin1; +set @p=_latin1 'test'; +update t1 set pk='test' where pk=@p; +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result new file mode 100644 index 00000000000..88516b757df --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result @@ -0,0 +1,95 @@ +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; +RESET MASTER; +CHANGE MASTER TO master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root"; +START SLAVE; +CREATE TABLE t1 (a int key, b int) ENGINE=ndb; +SHOW TABLES; +Tables_in_test +t1 +INSERT INTO t1 VALUES (1,2); +INSERT INTO t1 VALUES (2,3); +SELECT * FROM t1 ORDER BY a; +a b +1 2 +2 3 +show slave status;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port # +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SELECT * FROM t1 ORDER BY a; +a b +1 2 +2 3 +show slave status;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port # +Connect_Retry 60 +Master_Log_File slave-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File slave-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +STOP SLAVE; +DROP TABLE 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 new file mode 100644 index 00000000000..ee452f345f9 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result @@ -0,0 +1,97 @@ +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 key, b int) ENGINE=NDB; +SHOW TABLES; +Tables_in_test +t1 +RESET MASTER; +INSERT INTO t1 VALUES (1,2); +INSERT INTO t1 VALUES (2,3); +STOP SLAVE; +CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=SLAVE_PORT,MASTER_USER="root"; +RESET MASTER; +START SLAVE; +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port SLAVE_PORT +Connect_Retry 60 +Master_Log_File slave-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File slave-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SELECT * FROM t1 ORDER BY a; +a b +1 2 +2 3 +STOP SLAVE; +START SLAVE; +SELECT * FROM t1 ORDER BY a; +a b +1 2 +2 3 +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result new file mode 100644 index 00000000000..3fc4ca26967 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result @@ -0,0 +1,13 @@ +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) ENGINE=NDB; +begin; +insert into t1 values(1); +flush tables with read lock; +commit; +unlock tables; +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result new file mode 100644 index 00000000000..a4614b4b484 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result @@ -0,0 +1,417 @@ +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 t1, t2, t3; +***** Test 1 RPL of CDD and Alter ***** +***** Test 1 setup ***** +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE 4M +ENGINE=NDB; +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE=NDB; +ALTER TABLESPACE ts1 +ADD DATAFILE 'datafile02.dat' +INITIAL_SIZE 4M +ENGINE=NDB; +CREATE TABLE t1 +(c1 INT NOT NULL PRIMARY KEY, +c2 INT NOT NULL, +c3 INT NOT NULL) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB; +***** insert some data ***** +***** Select from Master ***** +SELECT * FROM t1 ORDER BY c1 LIMIT 5; +c1 c2 c3 +1 2 4 +2 4 5 +3 6 6 +4 8 7 +5 10 8 +***** Select from Slave ***** +SELECT * FROM t1 ORDER BY c1 LIMIT 5; +c1 c2 c3 +1 2 4 +2 4 5 +3 6 6 +4 8 7 +5 10 8 +FILE_NAME FILE_TYPE TABLESPACE_NAME LOGFILE_GROUP_NAME +NULL UNDO LOG NULL lg1 +datafile.dat DATAFILE ts1 lg1 +datafile02.dat DATAFILE ts1 lg1 +undofile.dat UNDO LOG NULL lg1 +undofile02.dat UNDO LOG NULL lg1 +**** Do First Set of ALTERs in the master table **** +CREATE INDEX t1_i ON t1(c2, c3); +ALTER TABLE t1 ADD c4 TIMESTAMP; +ALTER TABLE t1 ADD c5 DOUBLE; +ALTER TABLE t1 ADD INDEX (c5); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` int(11) NOT NULL, + `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c5` double DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `t1_i` (`c2`,`c3`), + KEY `c5` (`c5`) +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 +**** Show first set of ALTERs on SLAVE **** +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` int(11) NOT NULL, + `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c5` double DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `t1_i` (`c2`,`c3`), + KEY `c5` (`c5`) +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 +**** Second set of alters test 1 **** +ALTER TABLE t1 RENAME t2; +ALTER TABLE t2 DROP INDEX c5; +CREATE TABLE t1(c1 INT)ENGINE=NDB; +INSERT INTO t1 VALUES(1); +DROP TABLE t1; +ALTER TABLE t2 RENAME t1; +**** Show second set of ALTERs on MASTER **** +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` int(11) NOT NULL, + `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c5` double DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `t1_i` (`c2`,`c3`) +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 +**** Show second set of ALTERs on SLAVE **** +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` int(11) NOT NULL, + `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c5` double DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `t1_i` (`c2`,`c3`) +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 +**** Third and last set of alters for test1 **** +ALTER TABLE t1 CHANGE c1 c1 DOUBLE; +ALTER TABLE t1 CHANGE c2 c2 DECIMAL(10,2); +ALTER TABLE t1 DROP COLUMN c3; +ALTER TABLE t1 CHANGE c4 c4 TEXT CHARACTER SET utf8; +ALTER TABLE t1 CHANGE c4 c4 BLOB; +ALTER TABLE t1 CHANGE c4 c3 BLOB; +set @b1 = 'b1'; +set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1); +UPDATE t1 SET c3=@b1 where c1 = 1; +UPDATE t1 SET c3=@b1 where c1 = 2; +**** Show last set of ALTERs on MASTER **** +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` double NOT NULL DEFAULT '0', + `c2` decimal(10,2) DEFAULT NULL, + `c3` blob, + `c5` double DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `t1_i` (`c2`) +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 +SELECT * FROM t1 ORDER BY c1 LIMIT 5; +c1 c2 c3 c5 +1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL +2 4.00 b1b1b1b1b1b1b1b1b1b1 NULL +3 6.00 0000-00-00 00:00:00 NULL +4 8.00 0000-00-00 00:00:00 NULL +5 10.00 0000-00-00 00:00:00 NULL +**** Show last set of ALTERs on SLAVE **** +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` double NOT NULL DEFAULT '0', + `c2` decimal(10,2) DEFAULT NULL, + `c3` blob, + `c5` double DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `t1_i` (`c2`) +) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 +SELECT * FROM t1 where c1 = 1; +c1 c2 c3 c5 +1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL +DROP TABLE t1; +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +START SLAVE; +******** Create additional TABLESPACE test 2 ************** +CREATE TABLESPACE ts2 +ADD DATAFILE 'datafile03.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE=NDB; +ALTER TABLESPACE ts2 +ADD DATAFILE 'datafile04.dat' +INITIAL_SIZE 12M +ENGINE=NDB; +DROP DATABASE IF EXISTS tpcb; +Warnings: +Note 1008 Can't drop database 'tpcb'; database doesn't exist +CREATE DATABASE tpcb; +*********** Create TPCB Tables ***************** +CREATE TABLE tpcb.account +(id INT, bid INT, balance DECIMAL(10,2), +filler CHAR(255), PRIMARY KEY(id)) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB; +CREATE TABLE tpcb.branch +(bid INT, balance DECIMAL(10,2), filler VARCHAR(255), +PRIMARY KEY(bid)) +ENGINE=NDB; +CREATE TABLE tpcb.teller +(tid INT, balance DECIMAL(10,2), filler VARCHAR(255), +PRIMARY KEY(tid)) +TABLESPACE ts2 STORAGE DISK +ENGINE=NDB; +CREATE TABLE tpcb.history +(id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, +tid INT, bid INT, amount DECIMAL(10,2), +tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, +filler CHAR(80),PRIMARY KEY (id)) +TABLESPACE ts2 STORAGE DISK +ENGINE=NDB; +********* Create Procedures and Functions ************ +CREATE PROCEDURE tpcb.load() +BEGIN +DECLARE acct INT DEFAULT 1000; +DECLARE brch INT DEFAULT 100; +DECLARE tell INT DEFAULT 1000; +DECLARE tmp INT DEFAULT 100; +WHILE brch > 0 DO +SET tmp = 100; +WHILE tmp > 0 DO +INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT"); +SET acct = acct - 1; +SET tmp = tmp -1; +END WHILE; +INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH"); +SET brch = brch - 1; +END WHILE; +WHILE tell > 0 DO +INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER"); +SET tell = tell - 1; +END WHILE; +END| +CREATE FUNCTION tpcb.account_id () RETURNS INT +BEGIN +DECLARE num INT; +DECLARE ran INT; +SELECT RAND() * 10 INTO ran; +IF (ran < 2) +THEN +SELECT RAND() * 10 INTO num; +ELSEIF (ran < 4) +THEN +SELECT RAND() * 100 INTO num; +ELSE +SELECT RAND() * 1000 INTO num; +END IF; +IF (num < 1) +THEN +RETURN 1; +END IF; +RETURN num; +END| +CREATE FUNCTION tpcb.teller_id () RETURNS INT +BEGIN +DECLARE num INT; +DECLARE ran INT; +SELECT RAND() * 10 INTO ran; +IF (ran < 2) +THEN +SELECT RAND() * 10 INTO num; +ELSEIF (ran < 5) +THEN +SELECT RAND() * 100 INTO num; +ELSE +SELECT RAND() * 1000 INTO num; +END IF; +IF (num < 1) +THEN +RETURN 1; +END IF; +RETURN num; +END| +CREATE PROCEDURE tpcb.trans() +BEGIN +DECLARE acct INT DEFAULT 0; +DECLARE brch INT DEFAULT 0; +DECLARE tell INT DEFAULT 0; +DECLARE bal DECIMAL(10,2) DEFAULT 0.0; +DECLARE amount DECIMAL(10,2) DEFAULT 1.00; +DECLARE test INT DEFAULT 0; +DECLARE bbal DECIMAL(10,2) DEFAULT 0.0; +DECLARE tbal DECIMAL(10,2) DEFAULT 0.0; +DECLARE local_uuid VARCHAR(255); +DECLARE local_user VARCHAR(255); +DECLARE local_time TIMESTAMP; +SELECT RAND() * 10 INTO test; +SELECT tpcb.account_id() INTO acct; +SELECT tpcb.teller_id() INTO tell; +SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct; +SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct; +SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell; +SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch; +IF (test < 5) +THEN +SET bal = bal + amount; +SET bbal = bbal + amount; +SET tbal = tbal + amount; +UPDATE tpcb.account SET balance = bal, filler = 'account updated' + WHERE id = acct; +UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' + WHERE bid = brch; +UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' + WHERE tid = tell; +ELSE +SET bal = bal - amount; +SET bbal = bbal - amount; +SET tbal = tbal - amount; +UPDATE tpcb.account SET balance = bal, filler = 'account updated' + WHERE id = acct; +UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' + WHERE bid = brch; +UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' + WHERE tid = tell; +END IF; +SET local_uuid=UUID(); +SET local_user=USER(); +SET local_time= NOW(); +INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user, +local_uuid,'completed trans'); +END| +****** TEST 2 test time ********************************* +USE tpcb; +*********** Load up the database ****************** +CALL tpcb.load(); +********** Check load master and slave ************** +SELECT COUNT(*) FROM account; +COUNT(*) +10000 +USE tpcb; +SELECT COUNT(*) FROM account; +COUNT(*) +10000 +******** Run in some transactions *************** +***** Time to try slave sync *********** +**** Must make sure slave is clean ***** +STOP SLAVE; +RESET SLAVE; +DROP PROCEDURE IF EXISTS tpcb.load; +DROP PROCEDURE IF EXISTS tpcb.trans; +DROP TABLE IF EXISTS tpcb.account; +DROP TABLE IF EXISTS tpcb.teller; +DROP TABLE IF EXISTS tpcb.branch; +DROP TABLE IF EXISTS tpcb.history; +DROP DATABASE tpcb; +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile.dat' +ENGINE=NDB; +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile02.dat' +ENGINE=NDB; +DROP TABLESPACE ts1 ENGINE=NDB; +ALTER TABLESPACE ts2 +DROP DATAFILE 'datafile03.dat' +ENGINE=NDB; +ALTER TABLESPACE ts2 +DROP DATAFILE 'datafile04.dat' +ENGINE=NDB; +DROP TABLESPACE ts2 ENGINE=NDB; +DROP LOGFILE GROUP lg1 ENGINE=NDB; +********** Take a backup of the Master ************* +SELECT COUNT(*) FROM history; +COUNT(*) +1000 +SELECT COUNT(*) FROM history; +COUNT(*) +2000 +CREATE TEMPORARY 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 ','; +SELECT @the_backup_id:=backup_id FROM mysql.backup_info; +@the_backup_id:=backup_id +<the_backup_id> +DROP TABLE IF EXISTS mysql.backup_info; +************ Restore the slave ************************ +CREATE DATABASE tpcb; +***** Check a few slave restore values *************** +USE tpcb; +SELECT COUNT(*) FROM account; +COUNT(*) +10000 +***** Add some more records to master ********* +***** Finsh the slave sync process ******* +@the_epoch:=MAX(epoch) +<the_epoch> +@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) +<the_pos> master-bin.000001 +* 4. * +* 5. * +START SLAVE; +**** We should be ready to continue on ************* +****** Let's make sure we match ******* +***** MASTER ******* +USE tpcb; +SELECT COUNT(*) FROM history; +COUNT(*) +4050 +****** SLAVE ******** +USE tpcb; +SELECT COUNT(*) FROM history; +COUNT(*) +4050 +*** DUMP MASTER & SLAVE FOR COMPARE ******** +*************** TEST 2 CLEANUP SECTION ******************** +DROP PROCEDURE IF EXISTS tpcb.load; +DROP PROCEDURE IF EXISTS tpcb.trans; +DROP TABLE tpcb.account; +DROP TABLE tpcb.teller; +DROP TABLE tpcb.branch; +DROP TABLE tpcb.history; +DROP DATABASE tpcb; +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile.dat' +ENGINE=NDB; +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile02.dat' +ENGINE=NDB; +DROP TABLESPACE ts1 ENGINE=NDB; +ALTER TABLESPACE ts2 +DROP DATAFILE 'datafile03.dat' +ENGINE=NDB; +ALTER TABLESPACE ts2 +DROP DATAFILE 'datafile04.dat' +ENGINE=NDB; +DROP TABLESPACE ts2 ENGINE=NDB; +DROP LOGFILE GROUP lg1 ENGINE=NDB; +****** Do dumps compare ************ diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result new file mode 100644 index 00000000000..f1cc6e9af24 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result @@ -0,0 +1,72 @@ +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 t1; +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; +alter logfile group lg1 +add undofile 'undofile02.dat' +initial_size 4M engine=ndb; +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB; +alter tablespace ts1 +add datafile 'datafile02.dat' +initial_size 4M engine=ndb; +CREATE TABLE t1 +(pk1 int not null primary key, b int not null, c int not null) +tablespace ts1 storage disk +engine ndb; +insert into t1 values (1,2,3); +select * from t1 order by pk1; +pk1 b c +1 2 3 +select * from t1 order by pk1; +pk1 b c +1 2 3 +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1 +master-bin.000001 # Query 1 # CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB +master-bin.000001 # Query 1 # alter logfile group lg1 +add undofile 'undofile02.dat' +initial_size 4M engine=ndb +master-bin.000001 # Query 1 # CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB +master-bin.000001 # Query 1 # alter tablespace ts1 +add datafile 'datafile02.dat' +initial_size 4M engine=ndb +master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 +(pk1 int not null primary key, b int not null, c int not null) +tablespace ts1 storage disk +engine ndb +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows 1 # table_id: # +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # COMMIT +drop table t1; +alter tablespace ts1 +drop datafile 'datafile.dat' +engine=ndb; +alter tablespace ts1 +drop datafile 'datafile02.dat' +engine=ndb; +DROP TABLESPACE ts1 ENGINE=NDB; +DROP LOGFILE GROUP lg1 ENGINE=NDB; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result new file mode 100644 index 00000000000..ece6b84c227 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result @@ -0,0 +1,726 @@ +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; +--- Doing pre test cleanup --- +DROP TABLE IF EXISTS t1; +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB; +ALTER TABLESPACE ts1 +ADD DATAFILE 'datafile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; +--- Start test 2 partition RANGE testing -- +--- Do setup -- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), +bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB +PARTITION BY RANGE (YEAR(t)) +(PARTITION p0 VALUES LESS THAN (1901), +PARTITION p1 VALUES LESS THAN (1946), +PARTITION p2 VALUES LESS THAN (1966), +PARTITION p3 VALUES LESS THAN (1986), +PARTITION p4 VALUES LESS THAN (2005), +PARTITION p5 VALUES LESS THAN MAXVALUE); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Show table on slave -- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc VARCHAR(255); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 2 partition RANGE testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; +--- Start test 3 partition LIST testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), +bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB +PARTITION BY LIST(id) +(PARTITION p0 VALUES IN (2, 4), +PARTITION p1 VALUES IN (42, 142)); +--- Test 3 Alter to add partition --- +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); +--- Show table on master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Show table on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc VARCHAR(255); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 3 partition LIST testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 4 partition HASH testing --- +--- Do setup --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), +bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB +PARTITION BY HASH( YEAR(t) ) +PARTITIONS 4; +--- show that tables have been created correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc VARCHAR(255); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 4 partition HASH testing --- +--- Do Cleanup -- +DROP TABLE IF EXISTS t1; +--- Start test 5 partition by key testing --- +--- Create Table Section --- +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), +bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, +f FLOAT DEFAULT 0, total BIGINT UNSIGNED, +y YEAR, t DATE,PRIMARY KEY(id)) +TABLESPACE ts1 STORAGE DISK +ENGINE=NDB +PARTITION BY KEY() +PARTITIONS 4; +--- Show that tables on master are ndbcluster tables --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Show that tables on slave --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned DEFAULT NULL, + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`) +) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still right type --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(63) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 MODIFY vc VARCHAR(255); +--- Show the new improved table on the master --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Make sure that our tables on slave are still same engine --- +--- and that the alter statements replicated correctly --- +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL, + `b1` bit(8) DEFAULT NULL, + `vc` varchar(255) DEFAULT NULL, + `bc` char(63) DEFAULT NULL, + `d` decimal(10,4) DEFAULT '0.0000', + `f` float DEFAULT '0', + `total` bigint(20) unsigned NOT NULL DEFAULT '0', + `y` year(4) DEFAULT NULL, + `t` date DEFAULT NULL, + PRIMARY KEY (`id`,`total`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +--- Perform basic operation on master --- +--- and ensure replicated correctly --- +"--- Insert into t1 --" as ""; +--- Select from t1 on master --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Select from t1 on slave --- +select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; +id hex(b1) vc bc d f total y t +2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 +4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 +42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 +142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14 +412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14 +--- Update t1 on master -- +UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412; +--- Check the update on master --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Check Update on slave --- +SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; +id hex(b1) vc bc d f total y t +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +--- Remove a record from t1 on master --- +DELETE FROM t1 WHERE id = 42; +--- Show current count on master for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +--- Show current count on slave for t1 --- +SELECT COUNT(*) FROM t1; +COUNT(*) +4 +DELETE FROM t1; +--- End test 5 key partition testing --- +--- Do Cleanup --- +DROP TABLE IF EXISTS t1; +alter tablespace ts1 +drop datafile 'datafile.dat' +engine=ndb; +alter tablespace ts1 +drop datafile 'datafile02.dat' +engine=ndb; +DROP TABLESPACE ts1 ENGINE=NDB; +DROP LOGFILE GROUP lg1 ENGINE=NDB; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result new file mode 100644 index 00000000000..aeaca1e7de0 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result @@ -0,0 +1,1616 @@ +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; + +-------- switch to master ------- +SET AUTOCOMMIT = 1; +DROP DATABASE IF EXISTS mysqltest1; +DROP DATABASE IF EXISTS mysqltest2; +DROP DATABASE IF EXISTS mysqltest3; +CREATE DATABASE mysqltest1; +CREATE DATABASE mysqltest2; +CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=NDB; +INSERT INTO mysqltest1.t1 SET f1= 0; +CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=NDB; +CREATE INDEX my_idx6 ON mysqltest1.t6(f1); +CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=NDB; +INSERT INTO mysqltest1.t7 SET f1= 0; +CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=NDB; +CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=MEMORY; +SET AUTOCOMMIT = 0; +use mysqltest1; + +-------- switch to slave -------- +SET AUTOCOMMIT = 1; +use mysqltest1; + +-------- switch to master ------- + +######## SELECT 1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 0 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +SELECT 1; +1 +1 +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- + +######## SELECT COUNT(*) FROM t1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 0 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- + +######## COMMIT ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 0 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +COMMIT; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- + +######## ROLLBACK ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 1 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +2 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- + +######## SET AUTOCOMMIT=1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 1 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +2 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to master ------- +SET AUTOCOMMIT=1; +SELECT MAX(f1) FROM t1; +MAX(f1) +2 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +2 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +2 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +2 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SET AUTOCOMMIT=0; + +######## START TRANSACTION ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 2 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +3 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +2 + +-------- switch to master ------- +START TRANSACTION; +SELECT MAX(f1) FROM t1; +MAX(f1) +3 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +3 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +3 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +3 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- + +######## BEGIN ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 3 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +4 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +3 + +-------- switch to master ------- +BEGIN; +SELECT MAX(f1) FROM t1; +MAX(f1) +4 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +4 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +4 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +4 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- + +######## DROP TABLE mysqltest1.t2 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 4 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +4 + +-------- switch to master ------- +DROP TABLE mysqltest1.t2; +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW TABLES LIKE 't2'; +Tables_in_mysqltest1 (t2) + +-------- switch to slave -------- +SHOW TABLES LIKE 't2'; +Tables_in_mysqltest1 (t2) + +-------- switch to master ------- + +######## DROP TEMPORARY TABLE mysqltest1.t23 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 5 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +6 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +-------- switch to master ------- +DROP TEMPORARY TABLE mysqltest1.t23; +SELECT MAX(f1) FROM t1; +MAX(f1) +6 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- +SHOW TABLES LIKE 't23'; +Tables_in_mysqltest1 (t23) + +-------- switch to slave -------- +SHOW TABLES LIKE 't23'; +Tables_in_mysqltest1 (t23) + +-------- switch to master ------- + +######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 5 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +6 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +5 + +-------- switch to master ------- +RENAME TABLE mysqltest1.t3 to mysqltest1.t20; +SELECT MAX(f1) FROM t1; +MAX(f1) +6 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +6 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +6 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +6 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW TABLES LIKE 't20'; +Tables_in_mysqltest1 (t20) +t20 + +-------- switch to slave -------- +SHOW TABLES LIKE 't20'; +Tables_in_mysqltest1 (t20) +t20 + +-------- switch to master ------- + +######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 6 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +7 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +6 + +-------- switch to master ------- +ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT; +SELECT MAX(f1) FROM t1; +MAX(f1) +7 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +7 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +7 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +7 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +describe mysqltest1.t4; +Field Type Null Key Default Extra +f1 bigint(20) YES NULL +f2 bigint(20) YES NULL + +-------- switch to slave -------- +describe mysqltest1.t4; +Field Type Null Key Default Extra +f1 bigint(20) YES NULL +f2 bigint(20) YES NULL + +-------- switch to master ------- + +######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= NDB ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 7 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +7 + +-------- switch to master ------- +CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= NDB; +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- + +######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 8 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +9 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +-------- switch to master ------- +CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY; +SELECT MAX(f1) FROM t1; +MAX(f1) +9 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- + +######## TRUNCATE TABLE mysqltest1.t7 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 8 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +9 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +8 + +-------- switch to master ------- +TRUNCATE TABLE mysqltest1.t7; +SELECT MAX(f1) FROM t1; +MAX(f1) +9 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +9 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +9 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +9 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SELECT * FROM mysqltest1.t7; +f1 + +-------- switch to slave -------- +SELECT * FROM mysqltest1.t7; +f1 + +-------- switch to master ------- + +######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 9 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +9 + +-------- switch to master ------- +LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +UNLOCK TABLES; + +######## UNLOCK TABLES ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 10 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +11 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to master ------- +UNLOCK TABLES; +SELECT MAX(f1) FROM t1; +MAX(f1) +11 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- +LOCK TABLES mysqltest1.t1 READ; + +######## UNLOCK TABLES ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 10 + 1; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to master ------- +UNLOCK TABLES; +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- +LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; + +######## UNLOCK TABLES ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 10 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +11 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +10 + +-------- switch to master ------- +UNLOCK TABLES; +SELECT MAX(f1) FROM t1; +MAX(f1) +11 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +11 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +11 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +11 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- + +######## DROP INDEX my_idx6 ON mysqltest1.t6 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 11 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +12 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +11 + +-------- switch to master ------- +DROP INDEX my_idx6 ON mysqltest1.t6; +SELECT MAX(f1) FROM t1; +MAX(f1) +12 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +12 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +12 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +12 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW INDEX FROM mysqltest1.t6; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment + +-------- switch to slave -------- +SHOW INDEX FROM mysqltest1.t6; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment + +-------- switch to master ------- + +######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 12 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +13 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +12 + +-------- switch to master ------- +CREATE INDEX my_idx5 ON mysqltest1.t5(f1); +SELECT MAX(f1) FROM t1; +MAX(f1) +13 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +13 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +13 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +13 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW INDEX FROM mysqltest1.t5; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE + +-------- switch to slave -------- +SHOW INDEX FROM mysqltest1.t5; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE + +-------- switch to master ------- + +######## DROP DATABASE mysqltest2 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 13 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +14 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +13 + +-------- switch to master ------- +DROP DATABASE mysqltest2; +SELECT MAX(f1) FROM t1; +MAX(f1) +14 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +14 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +14 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +14 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW DATABASES LIKE "mysqltest2"; +Database (mysqltest2) + +-------- switch to slave -------- +SHOW DATABASES LIKE "mysqltest2"; +Database (mysqltest2) + +-------- switch to master ------- + +######## CREATE DATABASE mysqltest3 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 14 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +15 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +14 + +-------- switch to master ------- +CREATE DATABASE mysqltest3; +SELECT MAX(f1) FROM t1; +MAX(f1) +15 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +15 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +15 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +15 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW DATABASES LIKE "mysqltest3"; +Database (mysqltest3) +mysqltest3 + +-------- switch to slave -------- +SHOW DATABASES LIKE "mysqltest3"; +Database (mysqltest3) +mysqltest3 + +-------- switch to master ------- + +######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 15 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +16 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +15 + +-------- switch to master ------- +CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1"; +SELECT MAX(f1) FROM t1; +MAX(f1) +16 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +16 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +16 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +16 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment + +-------- switch to slave -------- +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment + +-------- switch to master ------- + +######## ALTER PROCEDURE p1 COMMENT "I have been altered" ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 16 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +17 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +16 + +-------- switch to master ------- +ALTER PROCEDURE p1 COMMENT "I have been altered"; +SELECT MAX(f1) FROM t1; +MAX(f1) +17 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +17 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +17 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +17 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment I have been altered + +-------- switch to slave -------- +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment I have been altered + +-------- switch to master ------- + +######## DROP PROCEDURE p1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 17 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +18 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +17 + +-------- switch to master ------- +DROP PROCEDURE p1; +SELECT MAX(f1) FROM t1; +MAX(f1) +18 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +18 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +18 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +18 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW PROCEDURE STATUS LIKE 'p1'; + +-------- switch to slave -------- +SHOW PROCEDURE STATUS LIKE 'p1'; + +-------- switch to master ------- + +######## CREATE OR REPLACE VIEW v1 as select * from t1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 18 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +19 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +18 + +-------- switch to master ------- +CREATE OR REPLACE VIEW v1 as select * from t1; +SELECT MAX(f1) FROM t1; +MAX(f1) +19 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +19 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +19 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +19 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` + +-------- switch to slave -------- +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` + +-------- switch to master ------- + +######## ALTER VIEW v1 AS select f1 from t1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 19 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +20 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +19 + +-------- switch to master ------- +ALTER VIEW v1 AS select f1 from t1; +SELECT MAX(f1) FROM t1; +MAX(f1) +20 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +20 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +20 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +20 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` + +-------- switch to slave -------- +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` + +-------- switch to master ------- + +######## DROP VIEW IF EXISTS v1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 20 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +21 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +20 + +-------- switch to master ------- +DROP VIEW IF EXISTS v1; +SELECT MAX(f1) FROM t1; +MAX(f1) +21 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +21 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +21 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +21 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW CREATE VIEW v1; +ERROR 42S02: Table 'mysqltest1.v1' doesn't exist + +-------- switch to slave -------- +SHOW CREATE VIEW v1; +ERROR 42S02: Table 'mysqltest1.v1' doesn't exist + +-------- switch to master ------- + +######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 21 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +22 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +21 + +-------- switch to master ------- +CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1; +SELECT MAX(f1) FROM t1; +MAX(f1) +22 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +22 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +22 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +22 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost + +-------- switch to slave -------- +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost + +-------- switch to master ------- + +######## DROP TRIGGER trg1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 22 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +23 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +22 + +-------- switch to master ------- +DROP TRIGGER trg1; +SELECT MAX(f1) FROM t1; +MAX(f1) +23 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +23 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +23 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +23 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer + +-------- switch to slave -------- +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer + +-------- switch to master ------- + +######## CREATE USER user1@localhost ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 23 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +24 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +23 + +-------- switch to master ------- +CREATE USER user1@localhost; +SELECT MAX(f1) FROM t1; +MAX(f1) +24 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +24 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +24 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +24 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SELECT user FROM mysql.user WHERE user = 'user1'; +user +user1 + +-------- switch to slave -------- +SELECT user FROM mysql.user WHERE user = 'user1'; +user +user1 + +-------- switch to master ------- + +######## RENAME USER user1@localhost TO rename1@localhost ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 24 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +25 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +24 + +-------- switch to master ------- +RENAME USER user1@localhost TO rename1@localhost; +SELECT MAX(f1) FROM t1; +MAX(f1) +25 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +25 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +25 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +25 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +rename1 + +-------- switch to slave -------- +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +rename1 + +-------- switch to master ------- + +######## DROP USER rename1@localhost ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 25 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +26 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +25 + +-------- switch to master ------- +DROP USER rename1@localhost; +SELECT MAX(f1) FROM t1; +MAX(f1) +26 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +26 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +26 + +TEST-INFO: MASTER: The INSERT is committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +26 + +TEST-INFO: SLAVE: The INSERT is committed (Succeeded) + +-------- switch to master ------- +SELECT user FROM mysql.user WHERE user = 'rename1'; +user + +-------- switch to slave -------- +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +use test; + +-------- switch to master ------- +DROP DATABASE mysqltest1; +DROP DATABASE mysqltest3; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result new file mode 100644 index 00000000000..1cecb030181 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result @@ -0,0 +1,15 @@ +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, b int) engine=NDB; +insert into t1 values(1,1); +select * from t1; +a b +1 1 +delete from t1; +select * from t1; +a b +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result new file mode 100644 index 00000000000..316f5fc7e31 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result @@ -0,0 +1,58 @@ +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 DATABASE IF EXISTS replica; +CREATE DATABASE replica; +CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +USE replica; +CREATE TABLE replica.t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE replica.t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +USE test; +INSERT INTO t1 VALUES(1, repeat('abc',10)); +INSERT INTO t2 VALUES(1, repeat('abc',10)); +SHOW TABLES; +Tables_in_test +t1 +t2 +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT COUNT(*) FROM t2; +COUNT(*) +1 +USE replica; +INSERT INTO replica.t1 VALUES(2, repeat('def',200)); +INSERT INTO replica.t2 VALUES(2, repeat('def',200)); +SHOW TABLES; +Tables_in_replica +t1 +t2 +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT COUNT(*) FROM t2; +COUNT(*) +1 +SHOW TABLES; +Tables_in_test +USE replica; +SHOW TABLES; +Tables_in_replica +t1 +t2 +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT COUNT(*) FROM t2; +COUNT(*) +1 +USE test; +SHOW TABLES; +Tables_in_test +USE test; +DROP TABLE t1, t2; +DROP DATABASE IF EXISTS replica; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result new file mode 100644 index 00000000000..dda2844f6d0 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result @@ -0,0 +1,26 @@ +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 t1, t2; +CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +INSERT INTO t1 VALUES(1, repeat('abc',10)); +INSERT INTO t1 VALUES(2, repeat('def',200)); +INSERT INTO t1 VALUES(3, repeat('ghi',3000)); +INSERT INTO t2 VALUES(1, repeat('abc',10)); +INSERT INTO t2 VALUES(2, repeat('def',200)); +INSERT INTO t2 VALUES(3, repeat('ghi',3000)); +SHOW TABLES; +Tables_in_test +t1 +SELECT COUNT(*) FROM t1; +COUNT(*) +3 +INSERT INTO t1 VALUES (3, repeat('bad',1)); +ERROR 23000: Duplicate entry '3' for key 'PRIMARY' +INSERT INTO t1 VALUES (3, repeat('bad too',1)); +ERROR 23000: Duplicate entry '3' for key 'PRIMARY' +DROP TABLE IF EXISTS t1, t2; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result new file mode 100644 index 00000000000..8f6dae7c5b5 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result @@ -0,0 +1,750 @@ +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; +**** Diff Table Def Start **** +*** On Slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20), +d FLOAT DEFAULT '2.00', +e CHAR(4) DEFAULT 'TEST') +ENGINE='NDB'; +*** Create t1 on Master *** +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c CHAR(10) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +INSERT INTO t1 () VALUES(1,2,'TEXAS'),(2,1,'AUSTIN'),(3,4,'QA'); +SELECT * FROM t1 ORDER BY a; +a b c +1 2 TEXAS +2 1 AUSTIN +3 4 QA +*** Select from slave *** +SELECT * FROM t1 ORDER BY a; +a b c d e +1 2 TEXAS NULL NULL +2 1 AUSTIN NULL NULL +3 4 QA NULL NULL +*** Drop t1 *** +DROP TABLE t1; +*** Create t3 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20), +d FLOAT DEFAULT '2.00', +e CHAR(5) DEFAULT 'TEST2') +ENGINE='NDB'; +*** Create t3 on Master *** +CREATE TABLE t3 (a BLOB, b INT PRIMARY KEY, c CHAR(20) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING'); +******************************************** +*** Expect slave to fail with Error 1522 *** +******************************************** +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1523 +Last_Error Column 0 type mismatch - received type 252, test.t3 has type 3 +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +START SLAVE; +*** Drop t3 *** +DROP TABLE t3; +*** Create t4 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20), +d FLOAT DEFAULT '2.00', +e CHAR(5) DEFAULT 'TEST2') +ENGINE='NDB'; +*** Create t4 on Master *** +CREATE TABLE t4 (a DECIMAL(8,2), b INT PRIMARY KEY, c CHAR(20) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'), +(30000.22,4,'QA TESTING'); +******************************************** +*** Expect slave to fail with Error 1522 *** +******************************************** +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1523 +Last_Error Column 0 type mismatch - received type 246, test.t4 has type 3 +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +START SLAVE; +*** Drop t4 *** +DROP TABLE t4; +*** Create t5 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5), +c FLOAT, d INT, e DOUBLE, +f DECIMAL(8,2))ENGINE='NDB'; +*** Create t5 on Master *** +CREATE TABLE t5 (a INT PRIMARY KEY, b VARCHAR(6), +c DECIMAL(8,2), d BIT, e BLOB, +f FLOAT) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098), +(2,'JOE',300.01,0,'b2b2',1.0000009); +******************************************** +*** Expect slave to fail with Error 1522 *** +******************************************** +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1523 +Last_Error Column 5 type mismatch - received type 4, test.t5 has type 246 +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +START SLAVE; +*** Drop t5 *** +DROP TABLE t5; +*** Create t6 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5), +c FLOAT, d INT)ENGINE='NDB'; +*** Create t6 on Master *** +CREATE TABLE t6 (a INT PRIMARY KEY, b VARCHAR(6), +c DECIMAL(8,2), d BIT +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +INSERT INTO t6 () VALUES(1,'Kyle',200.23,1), +(2,'JOE',300.01,0); +******************************************** +*** Expect slave to fail with Error 1522 *** +******************************************** +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1523 +Last_Error Column 3 type mismatch - received type 16, test.t6 has type 3 +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; +*** Drop t6 *** +DROP TABLE t6; +DROP TABLE t6; +START SLAVE; +**** Diff Table Def End **** +**** Extra Colums Start **** +*** Create t7 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5), +d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00', +e CHAR(20) DEFAULT 'Extra Column Testing') +ENGINE='NDB'; +*** Create t7 on Master *** +CREATE TABLE t7 (a INT PRIMARY KEY, b BLOB, c CHAR(5) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t7 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); +SELECT * FROM t7 ORDER BY a; +a b c +1 b1b1 Kyle +2 b1b1 JOE +3 b1b1 QA +*** Select from slave *** +SELECT * FROM t7 ORDER BY a; +a b c d e +1 b1b1 Kyle NULL NULL +2 b1b1 JOE NULL NULL +3 b1b1 QA NULL NULL +*** Drop t7 *** +DROP TABLE t7; +*** Create t8 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5), +d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00', +e INT)ENGINE='NDB'; +*** Create t8 on Master *** +CREATE TABLE t8 (a INT PRIMARY KEY, b BLOB, c CHAR(5) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); +*** Drop t8 *** +DROP TABLE t8; +*** Create t10 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233', +c CHAR(5), e INT DEFAULT '1')ENGINE='NDB'; +*** Create t10 on Master *** +CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); +******************************************** +*** Expect slave to fail with Error 1522 *** +******************************************** +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1523 +Last_Error Column 2 type mismatch - received type 254, test.t10 has type 5 +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +START SLAVE; +*** Drop t10 *** +DROP TABLE t10; +*** Create t11 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT, +c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='NDB'; +*** Create t11 on Master *** +CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); +******************************************** +*** Expect slave to fail with Error 1522 *** +******************************************** +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1523 +Last_Error Column 2 type mismatch - received type 15, test.t11 has type 252 +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +START SLAVE; +*** Drop t11 *** +DROP TABLE t11; +*** Create t12 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT, +c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='NDB'; +*** Create t12 on Master *** +CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t12 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); +SELECT * FROM t12 ORDER BY a; +a b c +1 b1b1b1b1b1b1b1b1 Kyle +2 b1b1b1b1b1b1b1b1 JOE +3 b1b1b1b1b1b1b1b1 QA +*** Select on Slave *** +SELECT * FROM t12 ORDER BY a; +a b f c e +1 b1b1b1b1b1b1b1b1 Kyle NULL NULL +2 b1b1b1b1b1b1b1b1 JOE NULL NULL +3 b1b1b1b1b1b1b1b1 QA NULL NULL +*** Drop t12 *** +DROP TABLE t12; +**** Extra Colums End **** +*** BUG 22177 Start *** +*** Create t13 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5), +d INT DEFAULT '1', +e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +)ENGINE='NDB'; +*** Create t13 on Master *** +CREATE TABLE t13 (a INT PRIMARY KEY, b BLOB, c CHAR(5) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t13 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); +SELECT * FROM t13 ORDER BY a; +a b c +1 b1b1b1b1b1b1b1b1 Kyle +2 b1b1b1b1b1b1b1b1 JOE +3 b1b1b1b1b1b1b1b1 QA +*** Select on Slave **** +SELECT * FROM t13 ORDER BY a; +a b c d e +1 b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP +*** Drop t13 *** +DROP TABLE t13; +*** 22117 END *** +*** Alter Master Table Testing Start *** +*** Create t14 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5), +c6 INT DEFAULT '1', +c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +)ENGINE='NDB'; +*** Create t14 on Master *** +CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1; +ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2; +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'), +(2,2.00,'This Test Should work',@b1,'JOE'), +(3,3.00,'If is does not, I will open a bug',@b1,'QA'); +SELECT * FROM t14 ORDER BY c1; +c1 c2 c3 c4 c5 +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA +*** Select on Slave **** +SELECT * FROM t14 ORDER BY c1; +c1 c2 c3 c4 c5 c6 c7 +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP +*** connect to master and drop columns *** +ALTER TABLE t14 DROP COLUMN c2; +ALTER TABLE t14 DROP COLUMN c4; +*** Select from Master *** +SELECT * FROM t14 ORDER BY c1; +c1 c3 c5 +1 Replication Testing Extra Col Kyle +2 This Test Should work JOE +3 If is does not, I will open a bug QA +*** Select from Slave *** +SELECT * FROM t14 ORDER BY c1; +c1 c3 c5 c6 c7 +1 Replication Testing Extra Col Kyle NULL CURRENT_TIMESTAMP +2 This Test Should work JOE NULL CURRENT_TIMESTAMP +3 If is does not, I will open a bug QA NULL CURRENT_TIMESTAMP +*** Drop t14 *** +DROP TABLE t14; +*** Create t15 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT, +c4 BLOB, c5 CHAR(5), +c6 INT DEFAULT '1', +c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +)ENGINE='NDB'; +*** Create t15 on Master *** +CREATE TABLE t15 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT, +c4 BLOB, c5 CHAR(5)) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t15 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'), +(2,2.00,'This Test Should work',@b1,'JOE'), +(3,3.00,'If is does not, I will open a bug',@b1,'QA'); +SELECT * FROM t15 ORDER BY c1; +c1 c2 c3 c4 c5 +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA +*** Select on Slave **** +SELECT * FROM t15 ORDER BY c1; +c1 c2 c3 c4 c5 c6 c7 +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP +*** Add column on master that is a Extra on Slave *** +ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5; +******************************************** +*** Expect slave to fail with Error 1060 *** +******************************************** +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1060 +Last_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +START SLAVE; +*** Try to insert in master **** +INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2); +SELECT * FROM t15 ORDER BY c1; +c1 c2 c3 c4 c5 c6 +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL +5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2 +*** Try to select from slave **** +SELECT * FROM t15 ORDER BY c1; +c1 c2 c3 c4 c5 c6 c7 +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP +5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2 CURRENT_TIMESTAMP +*** DROP TABLE t15 *** +DROP TABLE t15; +*** Create t16 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT, +c4 BLOB, c5 CHAR(5), +c6 INT DEFAULT '1', +c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +)ENGINE='NDB'; +*** Create t16 on Master *** +CREATE TABLE t16 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT, +c4 BLOB, c5 CHAR(5))ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t16 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'), +(2,2.00,'This Test Should work',@b1,'JOE'), +(3,3.00,'If is does not, I will open a bug',@b1,'QA'); +SELECT * FROM t16 ORDER BY c1; +c1 c2 c3 c4 c5 +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA +*** Select on Slave **** +SELECT * FROM t16 ORDER BY c1; +c1 c2 c3 c4 c5 c6 c7 +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP +*** Add Partition on master *** +ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4; +INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer'); +SHOW CREATE TABLE t16; +Table Create Table +t16 CREATE TABLE `t16` ( + `c1` int(11) NOT NULL, + `c2` decimal(8,2) DEFAULT NULL, + `c3` text, + `c4` blob, + `c5` char(5) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c1) PARTITIONS 4 */ +*** Show table on Slave **** +SHOW CREATE TABLE t16; +Table Create Table +t16 CREATE TABLE `t16` ( + `c1` int(11) NOT NULL, + `c2` decimal(8,2) DEFAULT NULL, + `c3` text, + `c4` blob, + `c5` char(5) DEFAULT NULL, + `c6` int(11) DEFAULT '1', + `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`c1`) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c1) PARTITIONS 4 */ +*** DROP TABLE t16 *** +DROP TABLE t16; +*** Alter Master End *** +*** Create t17 on slave *** +STOP SLAVE; +RESET SLAVE; +CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5), +d FLOAT DEFAULT '2.00', +e CHAR(5) DEFAULT 'TEST2') +ENGINE='NDB'; +*** Create t17 on Master *** +CREATE TABLE t17 (a BIGINT PRIMARY KEY, b INT, c CHAR(10) +) ENGINE='NDB'; +RESET MASTER; +*** Start Slave *** +START SLAVE; +*** Master Data Insert *** +INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX'); +******************************************** +*** Expect slave to fail with Error 1522 *** +******************************************** +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1523 +Last_Error Column 0 type mismatch - received type 8, test.t17 has type 2 +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +START SLAVE; +** DROP table t17 *** +DROP TABLE t17; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result new file mode 100644 index 00000000000..ad72a3fb244 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result @@ -0,0 +1,29 @@ +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 FUNCTION IF EXISTS test.f1; +DROP TABLE IF EXISTS test.t1; +CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=NDB; +create function test.f1() RETURNS CHAR(16) +BEGIN +DECLARE tmp CHAR(16); +DECLARE var_name FLOAT; +SET var_name = RAND(); +IF var_name > .6 +THEN SET tmp = 'Texas'; +ELSE SET tmp = 'MySQL'; +END IF; +RETURN tmp; +END| +INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1()); +INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1()); +SET AUTOCOMMIT=0; +START TRANSACTION; +INSERT INTO test.t1 VALUES (null,test.f1()); +ROLLBACK; +SET AUTOCOMMIT=1; +DROP FUNCTION test.f1; +DROP TABLE test.t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result new file mode 100644 index 00000000000..2f2273c145e --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result @@ -0,0 +1,73 @@ +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 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ; +INSERT INTO t1 VALUES ("row1","will go away",1); +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row1 will go away 1 +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; +@the_epoch:=MAX(epoch) +<the_epoch> +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row1 will go away 1 +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) +<the_pos> master-bin.000001 +INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); +DELETE FROM t1 WHERE c3 = 1; +UPDATE t1 SET c2="should go away" WHERE c3 = 2; +UPDATE t1 SET c2="C" WHERE c3 = 3; +DELETE FROM t1 WHERE c3 = 2; +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row3 C 3 +row4 D 4 +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row3 C 3 +row4 D 4 +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 Master_SSL_Verify_Server_Cert +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No +STOP SLAVE; +CHANGE MASTER TO +master_log_file = 'master-bin.000001', +master_log_pos = <the_pos> ; +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 Master_SSL_Verify_Server_Cert +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 No No <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No +START SLAVE; +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row3 C 3 +row4 D 4 +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row3 C 3 +row4 D 4 +STOP SLAVE; +DROP TABLE t1; +RESET master; +DROP TABLE t1; +RESET slave; +START SLAVE; +CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ; +INSERT INTO t1 VALUES ("row1","remove on slave",1); +DELETE FROM t1; +BEGIN; +UPDATE t1 SET c2="does not exist" WHERE c3=1; +INSERT INTO t1 VALUES ("row2","new on slave",2); +COMMIT; +SELECT * FROM t1; +c1 c2 c3 +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 Master_SSL_Verify_Server_Cert +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No +DROP TABLE IF EXISTS 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 new file mode 100644 index 00000000000..148e6247b03 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result @@ -0,0 +1,103 @@ +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, unique(a)) engine=ndbcluster; +create table t2 (a int, unique(a)) engine=innodb; +begin; +insert into t1 values(1); +insert into t2 values(1); +rollback; +select count(*) from t1; +count(*) +0 +select count(*) from t2; +count(*) +0 +select count(*) from t1; +count(*) +0 +select count(*) from t2; +count(*) +0 +begin; +load data infile '../std_data_ln/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; +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 +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +select count(*) from t1; +count(*) +2 +select count(*) from t2; +count(*) +0 +select count(*) from t1; +count(*) +2 +select count(*) from t2; +count(*) +0 +delete from t1; +delete from t2; +begin; +load data infile '../std_data_ln/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; +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 +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +select count(*) from t1; +count(*) +2 +select count(*) from t2; +count(*) +0 +select count(*) from t1; +count(*) +2 +select count(*) from t2; +count(*) +0 +delete from t1; +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; +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; +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 +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +select count(*) from t1; +count(*) +4 +select count(*) from t2; +count(*) +0 +select count(*) from t1; +count(*) +4 +select count(*) from t2; +count(*) +0 +drop table t1,t2; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result new file mode 100644 index 00000000000..030845e89e2 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result @@ -0,0 +1,70 @@ +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 unsigned not null auto_increment primary key, +b int unsigned, +unique (b) +) ENGINE=NDB; +CREATE TABLE t2 ( +a int unsigned, # to force INSERT SELECT to have a certain order +b int unsigned +) ENGINE=NDB; +INSERT INTO t1 VALUES (NULL, 1); +INSERT INTO t1 VALUES (NULL, 2); +INSERT INTO t1 VALUES (NULL, 3); +INSERT INTO t1 VALUES (NULL, 4); +INSERT INTO t2 VALUES (1, 1); +INSERT INTO t2 VALUES (2, 2); +INSERT INTO t2 VALUES (3, 5); +INSERT INTO t2 VALUES (4, 3); +INSERT INTO t2 VALUES (5, 4); +INSERT INTO t2 VALUES (6, 6); +INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a; +SELECT * FROM t1 ORDER BY a; +a b +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +SELECT * FROM t1 ORDER BY a; +a b +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +drop table t1; +CREATE TABLE t1 ( +a int unsigned not null auto_increment primary key, +b int unsigned, +unique (b) +) ENGINE=myisam; +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a; +SELECT * FROM t1 ORDER BY a; +a b +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +SELECT * FROM t1 ORDER BY a; +a b +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +drop table t1, t2; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_load.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_load.result new file mode 100644 index 00000000000..e51f0096557 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_load.result @@ -0,0 +1,42 @@ +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 DATABASE IF EXISTS TEST_DB; +CREATE DATABASE TEST_DB; +USE TEST_DB; +CREATE TABLE SUBSCRIBER +( NUMBER CHAR(12) BINARY NOT NULL, +NAME CHAR(32) BINARY NOT NULL, +GROUP_ID INT UNSIGNED NOT NULL, +LOCATION INT UNSIGNED NOT NULL, +SESSIONS INT UNSIGNED NOT NULL, +CHANGED_BY CHAR(32) BINARY NOT NULL, +CHANGED_TIME CHAR(32) BINARY NOT NULL, +PRIMARY KEY USING HASH (NUMBER)) +ENGINE = NDB; +CREATE TABLE GROUP2 +( GROUP_ID INT UNSIGNED NOT NULL, +GROUP_NAME CHAR(32) BINARY NOT NULL, +ALLOW_READ CHAR(1) BINARY NOT NULL, +ALLOW_INSERT INT UNSIGNED NOT NULL, +ALLOW_DELETE INT UNSIGNED NOT NULL, +PRIMARY KEY USING HASH (GROUP_ID)) +ENGINE = NDB; +CREATE TABLE SESSION +( NUMBER CHAR(12) BINARY NOT NULL, +SERVER_ID INT UNSIGNED NOT NULL, +DATA BINARY(2000) NOT NULL, +PRIMARY KEY USING HASH (NUMBER,SERVER_ID)) +ENGINE = NDB; +CREATE TABLE SERVER +( SUFFIX CHAR(2) BINARY NOT NULL, +SERVER_ID INT UNSIGNED NOT NULL, +NAME CHAR(32) BINARY NOT NULL, +NO_OF_READ INT UNSIGNED NOT NULL, +NO_OF_INSERT INT UNSIGNED NOT NULL, +NO_OF_DELETE INT UNSIGNED NOT NULL, +PRIMARY KEY USING HASH (SUFFIX, SERVER_ID)) +ENGINE = NDB; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result new file mode 100644 index 00000000000..db2ce27d43b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result @@ -0,0 +1,151 @@ +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; +stop slave; +reset master; +reset slave; +reset master; +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; +select count(*) from t1; +count(*) +69 +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows 1 # table_id: # +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # COMMIT +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows 1 # table_id: # +master-bin.000001 # Write_rows 1 # table_id: # +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # COMMIT +show binlog events from 106 limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +show binlog events from 106 limit 2; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +master-bin.000001 # Query 1 # BEGIN +show binlog events from 106 limit 2,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Table_map 1 # table_id: # (test.t1) +flush logs; +create table t3 (a int)ENGINE=NDB; +start slave; + +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 +flush logs; +stop slave; +create table t2 (n int)ENGINE=NDB; +insert into t2 values (1); +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(n int not null auto_increment primary key)ENGINE=NDB +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table t1 +master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Rotate # # master-bin.000002;pos=4 +show binlog events in 'master-bin.000002'; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 +master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB +master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB +master-bin.000002 # Query 1 # BEGIN +master-bin.000002 # Table_map 1 # table_id: # (test.t2) +master-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +master-bin.000002 # Write_rows 1 # table_id: # +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 1775 +master-bin.000002 617 +start slave; +show binary logs; +Log_name File_size +slave-bin.000001 1870 +slave-bin.000002 202 +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 +slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +slave-bin.000001 # Query 2 # BEGIN +slave-bin.000001 # Table_map 2 # table_id: # (test.t1) +slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +slave-bin.000001 # Write_rows 2 # table_id: # +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 2 # COMMIT +slave-bin.000001 # Query 1 # use `test`; drop table t1 +slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB +slave-bin.000001 # Query 2 # BEGIN +slave-bin.000001 # Table_map 2 # table_id: # (test.t1) +slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +slave-bin.000001 # Write_rows 2 # table_id: # +slave-bin.000001 # Write_rows 1 # table_id: # +slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000001 # Query 2 # COMMIT +slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB +slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 +show binlog events in 'slave-bin.000002' from 4; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB +slave-bin.000002 # Query 2 # BEGIN +slave-bin.000002 # Table_map 2 # table_id: # (test.t2) +slave-bin.000002 # Table_map 2 # table_id: # (mysql.ndb_apply_status) +slave-bin.000002 # Write_rows 2 # table_id: # +slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F +slave-bin.000002 # Query 2 # COMMIT +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 Master_SSL_Verify_Server_Cert +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 617 # # master-bin.000002 Yes Yes # 0 0 617 # None 0 No # No +show binlog events in 'slave-bin.000005' from 4; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +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 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +select * from t1; +a b +1 1 +5 1 +6 1 +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result new file mode 100644 index 00000000000..760114f3639 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result @@ -0,0 +1,55 @@ +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 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ; +reset master; +SHOW TABLES; +Tables_in_test +t1 +INSERT INTO t1 VALUES ("row1","will go away",1); +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row1 will go away 1 +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row1 will go away 1 +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; +@the_epoch:=MAX(epoch) +<the_epoch> +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row1 will go away 1 +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 +CHANGE MASTER TO +master_port=<MASTER_PORT1>, +master_log_file = 'master-bin1.000001', +master_log_pos = 106 ; +start slave; +INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); +DELETE FROM t1 WHERE c3 = 1; +UPDATE t1 SET c2="should go away" WHERE c3 = 2; +UPDATE t1 SET c2="C" WHERE c3 = 3; +DELETE FROM t1 WHERE c3 = 2; +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row3 C 3 +row4 D 4 +INSERT INTO t1 VALUES ("row5","E",5); +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row3 C 3 +row4 D 4 +row5 E 5 +SELECT * FROM t1 ORDER BY c3; +c1 c2 c3 +row3 C 3 +row4 D 4 +row5 E 5 +STOP SLAVE; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result new file mode 100644 index 00000000000..5d00ae6598c --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result @@ -0,0 +1,55 @@ +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 t1,t2; +CREATE TABLE t1 ( +a int unsigned not null auto_increment primary key, +b int unsigned +) ENGINE=NDB; +CREATE TABLE t2 ( +a int unsigned not null auto_increment primary key, +b int unsigned +) ENGINE=NDB; +INSERT INTO t1 VALUES (NULL, 0); +INSERT INTO t1 SELECT NULL, 0 FROM t1; +INSERT INTO t2 VALUES (NULL, 0), (NULL,1); +SELECT * FROM t1 ORDER BY a; +a b +1 0 +2 0 +SELECT * FROM t2 ORDER BY a; +a b +1 0 +2 1 +UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a; +SELECT * FROM t1 ORDER BY a; +a b +1 4 +2 5 +SELECT * FROM t2 ORDER BY a; +a b +1 0 +2 1 +SELECT * FROM t1 ORDER BY a; +a b +1 4 +2 5 +SELECT * FROM t2 ORDER BY a; +a b +1 0 +2 1 +drop table t1,t2; +reset master; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (0); +UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b; +select * from t1; +a +3 +select * from t1; +a +3 +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result new file mode 100644 index 00000000000..dc4e11c9c9e --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result @@ -0,0 +1,197 @@ +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; + +-------- Test for BUG#9361 -------- +CREATE TABLE t1 ( +a int unsigned not null auto_increment primary key, +b int unsigned +) ENGINE=NDB; +CREATE TABLE t2 ( +a int unsigned not null auto_increment primary key, +b int unsigned +) ENGINE=NDB; +INSERT INTO t1 VALUES (NULL, 0); +INSERT INTO t1 SELECT NULL, 0 FROM t1; +INSERT INTO t2 VALUES (NULL, 0), (NULL,1); +SELECT * FROM t1 ORDER BY a; +a b +1 0 +2 0 +SELECT * FROM t2 ORDER BY a; +a b +1 0 +2 1 +UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ; +SELECT * FROM t1 ORDER BY a; +a b +1 0 +2 0 +SELECT * FROM t2 ORDER BY a; +a b +1 6 +2 6 +SELECT * FROM t1 ORDER BY a; +a b +1 0 +2 0 +SELECT * FROM t2 ORDER BY a; +a b +1 6 +2 6 +drop table t1,t2; + +-------- Test 1 for BUG#9361 -------- +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1 ( +a1 char(30), +a2 int, +a3 int, +a4 char(30), +a5 char(30) +); +CREATE TABLE t2 ( +b1 int, +b2 char(30) +); +INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar'); +INSERT INTO t2 VALUES (1, 'baz'); +UPDATE t1 a, t2 +SET a.a1 = 'No' +WHERE a.a2 = +(SELECT b1 +FROM t2 +WHERE b2 = 'baz') +AND a.a3 IS NULL +AND a.a4 = 'foo' +AND a.a5 = 'bar'; +SELECT * FROM t1; +a1 a2 a3 a4 a5 +No 1 NULL foo bar +SELECT * FROM t2; +b1 b2 +1 baz +DROP TABLE t1, t2; + +-------- Test 2 for BUG#9361 -------- +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t3; +CREATE TABLE t1 ( +i INT, +j INT, +x INT, +y INT, +z INT +); +CREATE TABLE t2 ( +i INT, +k INT, +x INT, +y INT, +z INT +); +CREATE TABLE t3 ( +j INT, +k INT, +x INT, +y INT, +z INT +); +INSERT INTO t1 VALUES ( 1, 2,13,14,15); +INSERT INTO t2 VALUES ( 1, 3,23,24,25); +INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36); +UPDATE t1 AS a +INNER JOIN t2 AS b +ON a.i = b.i +INNER JOIN t3 AS c +ON a.j = c.j AND b.k = c.k +SET a.x = b.x, +a.y = b.y, +a.z = ( +SELECT sum(z) +FROM t3 +WHERE y = 34 +) +WHERE b.x = 23; +SELECT * FROM t1; +i j x y z +1 2 23 24 71 +DROP TABLE t1, t2, t3; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +DROP TABLE IF EXISTS t2; +Warnings: +Note 1051 Unknown table 't2' +CREATE TABLE t1 ( +idp int(11) NOT NULL default '0', +idpro int(11) default NULL, +price decimal(19,4) default NULL, +PRIMARY KEY (idp) +); +CREATE TABLE t2 ( +idpro int(11) NOT NULL default '0', +price decimal(19,4) default NULL, +nbprice int(11) default NULL, +PRIMARY KEY (idpro) +); +INSERT INTO t1 VALUES +(1,1,'3.0000'), +(2,2,'1.0000'), +(3,1,'1.0000'), +(4,1,'4.0000'), +(5,3,'2.0000'), +(6,2,'4.0000'); +INSERT INTO t2 VALUES +(1,'0.0000',0), +(2,'0.0000',0), +(3,'0.0000',0); +update +t2 +join +( select idpro, min(price) as min_price, count(*) as nbr_price +from t1 +where idpro>0 and price>0 +group by idpro +) as table_price +on t2.idpro = table_price.idpro +set t2.price = table_price.min_price, +t2.nbprice = table_price.nbr_price; +select "-- MASTER AFTER JOIN --" as ""; + +-- MASTER AFTER JOIN -- +select * from t1; +idp idpro price +1 1 3.0000 +2 2 1.0000 +3 1 1.0000 +4 1 4.0000 +5 3 2.0000 +6 2 4.0000 +select * from t2; +idpro price nbprice +1 1.0000 3 +2 1.0000 2 +3 2.0000 1 +select "-- SLAVE AFTER JOIN --" as ""; + +-- SLAVE AFTER JOIN -- +select * from t1; +idp idpro price +1 1 3.0000 +2 2 1.0000 +3 1 1.0000 +4 1 4.0000 +5 3 2.0000 +6 2 4.0000 +select * from t2; +idpro price nbprice +1 1.0000 3 +2 1.0000 2 +3 2.0000 1 +DROP TABLE t1, t2; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_relayrotate.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_relayrotate.result new file mode 100644 index 00000000000..6aa64973611 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_relayrotate.result @@ -0,0 +1,16 @@ +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; +stop slave; +create table t1 (a int) engine=NDB; +reset slave; +start slave; +stop slave; +start slave; +select max(a) from t1; +max(a) +8000 +drop table t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result new file mode 100644 index 00000000000..4e28a7e5865 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result @@ -0,0 +1,54 @@ +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 DATABASE IF EXISTS replica; +CREATE DATABASE replica; +CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +USE replica; +CREATE TABLE replica.t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE replica.t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +USE test; +INSERT INTO t1 VALUES(1, repeat('abc',10)); +INSERT INTO t2 VALUES(1, repeat('abc',10)); +SHOW TABLES; +Tables_in_test +t1 +t2 +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT COUNT(*) FROM t2; +COUNT(*) +1 +USE replica; +INSERT INTO replica.t1 VALUES(2, repeat('def',200)); +INSERT INTO replica.t2 VALUES(2, repeat('def',200)); +SHOW TABLES; +Tables_in_replica +t1 +t2 +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT COUNT(*) FROM t2; +COUNT(*) +1 +SHOW TABLES; +Tables_in_test +USE replica; +SHOW TABLES; +Tables_in_replica +t2 +SELECT COUNT(*) FROM t2; +COUNT(*) +1 +USE test; +SHOW TABLES; +Tables_in_test +USE test; +DROP TABLE t1, t2; +DROP DATABASE IF EXISTS replica; 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 new file mode 100644 index 00000000000..56bb31e329d --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result @@ -0,0 +1,55 @@ +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 (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; +SELECT * FROM t1 ORDER BY word LIMIT 10; +word +Aarhus +Aarhus +Aarhus +Aarhus +Aaron +Aaron +Aaron +Aaron +Ababa +Ababa +STOP SLAVE; +SET PASSWORD FOR root@"localhost" = PASSWORD('foo'); +START SLAVE; +SET PASSWORD FOR root@"localhost" = PASSWORD(''); +CREATE TABLE t3(n INT); +INSERT INTO t3 VALUES(1),(2); +SELECT * FROM t3 ORDER BY n; +n +1 +2 +SELECT SUM(LENGTH(word)) FROM t1; +SUM(LENGTH(word)) +1022 +DROP TABLE t1,t3; +CREATE TABLE t1 (n INT) ENGINE=NDB; +RESET MASTER; +STOP SLAVE; +RESET SLAVE; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +LOCK TABLES t1 READ; +START SLAVE; +UNLOCK TABLES; +SELECT COUNT(*) FROM t1; +COUNT(*) +5000 +DROP TABLE t1; +CREATE TABLE t1 (n INT); +INSERT INTO t1 VALUES(3456); +SELECT n FROM t1; +n +3456 +DROP TABLE t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result new file mode 100644 index 00000000000..d7922c61b52 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/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/suite/rpl_ndb/r/rpl_ndb_sp006.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result new file mode 100644 index 00000000000..482d43c8f10 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result @@ -0,0 +1,46 @@ +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)<RIGHT(birth,5)) +FROM mysqltest1.t1; +DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; +OPEN cur1; +SET AUTOCOMMIT=0; +REPEAT +FETCH cur1 INTO spa, spb; +IF NOT done THEN +START TRANSACTION; +INSERT INTO mysqltest1.t2 VALUES (spa,spb); +COMMIT; +END IF; +UNTIL done END REPEAT; +SET AUTOCOMMIT=1; +CLOSE cur1; +END| +CREATE PROCEDURE mysqltest1.p2() +BEGIN +INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1'); +END| +CALL mysqltest1.p2(); +CALL mysqltest1.p1(); +DROP PROCEDURE IF EXISTS mysqltest1.p1; +DROP PROCEDURE IF EXISTS mysqltest1.p2; +DROP TABLE IF EXISTS mysqltest1.t1; +DROP TABLE IF EXISTS mysqltest1.t2; +DROP DATABASE mysqltest1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result new file mode 100644 index 00000000000..9ed54a11c1c --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result @@ -0,0 +1,37 @@ +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 key, b int) engine innodb; +create table t2 (a int key, b int) engine innodb; +alter table t1 engine ndb; +alter table t2 engine ndb; +insert into t1 values (1,2); +select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; +@start_pos:=start_pos @end_pos:=end_pos +<start_pos> <end_pos> +show binlog events from <start_pos> limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 <start_pos> Query 1 # use `test`; insert into t1 values (1,2) +show binlog events from <start_pos> limit 1,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Xid 1 445 COMMIT /* XID */ +begin; +insert into t1 values (2,3); +insert into t2 values (3,4); +commit; +select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; +@start_pos:=start_pos @end_pos:=end_pos +<start_pos> <end_pos> +show binlog events from <start_pos> limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 <start_pos> Query 1 # use `test`; BEGIN +show binlog events from <start_pos> limit 1,2; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; insert into t1 values (2,3) +master-bin.000001 # Query # # use `test`; insert into t2 values (3,4) +show binlog events from <start_pos> limit 3,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result new file mode 100644 index 00000000000..f2797eaa623 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result @@ -0,0 +1,96 @@ +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; +STOP SLAVE; +CREATE DATABASE ndbsynctest; +USE ndbsynctest; +CREATE DATABASE ndbsynctest; +USE ndbsynctest; +CREATE TABLE t1 (c1 BIT(1) NOT NULL, c2 BIT(1) NOT NULL, c3 CHAR(15), PRIMARY KEY(c3)) ENGINE = NDB ; +INSERT INTO t1 VALUES (1,1,"row1"),(0,1,"row2"),(1,0,"row3"),(0,0,"row4"); +CREATE TABLE t2 (c1 CHAR(15), c2 BIT(1) NOT NULL, c3 BIT(1) NOT NULL, PRIMARY KEY(c1)) ENGINE = NDB ; +INSERT INTO t2 VALUES ("ABC",1,1),("BCDEF",0,1),("CD",1,0),("DEFGHIJKL",0,0); +SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; +hex(c1) hex(c2) c3 +1 1 row1 +0 1 row2 +1 0 row3 +0 0 row4 +SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; +hex(c2) hex(c3) c1 +1 1 ABC +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> +DROP TABLE test.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 +1 1 row1 +0 0 row2 +1 0 row3 +0 0 row4 +SHOW TABLES; +Tables_in_ndbsynctest +DROP DATABASE ndbsynctest; +CREATE DATABASE ndbsynctest; +USE ndbsynctest; +SHOW TABLES; +Tables_in_ndbsynctest +t1 +t2 +SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; +hex(c1) hex(c2) c3 +1 1 row1 +0 1 row2 +1 0 row3 +0 0 row4 +SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; +hex(c2) hex(c3) c1 +1 1 ABC +0 1 BCDEF +1 0 CD +0 0 DEFGHIJKL +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; +@the_epoch:=MAX(epoch) +<the_epoch> +SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) +FROM mysql.ndb_binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1; +@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) +<the_pos> master-bin.000001 +CHANGE MASTER TO +master_log_file = 'master-bin.000001', +master_log_pos = <the_pos> ; +START SLAVE; +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 Master_SSL_Verify_Server_Cert +<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No +SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; +hex(c1) hex(c2) c3 +1 1 row1 +0 0 row2 +1 0 row3 +0 0 row4 +SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; +hex(c2) hex(c3) c1 +1 1 ABC +0 1 BCDEF +1 0 CD +0 0 DEFGHIJKL +DROP DATABASE ndbsynctest; +STOP SLAVE; +reset master; +select * from mysql.ndb_binlog_index; +Position File epoch inserts updates deletes schemaops +reset slave; +select * from mysql.ndb_apply_status; +server_id epoch log_name start_pos end_pos diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result new file mode 100644 index 00000000000..ba5f0dea91c --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result @@ -0,0 +1,30 @@ +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 TRIGGER test.t1_bi_t2; +DROP TABLE IF EXISTS test.t1; +DROP TABLE IF EXISTS test.t2; +CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=NDB; +CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=NDB; +CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)// +INSERT INTO test.t2 VALUES (1, 0.0); +INSERT INTO test.t2 VALUES (1, 0.0); +Got one of the listed errors +select * from test.t1; +n d +1 1.234 +select * from test.t2; +n f +1 0 +select * from test.t1; +n d +1 1.234 +select * from test.t2; +n f +1 0 +DROP TRIGGER test.t1_bi_t2; +DROP TABLE test.t1; +DROP TABLE test.t2; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndbapi_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndbapi_multi.result new file mode 100644 index 00000000000..5de6914882d --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndbapi_multi.result @@ -0,0 +1,8 @@ +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; +Running ndbapi_simple_dual +Running mgmapi_logevent 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 new file mode 100644 index 00000000000..5519e0dcd0c --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result @@ -0,0 +1,418 @@ +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 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'NDB' ; +SELECT * FROM t1; +C1 C2 +SELECT * FROM t1; +C1 C2 +INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X'); +INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A'); +SELECT * FROM t1 ORDER BY C1,C2; +C1 C2 +A A +A B +A C +X X +X Y +X Z +SELECT * FROM t1 ORDER BY C1,C2; +C1 C2 +A A +A B +A C +X X +X Y +X Z +DELETE FROM t1 WHERE C1 = C2; +SELECT * FROM t1 ORDER BY C1,C2; +C1 C2 +A B +A C +X Y +X Z +SELECT * FROM t1 ORDER BY C1,C2; +C1 C2 +A B +A C +X Y +X Z +UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C'; +SELECT * FROM t1 ORDER BY C1,C2; +C1 C2 +A B +A I +X Y +X Z +SELECT * FROM t1 ORDER BY C1,C2; +C1 C2 +A B +A I +X Y +X Z +UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N'; +SELECT * FROM t1 ORDER BY c1,c2; +C1 C2 +A B +A I +X Y +X Z +SELECT * FROM t1 ORDER BY c1,c2; +C1 C2 +A B +A I +X Y +X Z +CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'NDB' ; +INSERT INTO t2 +VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25), +(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81); +SELECT * FROM t2 ORDER BY c1,c2; +c1 c12 c2 +1 A 2 +2 A 4 +3 A 9 +4 A 15 +5 A 25 +6 A 35 +7 A 50 +8 A 64 +9 A 81 +SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; +c1 c12 c2 +2 A 4 +3 A 9 +5 A 25 +8 A 64 +9 A 81 +SELECT * FROM t2 ORDER BY c1,c2; +c1 c12 c2 +1 A 2 +2 A 4 +3 A 9 +4 A 15 +5 A 25 +6 A 35 +7 A 50 +8 A 64 +9 A 81 +SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; +c1 c12 c2 +2 A 4 +3 A 9 +5 A 25 +8 A 64 +9 A 81 +UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1; +SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; +c1 c12 c2 +1 A 1 +2 A 4 +3 A 9 +4 A 16 +5 A 25 +6 A 36 +7 A 49 +8 A 64 +9 A 81 +SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; +c1 c12 c2 +1 A 1 +2 A 4 +3 A 9 +4 A 16 +5 A 25 +6 A 36 +7 A 49 +8 A 64 +9 A 81 +UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999; +SELECT * FROM t2 ORDER BY c1,c2; +c1 c12 c2 +1 A 1 +2 A 4 +3 A 9 +4 A 16 +5 A 25 +6 A 36 +7 A 49 +8 A 64 +9 A 81 +SELECT * FROM t2 ORDER BY c1,c2; +c1 c12 c2 +1 A 1 +2 A 4 +3 A 9 +4 A 16 +5 A 25 +6 A 36 +7 A 49 +8 A 64 +9 A 81 +DELETE FROM t2 WHERE c1 % 4 = 0; +SELECT * FROM t2 ORDER BY c1,c2; +c1 c12 c2 +1 A 1 +2 A 4 +3 A 9 +5 A 25 +6 A 36 +7 A 49 +9 A 81 +SELECT * FROM t2 ORDER BY c1,c2; +c1 c12 c2 +1 A 1 +2 A 4 +3 A 9 +5 A 25 +6 A 36 +7 A 49 +9 A 81 +UPDATE t2 SET c12='X'; +CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'NDB' ; +INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1); +INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2); +SELECT * FROM t3 ORDER BY C1,C2; +C1 C2 pk1 C3 pk2 +A A 3 B 2 +A B 1 B 1 +A C 1 B 2 +X X 3 B 1 +X Y 2 B 1 +X Z 2 B 2 +SELECT * FROM t3 ORDER BY C1,C2; +C1 C2 pk1 C3 pk2 +A A 3 B 2 +A B 1 B 1 +A C 1 B 2 +X X 3 B 1 +X Y 2 B 1 +X Z 2 B 2 +DELETE FROM t3 WHERE C1 = C2; +SELECT * FROM t3 ORDER BY C1,C2; +C1 C2 pk1 C3 pk2 +A B 1 B 1 +A C 1 B 2 +X Y 2 B 1 +X Z 2 B 2 +SELECT * FROM t3 ORDER BY C1,C2; +C1 C2 pk1 C3 pk2 +A B 1 B 1 +A C 1 B 2 +X Y 2 B 1 +X Z 2 B 2 +UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C'; +SELECT * FROM t3 ORDER BY C1,C2; +C1 C2 pk1 C3 pk2 +A B 1 B 1 +A I 1 B 2 +X Y 2 B 1 +X Z 2 B 2 +SELECT * FROM t3 ORDER BY C1,C2; +C1 C2 pk1 C3 pk2 +A B 1 B 1 +A I 1 B 2 +X Y 2 B 1 +X Z 2 B 2 +CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'NDB' ; +INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3); +INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6); +SELECT * FROM t6 ORDER BY C3; +C1 C2 C3 +A B 1 +X Y 2 +X X 3 +A C 4 +X Z 5 +A A 6 +SELECT * FROM t6 ORDER BY C3; +C1 C2 C3 +A B 1 +X Y 2 +X X 3 +A C 4 +X Z 5 +A A 6 +DELETE FROM t6 WHERE C1 = C2; +SELECT * FROM t6 ORDER BY C3; +C1 C2 C3 +A B 1 +X Y 2 +A C 4 +X Z 5 +SELECT * FROM t6 ORDER BY C3; +C1 C2 C3 +A B 1 +X Y 2 +A C 4 +X Z 5 +UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C'; +SELECT * FROM t6 ORDER BY C3; +C1 C2 C3 +A B 1 +X Y 2 +A I 4 +X Z 5 +SELECT * FROM t6 ORDER BY C3; +C1 C2 C3 +A B 1 +X Y 2 +A I 4 +X Z 5 +CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'NDB' ; +INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3); +INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6); +UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1; +SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2; +C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2 +X Q 2 1 R 1 X Y 2 S 1 +X Q 2 1 R 1 X Z 2 S 2 +X Q 2 2 R 4 X Y 2 S 1 +X Q 2 2 R 4 X Z 2 S 2 +X Q 2 3 R 9 X Y 2 S 1 +X Q 2 3 R 9 X Z 2 S 2 +X Q 2 5 R 25 X Y 2 S 1 +X Q 2 5 R 25 X Z 2 S 2 +X Q 2 6 R 36 X Y 2 S 1 +X Q 2 6 R 36 X Z 2 S 2 +X Q 2 7 R 49 X Y 2 S 1 +X Q 2 7 R 49 X Z 2 S 2 +X Q 2 9 R 81 X Y 2 S 1 +X Q 2 9 R 81 X Z 2 S 2 +X Q 3 1 R 1 X Y 2 S 1 +X Q 3 1 R 1 X Z 2 S 2 +X Q 3 2 R 4 X Y 2 S 1 +X Q 3 2 R 4 X Z 2 S 2 +X Q 3 3 R 9 X Y 2 S 1 +X Q 3 3 R 9 X Z 2 S 2 +X Q 3 5 R 25 X Y 2 S 1 +X Q 3 5 R 25 X Z 2 S 2 +X Q 3 6 R 36 X Y 2 S 1 +X Q 3 6 R 36 X Z 2 S 2 +X Q 3 7 R 49 X Y 2 S 1 +X Q 3 7 R 49 X Z 2 S 2 +X Q 3 9 R 81 X Y 2 S 1 +X Q 3 9 R 81 X Z 2 S 2 +X Q 5 1 R 1 X Y 2 S 1 +X Q 5 1 R 1 X Z 2 S 2 +X Q 5 2 R 4 X Y 2 S 1 +X Q 5 2 R 4 X Z 2 S 2 +X Q 5 3 R 9 X Y 2 S 1 +X Q 5 3 R 9 X Z 2 S 2 +X Q 5 5 R 25 X Y 2 S 1 +X Q 5 5 R 25 X Z 2 S 2 +X Q 5 6 R 36 X Y 2 S 1 +X Q 5 6 R 36 X Z 2 S 2 +X Q 5 7 R 49 X Y 2 S 1 +X Q 5 7 R 49 X Z 2 S 2 +X Q 5 9 R 81 X Y 2 S 1 +X Q 5 9 R 81 X Z 2 S 2 +SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2; +C1 C2 C3 c1 c12 c2 C1 C2 pk1 C3 pk2 +X Q 2 1 R 1 X Y 2 S 1 +X Q 2 1 R 1 X Z 2 S 2 +X Q 2 2 R 4 X Y 2 S 1 +X Q 2 2 R 4 X Z 2 S 2 +X Q 2 3 R 9 X Y 2 S 1 +X Q 2 3 R 9 X Z 2 S 2 +X Q 2 5 R 25 X Y 2 S 1 +X Q 2 5 R 25 X Z 2 S 2 +X Q 2 6 R 36 X Y 2 S 1 +X Q 2 6 R 36 X Z 2 S 2 +X Q 2 7 R 49 X Y 2 S 1 +X Q 2 7 R 49 X Z 2 S 2 +X Q 2 9 R 81 X Y 2 S 1 +X Q 2 9 R 81 X Z 2 S 2 +X Q 3 1 R 1 X Y 2 S 1 +X Q 3 1 R 1 X Z 2 S 2 +X Q 3 2 R 4 X Y 2 S 1 +X Q 3 2 R 4 X Z 2 S 2 +X Q 3 3 R 9 X Y 2 S 1 +X Q 3 3 R 9 X Z 2 S 2 +X Q 3 5 R 25 X Y 2 S 1 +X Q 3 5 R 25 X Z 2 S 2 +X Q 3 6 R 36 X Y 2 S 1 +X Q 3 6 R 36 X Z 2 S 2 +X Q 3 7 R 49 X Y 2 S 1 +X Q 3 7 R 49 X Z 2 S 2 +X Q 3 9 R 81 X Y 2 S 1 +X Q 3 9 R 81 X Z 2 S 2 +X Q 5 1 R 1 X Y 2 S 1 +X Q 5 1 R 1 X Z 2 S 2 +X Q 5 2 R 4 X Y 2 S 1 +X Q 5 2 R 4 X Z 2 S 2 +X Q 5 3 R 9 X Y 2 S 1 +X Q 5 3 R 9 X Z 2 S 2 +X Q 5 5 R 25 X Y 2 S 1 +X Q 5 5 R 25 X Z 2 S 2 +X Q 5 6 R 36 X Y 2 S 1 +X Q 5 6 R 36 X Z 2 S 2 +X Q 5 7 R 49 X Y 2 S 1 +X Q 5 7 R 49 X Z 2 S 2 +X Q 5 9 R 81 X Y 2 S 1 +X Q 5 9 R 81 X Z 2 S 2 +CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'NDB' ; +INSERT INTO t4 SET C1 = 1; +SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; +C1 HEX(B1) HEX(B2) +1 NULL 0 +SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; +C1 HEX(B1) HEX(B2) +1 NULL 0 +CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'NDB' ; +--- on slave: original values --- +INSERT INTO t7 VALUES (1,3), (2,6), (3,9); +SELECT * FROM t7 ORDER BY C1; +C1 C2 +1 3 +2 6 +3 9 +--- on master: new values inserted --- +INSERT INTO t7 VALUES (1,2), (2,4), (3,6); +SELECT * FROM t7 ORDER BY C1; +C1 C2 +1 2 +2 4 +3 6 +--- on slave: old values should be overwritten by replicated values --- +SELECT * FROM t7 ORDER BY C1; +C1 C2 +1 2 +2 4 +3 6 +--- on master --- +CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'NDB' ; +INSERT INTO t8 VALUES (99,99,99); +INSERT INTO t8 VALUES (99,22,33); +ERROR 23000: Duplicate entry '99' for key 'PRIMARY' +INSERT INTO t8 VALUES (11,99,33); +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +INSERT INTO t8 VALUES (11,22,99); +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +SELECT * FROM t8 ORDER BY a; +a b c +99 99 99 +--- on slave --- +SELECT * FROM t8 ORDER BY a; +a b c +99 99 99 +INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9); +SELECT * FROM t8 ORDER BY a; +a b c +1 2 3 +2 4 6 +3 6 9 +99 99 99 +--- on master --- +INSERT INTO t8 VALUES (2,4,8); +--- on slave --- +SELECT * FROM t8 ORDER BY a; +a b c +1 2 3 +2 4 8 +3 6 9 +99 99 99 +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result new file mode 100644 index 00000000000..62ace911e45 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result @@ -0,0 +1,95 @@ +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; +**** On Master **** +CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; +INSERT INTO t1 VALUES (1,1), (2,2); +SELECT * FROM t1 ORDER BY a,b; +a b +1 1 +2 2 +**** On Slave **** +INSERT INTO t1 VALUE (3,3); +SELECT * FROM t1 ORDER BY a,b; +a b +1 1 +2 2 +3 3 +**** On Master **** +TRUNCATE TABLE t1; +SELECT * FROM t1 ORDER BY a,b; +a b +**** On Slave **** +SELECT * FROM t1 ORDER BY a,b; +a b +**** On Master **** +DROP TABLE t1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 223 Query 1 287 BEGIN +master-bin.000001 287 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status) +master-bin.000001 385 Write_rows 1 157 table_id: # +master-bin.000001 444 Write_rows 1 195 table_id: # +master-bin.000001 482 Write_rows 1 233 table_id: # flags: STMT_END_F +master-bin.000001 520 Query 1 585 COMMIT +master-bin.000001 585 Query 1 665 use `test`; TRUNCATE TABLE t1 +master-bin.000001 665 Query 1 741 use `test`; DROP TABLE t1 +**** On Master **** +CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; +INSERT INTO t1 VALUES (1,1), (2,2); +SELECT * FROM t1 ORDER BY a,b; +a b +1 1 +2 2 +**** On Slave **** +INSERT INTO t1 VALUE (3,3); +SELECT * FROM t1 ORDER BY a,b; +a b +1 1 +2 2 +3 3 +**** On Master **** +DELETE FROM t1; +SELECT * FROM t1 ORDER BY a,b; +a b +**** On Slave **** +SELECT * FROM t1 ORDER BY a,b; +a b +3 3 +**** On Master **** +DROP TABLE t1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 223 Query 1 287 BEGIN +master-bin.000001 287 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status) +master-bin.000001 385 Write_rows 1 157 table_id: # +master-bin.000001 444 Write_rows 1 195 table_id: # +master-bin.000001 482 Write_rows 1 233 table_id: # flags: STMT_END_F +master-bin.000001 520 Query 1 585 COMMIT +master-bin.000001 585 Query 1 665 use `test`; TRUNCATE TABLE t1 +master-bin.000001 665 Query 1 741 use `test`; DROP TABLE t1 +master-bin.000001 741 Query 1 858 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 858 Query 1 922 BEGIN +master-bin.000001 922 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 962 Table_map 1 98 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1020 Write_rows 1 157 table_id: # +master-bin.000001 1079 Write_rows 1 195 table_id: # +master-bin.000001 1117 Write_rows 1 233 table_id: # flags: STMT_END_F +master-bin.000001 1155 Query 1 1220 COMMIT +master-bin.000001 1220 Query 1 1284 BEGIN +master-bin.000001 1284 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 1324 Table_map 1 98 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1382 Write_rows 1 157 table_id: # +master-bin.000001 1441 Delete_rows 1 191 table_id: # +master-bin.000001 1475 Delete_rows 1 225 table_id: # flags: STMT_END_F +master-bin.000001 1509 Query 1 1574 COMMIT +master-bin.000001 1574 Query 1 1650 use `test`; DROP TABLE t1 diff --git a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def new file mode 100644 index 00000000000..b238c8ac9c5 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/disabled.def @@ -0,0 +1,27 @@ +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## + + +rpl_ndb_circular_simplex : BUG#27972 2007-04-20 mats Slave cannot start where it stopped +rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated +rpl_ndb_2myisam : BUG#19227 Seems to pass currently +rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD +rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master +rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement +rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement +#rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly +rpl_ndb_ddl : BUG#28798 2007-05-31 lars Valgrind failure in NDB + + +# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open + +#rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt new file mode 100644 index 00000000000..701dddb075b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt @@ -0,0 +1 @@ +--default-storage-engine=ndbcluster diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt new file mode 100644 index 00000000000..d8857e54be2 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt @@ -0,0 +1 @@ +--innodb --default-storage-engine=innodb diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test new file mode 100644 index 00000000000..e09d8b6685b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test @@ -0,0 +1,16 @@ +############################################################# +# Author: JBM +# Date: 2006-02-24 +# Purpose: Trying to test ability to replicate from cluster +# to innodb, or myisam, or replicate from innodb/myisam to +# cluster slave. Due to limitations I have created wrappers +# to be able to use the same code for all these different +# test and to have control over the tests. +############################################################## +-- source include/have_ndb.inc +-- source include/master-slave.inc +connection slave; +-- source include/have_innodb.inc +connection master; +SET storage_engine=ndb; +--source extra/rpl_tests/rpl_ndb_2multi_eng.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt new file mode 100644 index 00000000000..701dddb075b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt @@ -0,0 +1 @@ +--default-storage-engine=ndbcluster diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt new file mode 100644 index 00000000000..6035ce27c46 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt @@ -0,0 +1 @@ +--default-storage-engine=myisam diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test new file mode 100644 index 00000000000..abbe419bc02 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test @@ -0,0 +1,13 @@ +############################################################# +# Author: JBM +# Date: 2006-02-24 +# Purpose: Trying to test ability to replicate from cluster +# to innodb, or myisam, or replicate from innodb/myisam to +# cluster slave. Due to limitations I have created wrappers +# to be able to use the same code for all these different +# test and to have control over the tests. +############################################################## +-- source include/have_ndb.inc +-- source include/master-slave.inc +SET storage_engine=ndb; +--source extra/rpl_tests/rpl_ndb_2multi_eng.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test new file mode 100644 index 00000000000..c6fc218beed --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test @@ -0,0 +1,6 @@ +######################################################## +# By JBM 2005-02-15 Wrapped to allow reuse of test code# +######################################################## +--source include/have_ndb.inc +let $engine_type=NDB; +--source extra/rpl_tests/rpl_row_UUID.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test new file mode 100644 index 00000000000..53bb7e764f1 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test @@ -0,0 +1,118 @@ +# +# Test of auto_increment in CRBR +# +##################################### +# By: JBM +# Date: 2006-02-10 +# Change: Augmented test to use with cluster +##################################### +--source include/have_ndb.inc +--source include/master-slave.inc +--source include/have_binlog_format_mixed_or_row.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/suite/rpl_ndb/t/rpl_ndb_bank.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test new file mode 100644 index 00000000000..c1448573f5b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test @@ -0,0 +1,181 @@ +# +# Currently this test only runs in the source tree with the +# ndb/test programs compiled. +# invoke with: ./mysql-test-run --ndb-extra-test --do-test=rpl_ndb_bank +# +# 1. start a "bank" application running on the master cluster +# 2. perform online sync of slave +# 3. periodically check consistency of slave +# 4. stop the bank application +# 5. check that the slave and master BANK databases are the same +# + +--source include/have_ndb.inc +--source include/have_ndb_extra.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +# kill any trailing processes +--system killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL || true + +--disable_warnings +# initialize master +--connection master +CREATE DATABASE IF NOT EXISTS BANK; +DROP DATABASE BANK; +CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin; +--enable_warnings + +# +# These tables should correspond to the table definitions in +# storage/ndb/test/src/NDBT_Tables.cpp +# +--connection master +USE BANK; +CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL, + ACCOUNT_TYPE INT UNSIGNED NOT NULL, + BALANCE INT UNSIGNED NOT NULL, + DEPOSIT_COUNT INT UNSIGNED NOT NULL, + DEPOSIT_SUM INT UNSIGNED NOT NULL, + WITHDRAWAL_COUNT INT UNSIGNED NOT NULL, + WITHDRAWAL_SUM INT UNSIGNED NOT NULL, + PURGED INT UNSIGNED NOT NULL, + PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE)) + ENGINE = NDB; + +CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL, + OWNER INT UNSIGNED NOT NULL, + BALANCE INT UNSIGNED NOT NULL, + ACCOUNT_TYPE INT UNSIGNED NOT NULL, + PRIMARY KEY USING HASH (ACCOUNT_ID)) + ENGINE = NDB; + +CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL, + ACCOUNT INT UNSIGNED NOT NULL, + ACCOUNT_TYPE INT UNSIGNED NOT NULL, + OTHER_ACCOUNT INT UNSIGNED NOT NULL, + TRANSACTION_TYPE INT UNSIGNED NOT NULL, + TIME BIGINT UNSIGNED NOT NULL, + AMOUNT INT UNSIGNED NOT NULL, + PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT)) + ENGINE = NDB; + +CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL, + VALUE BIGINT UNSIGNED NOT NULL, + PRIMARY KEY USING HASH (SYSTEM_VALUES_ID)) + ENGINE = NDB; + +CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL, + DESCRIPTION CHAR(64) NOT NULL, + PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID)) + ENGINE = NDB; + +# +# create "BANK" application +# +--exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT + +# +# start main loop +# repeat backup-restore-check +# + +# set this high if testing to run many syncs in loop +--let $2=1 +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 & + +# +# let the "BANK" run for a while +# +--sleep 5 + +--disable_warnings +# initialize slave for sync +--connection slave +STOP SLAVE; +RESET SLAVE; +# to make sure we drop any ndbcluster tables +CREATE DATABASE IF NOT EXISTS BANK; +DROP DATABASE BANK; +# create database +CREATE DATABASE BANK; +--enable_warnings + +# +# Time to sync the slave: +# 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 + +# 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 +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 ','; +--exec rm $MYSQLTEST_VARDIR/tmp.dat || true +--replace_column 1 <the_backup_id> +SELECT @the_backup_id:=backup_id FROM mysql.backup_info; +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 + +# +# now setup replication to continue from last epoch +--source include/ndb_setup_slave.inc +--connection slave +START SLAVE; + + +# +# Now loop and check consistency every 2 seconds on slave +# +--connection slave +--let $1=10 +while ($1) +{ + --sleep 2 + --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> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> + SHOW SLAVE STATUS; + STOP SLAVE; + --exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT + START SLAVE; + --dec $1 +} + +# +# Stop transactions +# +--exec killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL + +# +# Check that the databases are the same on slave and master +# 1. dump database BANK on both master and slave +# 2. compare, there should be no difference +# +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > $MYSQLTEST_VARDIR/tmp/master_BANK.sql +--connection master +use test; +create table t1 (a int primary key) engine=ndb; +insert into t1 values (1); +--sync_slave_with_master +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > $MYSQLTEST_VARDIR/tmp/slave_BANK.sql +--connection master +drop table t1; + +diff_files $MYSQLTEST_VARDIR/tmp/master_BANK.sql $MYSQLTEST_VARDIR/tmp/slave_BANK.sql; + + --dec $2 +} diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test new file mode 100644 index 00000000000..e485b1d1bde --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test @@ -0,0 +1,261 @@ +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + + + +# +# Bug #11087 +# +# connect to the master and create tabe t1 in gotoslave database +--connection master +CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', + `nom` char(4) default NULL, + `prenom` char(4) default NULL, + PRIMARY KEY (`nid`)) + ENGINE=ndbcluster DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES(1,"XYZ1","ABC1"); +select * from t1 order by nid; + +--sync_slave_with_master +# connect to slave and ensure data it there. +--connection slave +select * from t1 order by nid; + +--connection master +delete from t1; +INSERT INTO t1 VALUES(1,"XYZ2","ABC2"); +# Make sure all rows are on the master +select * from t1 order by nid; + +# make sure all rows are on the slave. +--sync_slave_with_master +--connection slave +# Bug #11087 would have row with nid 2 missing +select * from t1 order by nid; + +--connection master +delete from t1; +insert into t1 values(1,"AA", "AA"); +insert into t1 values(2,"BB", "BB"); +insert into t1 values(3,"CC", "CC"); +insert into t1 values(4,"DD", "DD"); + +begin; +# delete+insert = update +delete from t1 where nid = 1; +insert into t1 values (1,"A2", "A2"); + +# update+delete = delete +update t1 set nom="B2" where nid = 2; +delete from t1 where nid = 2; + +# multi-update +update t1 set nom = "D2" where nid = 4; +delete from t1 where nid = 4; +insert into t1 values (4, "D3", "D3"); +update t1 set nom = "D4" where nid = 4; + +# insert+delete = nothing +insert into t1 values (5, "EE", "EE"); +delete from t1 where nid = 5; + +commit; +select * from t1 order by 1; +--sync_slave_with_master +--connection slave +select * from t1 order by 1; +--connection master +DROP table t1; + +# +# Test replication of table with no primary key +# +--connection master +CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', + `nom` char(4) default NULL, + `prenom` char(4) default NULL) + ENGINE=ndbcluster DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES(1,"XYZ1","ABC1"),(2,"AAA","BBB"),(3,"CCC","DDD"); +select * from t1 order by nid; + +--sync_slave_with_master +# connect to slave and ensure data it there. +--connection slave +select * from t1 order by nid; + +--connection master +delete from t1 where nid = 2; +INSERT INTO t1 VALUES(4,"EEE","FFF"); +# Make sure all rows are on the master +select * from t1 order by nid; + +# make sure all rows are on the slave. +--sync_slave_with_master +--connection slave +select * from t1 order by nid; + +--connection master +UPDATE t1 set nid=nid+1; +UPDATE t1 set nom="CCP" where nid = 4; +select * from t1 order by nid; + +# make sure all rows are on the slave. +--sync_slave_with_master +--connection slave +select * from t1 order by nid; + +--connection master +DROP table t1; + +# +# Bug #27378 update becomes delete on slave +# + +--connection master +CREATE TABLE `t1` ( + `prid` int(10) unsigned NOT NULL, + `id_type` enum('IMSI','SIP') NOT NULL, + `fkimssub` varchar(50) NOT NULL, + `user_id` varchar(20) DEFAULT NULL, + `password` varchar(20) DEFAULT NULL, + `ptg_nbr` varchar(20) DEFAULT NULL, + `old_tmsi` int(10) unsigned DEFAULT NULL, + `new_tmsi` int(10) unsigned DEFAULT NULL, + `dev_capability` int(10) unsigned DEFAULT NULL, + `dev_oid` bigint(20) unsigned DEFAULT NULL, + `lac_cell_id` bigint(20) unsigned DEFAULT NULL, + `ms_classmark1` int(10) unsigned DEFAULT NULL, + `cipher_key` int(10) unsigned DEFAULT NULL, + `priid_master` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`prid`), + UNIQUE KEY `fkimssub` (`fkimssub`,`ptg_nbr`) USING HASH +) ENGINE=ndbcluster DEFAULT CHARSET=latin1; + +INSERT INTO `t1` VALUES (183342,'IMSI','config3_sub_2Privates_3Publics_imssub_36668','user_id_73336','user_id_73336','73336',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(47617,'IMSI','config3_sub_2Privates_3Publics_imssub_9523','user_id_19046','user_id_19046','19046',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(200332,'IMSI','config3_sub_2Privates_3Publics_imssub_40066','user_id_80132','user_id_80132','80132',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(478882,'IMSI','config3_sub_2Privates_3Publics_imssub_95776','user_id_191552','user_id_191552','191552',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(490146,'IMSI','config3_sub_2Privates_3Publics_imssub_98029','user_id_196057','user_id_196057','196057',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(499301,'IMSI','config3_sub_2Privates_3Publics_imssub_99860','user_id_199719','user_id_199719','199719',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(506101,'IMSI','config3_sub_2Privates_3Publics_imssub_101220','user_id_202439','user_id_202439','202439',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(510142,'IMSI','config3_sub_2Privates_3Publics_imssub_102028','user_id_204056','user_id_204056','204056',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(515871,'IMSI','config3_sub_2Privates_3Publics_imssub_103174','user_id_206347','user_id_206347','206347',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(209842,'IMSI','config3_sub_2Privates_3Publics_imssub_41968','user_id_83936','user_id_83936','83936',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(365902,'IMSI','config3_sub_2Privates_3Publics_imssub_73180','user_id_146360','user_id_146360','146360',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(11892,'IMSI','config3_sub_2Privates_3Publics_imssub_2378','user_id_4756','user_id_4756','4756',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL); + +select count(*) from t1; + +--sync_slave_with_master +--connection slave +select count(*) from t1; + +--connection master +update t1 set dev_oid=dev_oid+1; +select count(*) from t1; + +--sync_slave_with_master +--connection slave +select count(*) from t1; + +--connection master +DROP table t1; + +################################################################## +# +# Check that retries are made on the slave on some temporary errors +# + +# +# 1. Deadlock +# +--connection master +CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', + `nom` char(4) default NULL, + `prenom` char(4) default NULL, + PRIMARY KEY USING HASH (`nid`)) + ENGINE=ndbcluster DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES(1,"XYZ1","ABC1"); + +# cause a lock on that row on the slave +--sync_slave_with_master +--connection slave +--echo **** On Slave **** +BEGIN; +UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1; + +# set number of retries low so we fail the retries +set GLOBAL slave_transaction_retries=1; + +# now do a change to this row on the master +# will deadlock on the slave because of lock above +--connection master +--echo **** On Master **** +UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; + +# wait for deadlock to be detected +# sleep longer than dead lock detection timeout in config +# we do this 2 times, once with few retries to verify that we +# get a failure with the set sleep, and once with the _same_ +# sleep, but with more retries to get it to succeed +--sleep 5 + +# replication should have stopped, since max retries where 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> +--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; +# wait for deadlock to be detected and retried +# should be the same sleep as above for test to be valid +--sleep 5 + +# commit transaction to release lock on row and let replication succeed +select * from t1 order by nid; +COMMIT; + +# verify that the row succeded to be applied on the slave +--connection master +--sync_slave_with_master +--connection slave +select * from t1 order by nid; + +# cleanup +--connection master +DROP TABLE t1; + + +# +# BUG#18094 +# Slave caches invalid table definition after atlters causes select failure +# +--connection master +CREATE TABLE t1 (c1 INT KEY) ENGINE=NDB; + +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +ALTER TABLE t1 ADD c2 INT; + +--sync_slave_with_master +connection slave; +SELECT * FROM t1 ORDER BY c1; + +connection master; +ALTER TABLE t1 CHANGE c2 c2 TEXT CHARACTER SET utf8; +ALTER TABLE t1 CHANGE c2 c2 BLOB; + +--sync_slave_with_master +connection slave; +# here we would get error 1412 prior to bug +SELECT * FROM t1 ORDER BY c1 LIMIT 5; + +--connection master +TRUNCATE t1; +SELECT count(*) FROM t1; +INSERT INTO t1 VALUES (101,NULL),(102,NULL),(103,NULL),(104,NULL),(105,NULL),(106,NULL),(107,NULL),(108,NULL),(109,NULL),(1010,NULL); +--sync_slave_with_master +connection slave; +SELECT count(*) FROM t1; +SELECT c1 FROM t1 ORDER BY c1 LIMIT 5; + +# cleanup +--connection master +DROP TABLE t1; +-- source include/master-slave-end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test new file mode 100644 index 00000000000..94af986b222 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test @@ -0,0 +1,142 @@ +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +# +# basic test of blob replication for NDB +# + +# easy test + +--connection master +create table t1 ( + a int not null primary key, + b text not null +) engine=ndb; + +insert into t1 values(1, repeat('abc',10)); +insert into t1 values(2, repeat('def',200)); +insert into t1 values(3, repeat('ghi',3000)); + +select 'M', a, sha1(b) from t1 +order by a; + +--sync_slave_with_master +--sleep 5 +--connection slave +select 'S', a, sha1(b) from t1 +order by a; + +--connection master +drop table t1; +--sync_slave_with_master + +# hard test + +--connection master +create table t1 ( + a int not null primary key, + b text not null, + c int, + d longblob, + e tinyblob +) engine=ndbcluster; + +--disable_query_log +# length 61 +set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau'; +set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz'; +set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah'; +--enable_query_log + +insert into t1 values ( + 0, repeat(@s2,454), 100, repeat(@s2,345), NULL); +insert into t1 values ( + 1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1)); +insert into t1 values ( + 2, '', 102, '', repeat(@s2,1)); +insert into t1 values ( + 3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1)); +insert into t1 values ( + 4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1)); +insert into t1 values ( + 5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1)); +insert into t1 values ( + 6, repeat(@s1,242), 106, NULL, repeat(@s1,1)); +insert into t1 values ( + 7, repeat(@s1,30), 107, repeat(@s0,161), ''); +insert into t1 values ( + 8, repeat(@s1,719), 108, repeat(@s2,104), NULL); +insert into t1 values ( + 9, repeat(@s2,427), NULL, NULL, NULL); + +select 'M', a, sha1(b), c, sha1(d), sha1(e) +from t1 order by a; + +--sync_slave_with_master +--sleep 5 +--connection slave +select 'S', a, sha1(b), c, sha1(d), sha1(e) +from t1 order by a; + +--connection master +drop table t1; +--sync_slave_with_master + +# table with varsize key (future cluster/schema) + +# sql/ha_ndbcluster_binlog.cc +--connection master +CREATE TABLE IF NOT EXISTS t1 ( + db VARBINARY(63) NOT NULL, + name VARBINARY(63) NOT NULL, + slock BINARY(32) NOT NULL, + query BLOB NOT NULL, + node_id INT UNSIGNED NOT NULL, + epoch BIGINT UNSIGNED NOT NULL, + id INT UNSIGNED NOT NULL, + version INT UNSIGNED NOT NULL, + type INT UNSIGNED NOT NULL, + PRIMARY KEY USING HASH (db,name)) +ENGINE=NDB; + +insert into t1 values ('test','t1', + 'abc',repeat(@s0,10), 11,12,13,14,15); +insert into t1 values ('test','t2', + 'def',repeat(@s1,100), 21,22,23,24,25); +insert into t1 values ('test','t3', + 'ghi',repeat(@s2,1000),31,32,33,34,35); +insert into t1 values ('testtttttttttt','t1', + 'abc',repeat(@s0,10), 11,12,13,14,15); +insert into t1 values ('testttttttttttt','t1', + 'def',repeat(@s1,100), 21,22,23,24,25); +insert into t1 values ('testtttttttttttt','t1', + 'ghi',repeat(@s2,1000),31,32,33,34,35); +insert into t1 values ('t','t11111111111', + 'abc',repeat(@s0,10), 11,12,13,14,15); +insert into t1 values ('t','t111111111111', + 'def',repeat(@s1,100), 21,22,23,24,25); +insert into t1 values ('t','t1111111111111', + 'ghi',repeat(@s2,1000),31,32,33,34,35); + +select 'M', db, name, sha1(query), node_id, epoch, id, version, type +from t1 order by db, name; + +--sync_slave_with_master +--sleep 5 +--connection slave +select 'S', db, name, sha1(query), node_id, epoch, id, version, type +from t1 order by db, name; + +--connection master +drop table t1; +--sync_slave_with_master + +# +# view the binlog - not deterministic (mats) +# + +#--connection master +#let $VERSION=`select version()`; +#--replace_result $VERSION VERSION +#show binlog events; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test new file mode 100644 index 00000000000..2e8f02eaf75 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/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/suite/rpl_ndb/t/rpl_ndb_charset.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_charset.test new file mode 100644 index 00000000000..eb412a0349a --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_charset.test @@ -0,0 +1,6 @@ +######################################################## +# By JBM 2005-02-15 Wrapped to allow reuse of test code# +######################################################## +--source include/have_ndb.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_row_charset.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test new file mode 100644 index 00000000000..88b5808160b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test @@ -0,0 +1,57 @@ +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +# set up circular replication + +--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; +#CREATE TABLE t2 (a int key, b int) ENGINE=ndb; +--save_master_pos +--connection master +--sync_with_master +# now we should have a table on the master as well +SHOW TABLES; + +# insert some values on the slave and master +--connection master +INSERT INTO t1 VALUES (1,2); +--connection slave +INSERT INTO t1 VALUES (2,3); + +# ensure data has propagated both ways +--connection slave +--save_master_pos +--connection master +--sync_with_master +--sync_slave_with_master + +# connect to slave and ensure data it there. +--connection slave +SELECT * FROM t1 ORDER BY a; +#SELECT * FROM t2 ORDER BY a; +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # +--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 # +--query_vertical show slave status; + +# stop replication on "master" as not to replicate +# shutdown circularly, eg drop table +--connection master +STOP SLAVE; + +# cleanup +--connection master +DROP TABLE t1; 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 new file mode 100644 index 00000000000..2ea60beaba2 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test @@ -0,0 +1,82 @@ +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +connection master; +CREATE TABLE t1 (a int key, b int) ENGINE=NDB; +sync_slave_with_master; +SHOW TABLES; + +# Lose the events from the slave binary log: there is no +# need to re-create the table on the master. +connection slave; +RESET MASTER; + +# Insert some values on the slave and master +connection master; +INSERT INTO t1 VALUES (1,2); +# Switch to slave once event is applied and insert a row +sync_slave_with_master; +connection slave; +INSERT INTO t1 VALUES (2,3); + +# ... it is now very probable that we have a mixed event in the binary +# log. If we don't, the test should still pass, but will not test the +# mixed event situation. + +# The statement is disabled since it cannot reliably show the same +# info all the time. Use it for debug purposes. + +#SHOW BINLOG EVENTS; + +# Replicate back to the master to test this mixed event on the master +STOP SLAVE; + +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"; + +RESET MASTER; +START SLAVE; + +connection slave; +save_master_pos; +connection master; +sync_with_master; + +# The statement is disabled since it cannot reliably show the same +# info all the time. Use it for debug purposes. + +#SHOW BINLOG EVENTS; + +# Check that there is no error in replication +--replace_result $SLAVE_MYPORT SLAVE_PORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +query_vertical SHOW SLAVE STATUS; + +# Check that we have the data on the master +SELECT * FROM t1 ORDER BY a; + +# We should now have another mixed event, likely with "slave" server +# id last, and with the STMT_END_F flag set. + +# The statement is disabled since it cannot reliably show the same +# info all the time. Use it for debug purposes. + +#SHOW BINLOG EVENTS; + +# now lets see that this data is applied correctly on the slave +STOP SLAVE; +save_master_pos; + +connection slave; +START SLAVE; + +# check that we have the data on the slave +sync_with_master; +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 # +query_vertical SHOW SLAVE STATUS; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test new file mode 100644 index 00000000000..ce2a4d9506c --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test @@ -0,0 +1,9 @@ +##################################### +# Wrapper for rpl_commit_after_flush# +# Wrapped to reuse test code on # +# Different engines # +# By JBM 2004-02-15 # +##################################### +-- source include/have_ndb.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_commit_after_flush.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test new file mode 100644 index 00000000000..0a1ab37cdad --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test @@ -0,0 +1,581 @@ +############################################### +# Author: JBM # +# Date: 2006-03-07 # +# Purpose: To test advance DD and replication # +############################################### + +#### Include Section #### +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/ndb_default_cluster.inc +--source include/not_embedded.inc +--source include/big_test.inc +#--source include/have_ndb_extra.inc +--source include/master-slave.inc + +#### Test start cleanup section ##### +--disable_warnings +DROP TABLE IF EXISTS t1, t2, t3; +--enable_warnings + +###################################################### +# Requirment: Cluster DD and replication must be able# +# to handle ALTER tables and indexes and must rpl # +# to the slave correctly # +###################################################### + +## Test #1 replication of CDD and Alter Tables ##### +--echo ***** Test 1 RPL of CDD and Alter ***** +--echo ***** Test 1 setup ***** + +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; + +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE 4M +ENGINE=NDB; + +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE=NDB; + +ALTER TABLESPACE ts1 +ADD DATAFILE 'datafile02.dat' +INITIAL_SIZE 4M +ENGINE=NDB; + +CREATE TABLE t1 + (c1 INT NOT NULL PRIMARY KEY, + c2 INT NOT NULL, + c3 INT NOT NULL) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB; + +--echo ***** insert some data ***** + +let $j= 900; +--disable_query_log +while ($j) +{ + eval INSERT INTO t1 VALUES($j,$j*2,$j+3); + dec $j; +} +--enable_query_log + +--echo ***** Select from Master ***** + +SELECT * FROM t1 ORDER BY c1 LIMIT 5; + +--echo ***** Select from Slave ***** +--sync_slave_with_master +connection slave; +SELECT * FROM t1 ORDER BY c1 LIMIT 5; + +################################### +# Just to some File Schema check # +################################### + +--disable_query_log +SELECT DISTINCT FILE_NAME, FILE_TYPE, TABLESPACE_NAME, LOGFILE_GROUP_NAME + FROM INFORMATION_SCHEMA.FILES + WHERE ENGINE="ndbcluster" ORDER BY FILE_NAME; +--enable_query_log + +--echo **** Do First Set of ALTERs in the master table **** +################################################### +# On this first set of alters I expect: +# 1. To be able to create and index on 2 columns +# 2. To be able to create a unique index +# 3. To be able to add two columns and have +# it all replicated correctly to the slave cluster. +################################################### +connection master; +CREATE INDEX t1_i ON t1(c2, c3); +#Bug 18039 +#CREATE UNIQUE INDEX t1_i2 ON t1(c2); +ALTER TABLE t1 ADD c4 TIMESTAMP; +ALTER TABLE t1 ADD c5 DOUBLE; +ALTER TABLE t1 ADD INDEX (c5); +SHOW CREATE TABLE t1; + +--echo **** Show first set of ALTERs on SLAVE **** +--sync_slave_with_master +connection slave; +SHOW CREATE TABLE t1; + +--echo **** Second set of alters test 1 **** +############################################ +# With this next set of alters we have had +# Some issues with renames of tables. So this +# test renames our main table, drop and index off +# of it, creates another table with then name +# of the orginal table, inserts a row, drops +# the table and renames the orginal table back. +# I want to make sure that 1) the cluster does +# okay with this and 2) that it is replicated +# correctly. +############################################# +connection master; +ALTER TABLE t1 RENAME t2; +ALTER TABLE t2 DROP INDEX c5; +CREATE TABLE t1(c1 INT)ENGINE=NDB; +INSERT INTO t1 VALUES(1); +DROP TABLE t1; +ALTER TABLE t2 RENAME t1; + +--echo **** Show second set of ALTERs on MASTER **** + +SHOW CREATE TABLE t1; + +--echo **** Show second set of ALTERs on SLAVE **** +--sync_slave_with_master +connection slave; +SHOW CREATE TABLE t1; + +--echo **** Third and last set of alters for test1 **** +######################################################### +# In this last set of alters, we are messing with the +# cluster ability to rebuild indexes, drop a column that make up +# an index with another column and change types several times in +# a row. I have choosen the BLOB as it seems to have had many +# issues in this release. I want to make sure that the cluster +# deals with these radical changes and that the replication to +# the slave cluster is dones correctly. +########################################################### +connection master; +ALTER TABLE t1 CHANGE c1 c1 DOUBLE; +ALTER TABLE t1 CHANGE c2 c2 DECIMAL(10,2); +ALTER TABLE t1 DROP COLUMN c3; +ALTER TABLE t1 CHANGE c4 c4 TEXT CHARACTER SET utf8; +ALTER TABLE t1 CHANGE c4 c4 BLOB; +ALTER TABLE t1 CHANGE c4 c3 BLOB; +set @b1 = 'b1'; +set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1); +UPDATE t1 SET c3=@b1 where c1 = 1; +UPDATE t1 SET c3=@b1 where c1 = 2; + +--echo **** Show last set of ALTERs on MASTER **** + +SHOW CREATE TABLE t1; +SELECT * FROM t1 ORDER BY c1 LIMIT 5; + +--echo **** Show last set of ALTERs on SLAVE **** +--sync_slave_with_master +connection slave; +SHOW CREATE TABLE t1; +# Bug 18094 +#SELECT * FROM t1 ORDER BY c1 LIMIT 5; +SELECT * FROM t1 where c1 = 1; + +connection master; +DROP TABLE t1; +--sync_slave_with_master +connection slave; +STOP SLAVE; +RESET SLAVE; +connection master; +RESET MASTER; +connection slave; +START SLAVE; + +################### TEST 2 TPCB for disk data ########################### +# Requirement: To have Stored Procedures and Functions that are used to # +# populate and post transactions to the data base using CDD that span # +# 2 tables spaces and also use a memory only cluster tables. In addition# +# The slave is to be stopped, cleaned and restored and synced with the # +# Master cluster # +######################################################################### + +--echo ******** Create additional TABLESPACE test 2 ************** + +connection master; +CREATE TABLESPACE ts2 +ADD DATAFILE 'datafile03.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE=NDB; + +ALTER TABLESPACE ts2 +ADD DATAFILE 'datafile04.dat' +INITIAL_SIZE 12M +ENGINE=NDB; + +###### CLEAN UP SECTION ############## +DROP DATABASE IF EXISTS tpcb; +CREATE DATABASE tpcb; +######## Creat Table Section ######### +--echo *********** Create TPCB Tables ***************** +CREATE TABLE tpcb.account + (id INT, bid INT, balance DECIMAL(10,2), + filler CHAR(255), PRIMARY KEY(id)) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB; + +CREATE TABLE tpcb.branch + (bid INT, balance DECIMAL(10,2), filler VARCHAR(255), + PRIMARY KEY(bid)) + ENGINE=NDB; + +CREATE TABLE tpcb.teller + (tid INT, balance DECIMAL(10,2), filler VARCHAR(255), + PRIMARY KEY(tid)) + TABLESPACE ts2 STORAGE DISK + ENGINE=NDB; + +CREATE TABLE tpcb.history + (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, + tid INT, bid INT, amount DECIMAL(10,2), + tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, + filler CHAR(80),PRIMARY KEY (id)) + TABLESPACE ts2 STORAGE DISK + ENGINE=NDB; + +--echo ********* Create Procedures and Functions ************ +delimiter |; +CREATE PROCEDURE tpcb.load() +BEGIN + DECLARE acct INT DEFAULT 1000; + DECLARE brch INT DEFAULT 100; + DECLARE tell INT DEFAULT 1000; + DECLARE tmp INT DEFAULT 100; + WHILE brch > 0 DO + SET tmp = 100; + WHILE tmp > 0 DO + INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT"); + SET acct = acct - 1; + SET tmp = tmp -1; + END WHILE; + INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH"); + SET brch = brch - 1; + END WHILE; + WHILE tell > 0 DO + INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER"); + SET tell = tell - 1; + END WHILE; +END| + +CREATE FUNCTION tpcb.account_id () RETURNS INT +BEGIN + DECLARE num INT; + DECLARE ran INT; + SELECT RAND() * 10 INTO ran; + IF (ran < 2) + THEN + SELECT RAND() * 10 INTO num; + ELSEIF (ran < 4) + THEN + SELECT RAND() * 100 INTO num; + ELSE + SELECT RAND() * 1000 INTO num; + END IF; + IF (num < 1) + THEN + RETURN 1; + END IF; + RETURN num; +END| + +CREATE FUNCTION tpcb.teller_id () RETURNS INT +BEGIN + DECLARE num INT; + DECLARE ran INT; + SELECT RAND() * 10 INTO ran; + IF (ran < 2) + THEN + SELECT RAND() * 10 INTO num; + ELSEIF (ran < 5) + THEN + SELECT RAND() * 100 INTO num; + ELSE + SELECT RAND() * 1000 INTO num; + END IF; + IF (num < 1) + THEN + RETURN 1; + END IF; + RETURN num; +END| + +CREATE PROCEDURE tpcb.trans() +BEGIN + DECLARE acct INT DEFAULT 0; + DECLARE brch INT DEFAULT 0; + DECLARE tell INT DEFAULT 0; + DECLARE bal DECIMAL(10,2) DEFAULT 0.0; + DECLARE amount DECIMAL(10,2) DEFAULT 1.00; + DECLARE test INT DEFAULT 0; + DECLARE bbal DECIMAL(10,2) DEFAULT 0.0; + DECLARE tbal DECIMAL(10,2) DEFAULT 0.0; + DECLARE local_uuid VARCHAR(255); + DECLARE local_user VARCHAR(255); + DECLARE local_time TIMESTAMP; + + SELECT RAND() * 10 INTO test; + SELECT tpcb.account_id() INTO acct; + SELECT tpcb.teller_id() INTO tell; + + SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct; + SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct; + SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell; + SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch; + + IF (test < 5) + THEN + SET bal = bal + amount; + SET bbal = bbal + amount; + SET tbal = tbal + amount; + UPDATE tpcb.account SET balance = bal, filler = 'account updated' + WHERE id = acct; + UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' + WHERE bid = brch; + UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' + WHERE tid = tell; + ELSE + SET bal = bal - amount; + SET bbal = bbal - amount; + SET tbal = tbal - amount; + UPDATE tpcb.account SET balance = bal, filler = 'account updated' + WHERE id = acct; + UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' + WHERE bid = brch; + UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' + WHERE tid = tell; + END IF; + + SET local_uuid=UUID(); + SET local_user=USER(); + SET local_time= NOW(); + INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user, + local_uuid,'completed trans'); +END| +delimiter ;| + +--echo ****** TEST 2 test time ********************************* +USE tpcb; + +--echo *********** Load up the database ****************** +CALL tpcb.load(); + +--echo ********** Check load master and slave ************** +SELECT COUNT(*) FROM account; +--sync_slave_with_master +connection slave; +USE tpcb; +SELECT COUNT(*) FROM account; + +--echo ******** Run in some transactions *************** + +connection master; +let $j= 1000; +--disable_query_log +while ($j) +{ + CALL tpcb.trans(); + dec $j; +} +--enable_query_log + +--echo ***** Time to try slave sync *********** +--echo **** Must make sure slave is clean ***** +--connection slave +STOP SLAVE; +RESET SLAVE; +DROP PROCEDURE IF EXISTS tpcb.load; +DROP PROCEDURE IF EXISTS tpcb.trans; +DROP TABLE IF EXISTS tpcb.account; +DROP TABLE IF EXISTS tpcb.teller; +DROP TABLE IF EXISTS tpcb.branch; +DROP TABLE IF EXISTS tpcb.history; +DROP DATABASE tpcb; + +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile.dat' +ENGINE=NDB; + +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile02.dat' +ENGINE=NDB; + +DROP TABLESPACE ts1 ENGINE=NDB; + +ALTER TABLESPACE ts2 +DROP DATAFILE 'datafile03.dat' +ENGINE=NDB; + +ALTER TABLESPACE ts2 +DROP DATAFILE 'datafile04.dat' +ENGINE=NDB; + +DROP TABLESPACE ts2 ENGINE=NDB; + +DROP LOGFILE GROUP lg1 ENGINE=NDB; + +--echo ********** Take a backup of the Master ************* +connection master; + +SELECT COUNT(*) FROM history; + +let $j= 1000; +--disable_query_log +while ($j) +{ + CALL tpcb.trans(); + dec $j; +} +--enable_query_log + +SELECT COUNT(*) FROM history; + +#RESET MASTER; +--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT + +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat + +CREATE TEMPORARY 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 ','; +--exec rm $MYSQLTEST_VARDIR/tmp.dat || true +--replace_column 1 <the_backup_id> + +SELECT @the_backup_id:=backup_id FROM mysql.backup_info; + +let the_backup_id=`select @the_backup_id`; + +DROP TABLE IF EXISTS mysql.backup_info; +#RESET MASTER; + +--echo ************ Restore the slave ************************ +connection slave; +CREATE DATABASE tpcb; +--source include/ndb_restore_slave_eoption.inc + +--echo ***** Check a few slave restore values *************** +connection slave; +USE tpcb; +SELECT COUNT(*) FROM account; + +--echo ***** Add some more records to master ********* +connection master; +let $j= 1000; +--disable_query_log +while ($j) +{ + CALL tpcb.trans(); + dec $j; +} +--enable_query_log + +# +# now setup replication to continue from last epoch +# 1. get apply_status epoch from slave +# 2. get corresponding _next_ binlog postition from master +# 3. change master on slave +# 4. add some transaction for slave to process +# 5. start the replication + +--echo ***** Finsh the slave sync process ******* +--disable_query_log +# 1. 2. 3. +--source include/ndb_setup_slave.inc +--enable_query_log + +# 4. +--echo * 4. * +connection master; +let $j= 1000; +--disable_query_log +while ($j) +{ + CALL tpcb.trans(); + dec $j; +} +--enable_query_log + +# 5. +--echo * 5. * +connection slave; +START SLAVE; + +--echo **** We should be ready to continue on ************* + +connection master; +let $j= 50; +--disable_query_log +while ($j) +{ + CALL tpcb.trans(); + dec $j; +} +--enable_query_log + +--echo ****** Let's make sure we match ******* +--echo ***** MASTER ******* +USE tpcb; +SELECT COUNT(*) FROM history; + +--echo ****** SLAVE ******** +--sync_slave_with_master +connection slave; +USE tpcb; +SELECT COUNT(*) FROM history; + +--echo *** DUMP MASTER & SLAVE FOR COMPARE ******** + +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql + +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql + +--echo *************** TEST 2 CLEANUP SECTION ******************** +connection master; +DROP PROCEDURE IF EXISTS tpcb.load; +DROP PROCEDURE IF EXISTS tpcb.trans; +DROP TABLE tpcb.account; +DROP TABLE tpcb.teller; +DROP TABLE tpcb.branch; +DROP TABLE tpcb.history; +DROP DATABASE tpcb; + +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile.dat' +ENGINE=NDB; + +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile02.dat' +ENGINE=NDB; + +DROP TABLESPACE ts1 ENGINE=NDB; + +ALTER TABLESPACE ts2 +DROP DATAFILE 'datafile03.dat' +ENGINE=NDB; + +ALTER TABLESPACE ts2 +DROP DATAFILE 'datafile04.dat' +ENGINE=NDB; + +DROP TABLESPACE ts2 ENGINE=NDB; + +DROP LOGFILE GROUP lg1 ENGINE=NDB; + +--sync_slave_with_master + +connection master; + +--echo ****** Do dumps compare ************ + +diff_files $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql; + +## Note: Ths files should only get removed, if the above diff succeeds. + +--exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql +--exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql + +# End 5.1 test case diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test new file mode 100644 index 00000000000..7387d39db87 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test @@ -0,0 +1,85 @@ +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# +# Basic test of disk tables for NDB +# + +# +# Start by creating a logfile group +# + +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; + +alter logfile group lg1 +add undofile 'undofile02.dat' +initial_size 4M engine=ndb; + +# +# Create a tablespace connected to the logfile group +# + +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB; + +alter tablespace ts1 +add datafile 'datafile02.dat' +initial_size 4M engine=ndb; + +# +# Create a table using this tablespace +# + +CREATE TABLE t1 +(pk1 int not null primary key, b int not null, c int not null) +tablespace ts1 storage disk +engine ndb; + +# +# insert some data +# + +insert into t1 values (1,2,3); +select * from t1 order by pk1; + +# +# check that the data is also on the slave +# + +--sync_slave_with_master +--connection slave +select * from t1 order by pk1; + +# +# view the binlog +# + +--connection master +-- source include/show_binlog_events2.inc + +# +# cleanup +# + +drop table t1; +alter tablespace ts1 +drop datafile 'datafile.dat' +engine=ndb; +alter tablespace ts1 +drop datafile 'datafile02.dat' +engine=ndb; +DROP TABLESPACE ts1 ENGINE=NDB; +DROP LOGFILE GROUP lg1 ENGINE=NDB; +-- source include/master-slave-end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test new file mode 100644 index 00000000000..9291f38e8db --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test @@ -0,0 +1,310 @@ +####################################### +# Author: JBM # +# Date: 2006-03-09 # +# Purpose: To test the replication of # +# Cluster Disk Data using partitions # +####################################### + +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--echo --- Doing pre test cleanup --- + +connection master; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_query_log + + +# Start by creating a logfile group +################################## + +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; + +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; + +################################################### +# Create a tablespace connected to the logfile group +################################################### + +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB; + +ALTER TABLESPACE ts1 +ADD DATAFILE 'datafile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; + +################################################################# + +--echo --- Start test 2 partition RANGE testing -- +--echo --- Do setup -- + + +################################################# +# Requirment: Create table that is partitioned # +# by range on year i.e. year(t) and replicate # +# basice operations such at insert, update # +# delete between 2 different storage engines # +# Alter table and ensure table is handled # +# Correctly on the slave # +################################################# + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY RANGE (YEAR(t)) + (PARTITION p0 VALUES LESS THAN (1901), + PARTITION p1 VALUES LESS THAN (1946), + PARTITION p2 VALUES LESS THAN (1966), + PARTITION p3 VALUES LESS THAN (1986), + PARTITION p4 VALUES LESS THAN (2005), + PARTITION p5 VALUES LESS THAN MAXVALUE); + +--echo --- Show table on master --- + +SHOW CREATE TABLE t1; + +--echo --- Show table on slave -- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- +--enable_query_log + +--source include/rpl_multi_engine3.inc + +--echo --- End test 2 partition RANGE testing --- +--echo --- Do Cleanup --- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 3 partition LIST testing --- +--echo --- Do setup --- +################################################# + + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY LIST(id) + (PARTITION p0 VALUES IN (2, 4), + PARTITION p1 VALUES IN (42, 142)); + +--echo --- Test 3 Alter to add partition --- + +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); + +--echo --- Show table on master --- + +SHOW CREATE TABLE t1; + +--echo --- Show table on slave --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 3 partition LIST testing --- +--echo --- Do Cleanup -- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 4 partition HASH testing --- +--echo --- Do setup --- +################################################# + + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY HASH( YEAR(t) ) + PARTITIONS 4; + +--echo --- show that tables have been created correctly --- + +SHOW CREATE TABLE t1; +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 4 partition HASH testing --- +--echo --- Do Cleanup -- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 5 partition by key testing --- +--echo --- Create Table Section --- + +################################################# + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE,PRIMARY KEY(id)) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY KEY() + PARTITIONS 4; + +--echo --- Show that tables on master are ndbcluster tables --- + +SHOW CREATE TABLE t1; + +--echo --- Show that tables on slave --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +# Okay lets see how it holds up to table changes +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still right type --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 5 key partition testing --- +--echo --- Do Cleanup --- + +DROP TABLE IF EXISTS t1; +alter tablespace ts1 +drop datafile 'datafile.dat' +engine=ndb; +alter tablespace ts1 +drop datafile 'datafile02.dat' +engine=ndb; +DROP TABLESPACE ts1 ENGINE=NDB; +DROP LOGFILE GROUP lg1 ENGINE=NDB; +--sync_slave_with_master + +# End of 5.1 test case diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test new file mode 100644 index 00000000000..66db755de15 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test @@ -0,0 +1,33 @@ +#################### rpl_ndb_ddl.test ######################## +# # +# DDL statements (sometimes with implicit COMMIT) executed # +# by the master and it's propagation into the slave # +# # +############################################################## + +# +# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !! +# +# 1. !All! objects to be dropped, renamed, altered ... must be created +# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test +# sequences start. +# +# 2. Never use a test object, which was direct or indirect affected by a +# preceeding test sequence again. +# Except table d1.t1 where ONLY DML is allowed. +# +# If one preceeding test sequence hits a (sometimes not good visible, +# because the sql error code of the statement might be 0) bug +# and these rules are ignored, a following test sequence might earn ugly +# effects like failing 'sync_slave_with_master', crashes of the slave or +# abort of the test case etc.. +# + +--source include/master-slave.inc +--source include/have_binlog_format_row.inc +--source include/have_ndb.inc +let $engine_type= NDB; +let $temp_engine_type= MEMORY; +let $show_binlog = 0; +let $manipulate = 0; +-- source extra/rpl_tests/rpl_ddl.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test new file mode 100644 index 00000000000..92ceddf7f5c --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test @@ -0,0 +1,8 @@ +######################################### +# By JBM 2006-02-14 Test wrapping to # +# Share test code between engine tests # +######################################### +--source include/have_ndb.inc +-- source include/have_binlog_format_row.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_delete_no_where.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db-slave.opt new file mode 100644 index 00000000000..fb5e378b65f --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db-slave.opt @@ -0,0 +1 @@ +--replicate-do-db=replica diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test new file mode 100644 index 00000000000..9b65d43f244 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test @@ -0,0 +1,57 @@ +########################################################### +# Author: Jeb +# Date: 14-12-2006 +# Purpose: To test --replicate-do-database=db_name +# using cluster. Only replica should replicate. +########################################################## + +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--disable_warnings +DROP DATABASE IF EXISTS replica; +--enable_warnings + +# Create database and tables for the test. +CREATE DATABASE replica; +CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +USE replica; +CREATE TABLE replica.t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE replica.t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; + +# Insert data into db that should not be picked up by slave +USE test; +INSERT INTO t1 VALUES(1, repeat('abc',10)); +INSERT INTO t2 VALUES(1, repeat('abc',10)); +SHOW TABLES; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t2; + +# Insert data into db that should be replicated +USE replica; +INSERT INTO replica.t1 VALUES(2, repeat('def',200)); +INSERT INTO replica.t2 VALUES(2, repeat('def',200)); +SHOW TABLES; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t2; + +# Check results on slave +--sync_slave_with_master +SHOW TABLES; +USE replica; +SHOW TABLES; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t2; +USE test; +SHOW TABLES; + +# Cleanup from testing +connection master; +USE test; +DROP TABLE t1, t2; +DROP DATABASE IF EXISTS replica; +--sync_slave_with_master + +# End 5.1 test case diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table-slave.opt new file mode 100644 index 00000000000..da345474216 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table-slave.opt @@ -0,0 +1 @@ +--replicate-do-table=test.t1 diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test new file mode 100644 index 00000000000..55a40d85172 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test @@ -0,0 +1,46 @@ +########################################################### +# Author: Jeb +# Date: 14-12-2006 +# Purpose: To test --replicate-do-table=db_name.tbl_name +# using cluster. Only t1 should replicate. +########################################################## + +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; + +INSERT INTO t1 VALUES(1, repeat('abc',10)); +INSERT INTO t1 VALUES(2, repeat('def',200)); +INSERT INTO t1 VALUES(3, repeat('ghi',3000)); +INSERT INTO t2 VALUES(1, repeat('abc',10)); +INSERT INTO t2 VALUES(2, repeat('def',200)); +INSERT INTO t2 VALUES(3, repeat('ghi',3000)); + +--sync_slave_with_master +SHOW TABLES; +SELECT COUNT(*) FROM t1; + +# +# Bug #27044 replicated with unique field ndb table allows dup key inserts +# +connection master; + +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (3, repeat('bad',1)); + +connection slave; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (3, repeat('bad too',1)); + +# cleanup + +connection master; +DROP TABLE IF EXISTS t1, t2; +--sync_slave_with_master diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test new file mode 100644 index 00000000000..cf0501c490a --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test @@ -0,0 +1,13 @@ +########################################### +# Author: Jeb +# Date: 2006-09-08 +# Purpose: Wapper for rpl_extraSlave_Col.test +# Using NDB +########################################### +-- source include/have_binlog_format_row.inc +--source include/have_ndb.inc +-- source include/master-slave.inc +let $engine_type = 'NDB'; +-- source extra/rpl_tests/rpl_extraSlave_Col.test + + diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test new file mode 100644 index 00000000000..a19de7d3d6b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test @@ -0,0 +1,12 @@ +################################### +# Wrapper for rpl_row_func003.test# +# This test was orginally designed# +# To test InnoDB using RBR, but # +# It can also be used to test NDB # +# So this wrapper is being used to# +# reduce test case code # +################################### +-- source include/have_ndb.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_row_func003.test +-- source include/master-slave-end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test new file mode 100644 index 00000000000..f2bfe745523 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test @@ -0,0 +1,117 @@ +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +# +# Currently test only works with ndb since it retrieves "old" +# binlog positions with mysql.ndb_binlog_index and ndb_apply_status; +# + +# create a table with one row +CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ; +INSERT INTO t1 VALUES ("row1","will go away",1); +SELECT * FROM t1 ORDER BY c3; + +# sync slave and retrieve epoch +sync_slave_with_master; +--replace_column 1 <the_epoch> +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; +let $the_epoch= `select @the_epoch` ; +SELECT * FROM t1 ORDER BY c3; + +# get the master binlog pos from the epoch +connection master; +--replace_result $the_epoch <the_epoch> +--replace_column 1 <the_pos> +eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) + FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ; +let $the_pos= `SELECT @the_pos` ; +let $the_file= `SELECT @the_file` ; + +# insert some more values +INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); +DELETE FROM t1 WHERE c3 = 1; +UPDATE t1 SET c2="should go away" WHERE c3 = 2; +UPDATE t1 SET c2="C" WHERE c3 = 3; +DELETE FROM t1 WHERE c3 = 2; + +SELECT * FROM t1 ORDER BY c3; + +# check that we have it on the slave +--sync_slave_with_master +--connection slave +SELECT * FROM t1 ORDER BY c3; + +--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> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> +SHOW SLAVE STATUS; + +# stop slave and reset position to before the last changes +STOP SLAVE; +--replace_result $the_pos <the_pos> +eval CHANGE MASTER TO + master_log_file = '$the_file', + master_log_pos = $the_pos ; + +--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> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> +SHOW SLAVE STATUS; + +# start the slave again +# -> same events should have been applied again +# e.g. inserting rows that already there +# deleting a row which is not there +# updating a row which is not there +START SLAVE; + +--connection master +SELECT * FROM t1 ORDER BY c3; +--sync_slave_with_master +--connection slave +SELECT * FROM t1 ORDER BY c3; + +STOP SLAVE; + +# +# cleanup +# +--connection master +DROP TABLE t1; +RESET master; +--connection slave +DROP TABLE t1; +RESET slave; + +START SLAVE; + +# +# Test that we can handle update of a row that does not exist on the slave +# will trigger usage of AO_IgnoreError on slave side so that the INSERT +# still succeeds even if the replication of the UPDATE generates an error. +# +--connection master +CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ; +INSERT INTO t1 VALUES ("row1","remove on slave",1); + +--sync_slave_with_master +--connection slave +DELETE FROM t1; + +--connection master +BEGIN; +UPDATE t1 SET c2="does not exist" WHERE c3=1; +INSERT INTO t1 VALUES ("row2","new on slave",2); +COMMIT; + +--sync_slave_with_master +--connection slave +SELECT * FROM t1; +--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> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> +SHOW SLAVE STATUS; + +connection master; +DROP TABLE IF EXISTS t1; + +# End of 5.1 Test +-- source include/master-slave-end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-slave.opt new file mode 100644 index 00000000000..7f9eb96dff1 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-slave.opt @@ -0,0 +1 @@ +--default-storage-engine=ndbcluster diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test new file mode 100644 index 00000000000..229ee11353b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test @@ -0,0 +1,16 @@ +############################################################# +# Author: JBM +# Date: 2006-02-24 +# Purpose: Trying to test ability to replicate from cluster +# to innodb, or myisam, or replicate from innodb/myisam to +# cluster slave. Due to limitations I have created wrappers +# to be able to use the same code for all these different +# test and to have control over the tests. +############################################################## +-- source include/have_innodb.inc +-- source include/master-slave.inc +connection slave; +-- source include/have_ndb.inc +connection master; +SET storage_engine=innodb; +--source extra/rpl_tests/rpl_ndb_2multi_eng.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt @@ -0,0 +1 @@ +--innodb 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 new file mode 100644 index 00000000000..127c2464570 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test @@ -0,0 +1,66 @@ +# Test of a transaction mixing the two engines + +-- source include/have_ndb.inc +-- source include/have_innodb.inc +-- source include/master-slave.inc + +create table t1 (a int, unique(a)) engine=ndbcluster; +create table t2 (a int, unique(a)) engine=innodb; + + +begin; +insert into t1 values(1); +insert into t2 values(1); +rollback; + +select count(*) from t1; +select count(*) from t2; +sync_slave_with_master; +select count(*) from t1; +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; +rollback; + +select count(*) from t1; +select count(*) from t2; +sync_slave_with_master; +select count(*) from t1; +select count(*) from t2; +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; +rollback; + +select count(*) from t1; +select count(*) from t2; +sync_slave_with_master; +select count(*) from t1; +select count(*) from t2; +connection master; + +delete from t1; +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; +rollback; + +select count(*) from t1; +select count(*) from t2; +sync_slave_with_master; +select count(*) from t1; +select count(*) from t2; +connection master; + +drop table t1,t2; +sync_slave_with_master; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test new file mode 100644 index 00000000000..17acb5983f4 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test @@ -0,0 +1,8 @@ +##################################### +# Wrapper for rpl_insert_ignore.test# +##################################### +-- source include/have_ndb.inc +-- source include/have_binlog_format_row.inc +let $engine_type=NDB; +let $engine_type2=myisam; +-- source extra/rpl_tests/rpl_insert_ignore.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test new file mode 100644 index 00000000000..2ee540afd18 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test @@ -0,0 +1,66 @@ +# +# Currently this test only runs in the source tree with the +# ndb/test programs compiled. +# invoke with: ./mysql-test-run --ndb-extra-test --do-test=rpl_ndb_load +# + +--source include/have_ndb.inc +--source include/have_ndb_extra.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--disable_warnings +# reset master +connection master; +DROP DATABASE IF EXISTS TEST_DB; +CREATE DATABASE TEST_DB; +--enable_warnings + +# +# These tables should correspond to the table definitions in +# storage/ndb/test/ndbapi/bench/ +# +connection master; +USE TEST_DB; +CREATE TABLE SUBSCRIBER + ( NUMBER CHAR(12) BINARY NOT NULL, + NAME CHAR(32) BINARY NOT NULL, + GROUP_ID INT UNSIGNED NOT NULL, + LOCATION INT UNSIGNED NOT NULL, + SESSIONS INT UNSIGNED NOT NULL, + CHANGED_BY CHAR(32) BINARY NOT NULL, + CHANGED_TIME CHAR(32) BINARY NOT NULL, + PRIMARY KEY USING HASH (NUMBER)) + ENGINE = NDB; + +CREATE TABLE GROUP_T + ( GROUP_ID INT UNSIGNED NOT NULL, + GROUP_NAME CHAR(32) BINARY NOT NULL, + ALLOW_READ CHAR(1) BINARY NOT NULL, + ALLOW_INSERT INT UNSIGNED NOT NULL, + ALLOW_DELETE INT UNSIGNED NOT NULL, + PRIMARY KEY USING HASH (GROUP_ID)) + ENGINE = NDB; + +CREATE TABLE SESSION + ( NUMBER CHAR(12) BINARY NOT NULL, + SERVER_ID INT UNSIGNED NOT NULL, + DATA VARBINARY(1998) NOT NULL, + PRIMARY KEY USING HASH (NUMBER,SERVER_ID)) + ENGINE = NDB; + +CREATE TABLE SERVER + ( SUFFIX CHAR(2) BINARY NOT NULL, + SERVER_ID INT UNSIGNED NOT NULL, + NAME CHAR(32) BINARY NOT NULL, + NO_OF_READ INT UNSIGNED NOT NULL, + NO_OF_INSERT INT UNSIGNED NOT NULL, + NO_OF_DELETE INT UNSIGNED NOT NULL, + PRIMARY KEY USING HASH (SUFFIX, SERVER_ID)) + ENGINE = NDB; + +# +# 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 diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_log-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_log-master.opt new file mode 100644 index 00000000000..e0d075c3fbd --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_log-master.opt @@ -0,0 +1 @@ +--skip-external-locking diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test new file mode 100644 index 00000000000..e883d24b977 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test @@ -0,0 +1,12 @@ +################################### +# Wrapper for rpl_row_log.test # +# Added wrapper so that MyISAM & # +# Innodb and NDB could all use the# +# Same test. NDB produced a diff # +# bin-log # +################################### +-- source include/have_binlog_format_row.inc +-- source include/have_ndb.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_log.test + diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test new file mode 100644 index 00000000000..196d0a5ed6f --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test @@ -0,0 +1,71 @@ +--source include/have_ndb.inc +--source include/have_multi_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +# note: server2 is another "master" connected to the master cluster + +# +# Currently test only works with ndb since it retrieves "old" +# binlog positions with mysql.ndb_binlog_index and ndb_apply_status; +# + +# create a table with one row, and make sure the other "master" gets it +CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ; +connection server2; +reset master; +SHOW TABLES; +connection master; +INSERT INTO t1 VALUES ("row1","will go away",1); +SELECT * FROM t1 ORDER BY c3; +connection server2; +SELECT * FROM t1 ORDER BY c3; + +# sync slave and retrieve epoch and stop the slave +connection master; +sync_slave_with_master; +--replace_column 1 <the_epoch> +SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; +let $the_epoch= `select @the_epoch` ; +SELECT * FROM t1 ORDER BY c3; +stop slave; + +# get the master binlog pos from the epoch, from the _other_ "master", server2 +connection server2; +--replace_result $the_epoch <the_epoch> +eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) + FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ; +let $the_pos= `SELECT @the_pos` ; +let $the_file= `SELECT @the_file` ; + +# now connect the slave to the _other_ "master" +connection slave; +--replace_result $MASTER_MYPORT1 <MASTER_PORT1> +eval CHANGE MASTER TO + master_port=$MASTER_MYPORT1, + master_log_file = '$the_file', + master_log_pos = $the_pos ; +start slave; + +# insert some more values on the first master +connection master; +INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); +DELETE FROM t1 WHERE c3 = 1; +UPDATE t1 SET c2="should go away" WHERE c3 = 2; +UPDATE t1 SET c2="C" WHERE c3 = 3; +DELETE FROM t1 WHERE c3 = 2; + +SELECT * FROM t1 ORDER BY c3; + +save_master_pos; + +# insert another row, and check that we have it on the slave +connection server2; +INSERT INTO t1 VALUES ("row5","E",5); +SELECT * FROM t1 ORDER BY c3; +#sync_slave_with_master; +connection slave; +--sleep 2 +SELECT * FROM t1 ORDER BY c3; + +STOP SLAVE; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2-slave.opt new file mode 100644 index 00000000000..17d4171af0e --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2-slave.opt @@ -0,0 +1 @@ +--replicate-ignore-table=nothing.sensible diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test new file mode 100644 index 00000000000..df4f0eec39d --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test @@ -0,0 +1,12 @@ +############################################################ +# By JBM 2006-02-15 Wrapper for rpl_multi_update2.test # +# to reuse test code between engine runs # +############################################################ +-- source include/have_ndb.inc + +# Run this only for row based replication, as replication of +# auto_increment values are not supported with NDB as storage engine +-- source include/have_binlog_format_row.inc + +let $engine_type=NDB; +--source extra/rpl_tests/rpl_multi_update2.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test new file mode 100644 index 00000000000..008e2143987 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test @@ -0,0 +1,8 @@ +############################################################ +# By JBM 2006-02-15 Wrapper for rpl_multi_update3.test # +# to reuse test code between engine runs # +############################################################ +-- source include/have_ndb.inc +-- source include/have_binlog_format_row.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_multi_update3.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-master.opt new file mode 100644 index 00000000000..83ed8522e72 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-master.opt @@ -0,0 +1 @@ +--binlog-format=row diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-slave.opt new file mode 100644 index 00000000000..7f9eb96dff1 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-slave.opt @@ -0,0 +1 @@ +--default-storage-engine=ndbcluster diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test new file mode 100644 index 00000000000..0c2df6441cb --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test @@ -0,0 +1,15 @@ +############################################################# +# Author: JBM +# Date: 2006-02-24 +# Purpose: Trying to test ability to replicate from cluster +# to innodb, or myisam, or replicate from innodb/myisam to +# cluster slave. Due to limitations I have created wrappers +# to be able to use the same code for all these different +# test and to have control over the tests. +############################################################## +-- source include/master-slave.inc +connection slave; +--source include/have_ndb.inc +connection master; +SET storage_engine=myisam; +--source extra/rpl_tests/rpl_ndb_2multi_eng.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate-slave.opt new file mode 100644 index 00000000000..cf4319f2b40 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate-slave.opt @@ -0,0 +1,3 @@ +-O max_relay_log_size=16384 +--loose-innodb +--log-warnings diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test new file mode 100644 index 00000000000..c5ec0e1d21b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test @@ -0,0 +1,8 @@ +############################################################ +# By JBM 2006-02-15 Wrapper for rpl_relayrotate.test # +# to reuse test code between engine runs # +############################################################ +-- source include/have_ndb.inc +-- source include/have_ndb_extra.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_relayrotate.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore-slave.opt new file mode 100644 index 00000000000..6262cf451a6 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore-slave.opt @@ -0,0 +1 @@ +--replicate-ignore-db=test --replicate-ignore-table=replica.t1 diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test new file mode 100644 index 00000000000..47f5bce5527 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test @@ -0,0 +1,58 @@ +########################################################### +# Author: Jeb +# Date: 15-12-2006 +# Purpose: To test --replicate-ignore-table=db_name.tbl_name +# and --replicate-ignore-db=db_name +# using cluster. Only replica should replicate. +########################################################## + +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--disable_warnings +DROP DATABASE IF EXISTS replica; +--enable_warnings + +# Create database and tables for the test. +CREATE DATABASE replica; +CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +USE replica; +CREATE TABLE replica.t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; +CREATE TABLE replica.t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB; + +# Insert data into db that should not be picked up by slave +USE test; +INSERT INTO t1 VALUES(1, repeat('abc',10)); +INSERT INTO t2 VALUES(1, repeat('abc',10)); +SHOW TABLES; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t2; + +# Insert data into db that should be replicated +USE replica; +INSERT INTO replica.t1 VALUES(2, repeat('def',200)); +INSERT INTO replica.t2 VALUES(2, repeat('def',200)); +SHOW TABLES; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t2; + +# Check results on slave +--sync_slave_with_master +SHOW TABLES; +USE replica; +SHOW TABLES; +#SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t2; +USE test; +SHOW TABLES; + +# Cleanup from testing +connection master; +USE test; +DROP TABLE t1, t2; +DROP DATABASE IF EXISTS replica; +--sync_slave_with_master + +# End 5.1 test case diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test new file mode 100644 index 00000000000..1e2a4ec02df --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test @@ -0,0 +1,6 @@ +######################################################## +# By JBM 2005-02-15 Wrapped to allow reuse of test code# +######################################################## +--source include/have_ndb.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_row_001.test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test new file mode 100644 index 00000000000..75ad9f0a488 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/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/suite/rpl_ndb/t/rpl_ndb_sp006.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test new file mode 100644 index 00000000000..590facc3648 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/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/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test new file mode 100644 index 00000000000..b92fbbcfce6 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test @@ -0,0 +1,62 @@ +--source include/have_ndb.inc +--source include/have_innodb.inc +--source include/have_binlog_format_mixed_or_statement.inc +--source include/master-slave.inc + +--connection master +create table t1 (a int key, b int) engine innodb; +create table t2 (a int key, b int) engine innodb; + +--sync_slave_with_master +--connection slave +alter table t1 engine ndb; +alter table t2 engine ndb; + +# check binlog position without begin +--connection master +insert into t1 values (1,2); + +--sync_slave_with_master +--connection slave +--replace_column 1 <start_pos> 2 <end_pos> +select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; +--let $start_pos = `select @start_pos` +--let $end_pos = `select @end_pos` + +--connection master +# here is actually a bug, since there is no begin statement, the +# query is autocommitted, and end_pos shows end of the insert and not +# end of the commit +--replace_result $start_pos <start_pos> +--replace_column 5 # +--eval show binlog events from $start_pos limit 1 +--replace_result $start_pos <start_pos> $end_pos <end_pos> +--replace_column 2 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ +--eval show binlog events from $start_pos limit 1,1 + +# check binlog position with begin +--connection master +begin; +insert into t1 values (2,3); +insert into t2 values (3,4); +commit; + +--sync_slave_with_master +--connection slave +--replace_column 1 <start_pos> 2 <end_pos> +select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; +--let $start_pos = `select @start_pos` +--let $end_pos = `select @end_pos` + +--connection master +--replace_result $start_pos <start_pos> +--replace_column 5 # +--eval show binlog events from $start_pos limit 1 +--replace_result $start_pos <start_pos> +--replace_column 2 # 4 # 5 # +--eval show binlog events from $start_pos limit 1,2 +--replace_result $start_pos <start_pos> $end_pos <end_pos> +--replace_column 2 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ +--eval show binlog events from $start_pos limit 3,1 diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test new file mode 100644 index 00000000000..14e2b36b588 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test @@ -0,0 +1,104 @@ +--source include/have_ndb.inc +--source include/ndb_default_cluster.inc +--source include/not_embedded.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +# +# Currently test only works with ndb since it retrieves "old" +# binlog positions with mysql.ndb_binlog_index and ndb_apply_status; +# + +# stop the save +--connection slave +STOP SLAVE; +CREATE DATABASE ndbsynctest; +USE ndbsynctest; + +# get some data on the master +--connection master +CREATE DATABASE ndbsynctest; +USE ndbsynctest; +CREATE TABLE t1 (c1 BIT(1) NOT NULL, c2 BIT(1) NOT NULL, c3 CHAR(15), PRIMARY KEY(c3)) ENGINE = NDB ; +INSERT INTO t1 VALUES (1,1,"row1"),(0,1,"row2"),(1,0,"row3"),(0,0,"row4"); +CREATE TABLE t2 (c1 CHAR(15), c2 BIT(1) NOT NULL, c3 BIT(1) NOT NULL, PRIMARY KEY(c1)) ENGINE = NDB ; +INSERT INTO t2 VALUES ("ABC",1,1),("BCDEF",0,1),("CD",1,0),("DEFGHIJKL",0,0); +SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; +SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; + +# take a backup on master +--source include/ndb_backup.inc + +# update a row +UPDATE t1 SET c2=0 WHERE c3="row2"; +SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; + +# restore on slave, first check that nothing is there +--connection slave + +# 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 + +# +# BUG#11960 +# prior to bugfix "DROP DATABASE" would give a warning since +# the events were not created by ndb_restore +# +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 + +# continue test +SHOW TABLES; + +SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; +SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; + +# +# now setup replication to continue from last epoch +--source include/ndb_setup_slave.inc +--connection slave +START SLAVE; + +# +# +# +--connection master +--sync_slave_with_master +--connection 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> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> +SHOW SLAVE STATUS; + +SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; +SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; + +# +# Cleanup +# + +--connection master +DROP DATABASE ndbsynctest; +--sync_slave_with_master +--connection slave +STOP SLAVE; + +# +# Test some replication commands +# +--connection master +reset master; +# should now contain nothing +select * from mysql.ndb_binlog_index; + +--connection slave +reset slave; +# should now contain nothing +select * from mysql.ndb_apply_status; + +# End 5.1 Test diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test new file mode 100644 index 00000000000..7439da563a6 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test @@ -0,0 +1,15 @@ +############################################################################# +# Original Author: JBM # +# Original Date: 2006-02-14 # +############################################################################# +# TEST: Use before insert triggers and has the second insert fail # +# Test is wrapped to save code and share between engines # +############################################################################# + +# Includes +-- source include/have_binlog_format_row.inc +-- source include/have_ndb.inc +-- source include/master-slave.inc +let $engine_type=NDB; +-- source extra/rpl_tests/rpl_trig004.test + diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test new file mode 100644 index 00000000000..62b83f0557a --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test @@ -0,0 +1,11 @@ +-- source include/have_ndb.inc +-- source include/have_binlog_format_row.inc +-- source include/master-slave.inc +-- source include/have_ndbapi_examples.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 echo Running mgmapi_logevent +--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" "localhost:$NDBCLUSTER_PORT_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT + diff --git a/mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test new file mode 100644 index 00000000000..1ec2fb333ae --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test @@ -0,0 +1,5 @@ +-- source include/have_ndb.inc +let $type= 'NDB' ; +let $extra_index= ; +-- source extra/rpl_tests/rpl_row_basic.test +-- source include/master-slave-end.inc diff --git a/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test new file mode 100644 index 00000000000..1d69eee5dd0 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test @@ -0,0 +1,71 @@ + +--source include/have_ndb.inc +--source include/master-slave.inc +--source include/have_binlog_format_mixed_or_row.inc + +--disable_query_log +--disable_warnings +connection slave; +STOP SLAVE; +connection master; +DROP TABLE IF EXISTS t1; +RESET MASTER; +connection slave; +DROP TABLE IF EXISTS t1; +RESET SLAVE; +START SLAVE; +--enable_warnings +--enable_query_log + +--echo **** On Master **** +connection master; +CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; +INSERT INTO t1 VALUES (1,1), (2,2); +SELECT * FROM t1 ORDER BY a,b; +--echo **** On Slave **** +# This is silly, but NDB doesn't add to the binlog fast enough +--real_sleep 10 +sync_slave_with_master; +INSERT INTO t1 VALUE (3,3); +SELECT * FROM t1 ORDER BY a,b; +--echo **** On Master **** +connection master; +TRUNCATE TABLE t1; +SELECT * FROM t1 ORDER BY a,b; +--echo **** On Slave **** +sync_slave_with_master; +# Should be empty +SELECT * FROM t1 ORDER BY a,b; +--echo **** On Master **** +connection master; +DROP TABLE t1; +let SERVER_VERSION=`select version()`; +--replace_regex /\/\* xid=[0-9]+ \*\//\/* xid= *\// /table_id: [0-9]+/table_id: #/ +--replace_result $SERVER_VERSION SERVER_VERSION +SHOW BINLOG EVENTS; + +--echo **** On Master **** +connection master; +CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; +INSERT INTO t1 VALUES (1,1), (2,2); +SELECT * FROM t1 ORDER BY a,b; +--echo **** On Slave **** +sync_slave_with_master; +INSERT INTO t1 VALUE (3,3); +SELECT * FROM t1 ORDER BY a,b; +--echo **** On Master **** +connection master; +DELETE FROM t1; +SELECT * FROM t1 ORDER BY a,b; +--echo **** On Slave **** +sync_slave_with_master; +# Should be empty +SELECT * FROM t1 ORDER BY a,b; +--echo **** On Master **** +connection master; +DROP TABLE t1; +--replace_regex /table_id: [0-9]+/table_id: #/ +--replace_result $SERVER_VERSION SERVER_VERSION +SHOW BINLOG EVENTS; + +-- source include/master-slave-end.inc |