include/master-slave.inc [connection master] set global sql_mode=''; set local sql_mode=''; connection slave; connection master; SET AUTOCOMMIT = 1; CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest2; CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=InnoDB; connection slave; connection slave; connection master; INSERT INTO mysqltest1.t1 SET f1= 0; CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=InnoDB; CREATE INDEX my_idx6 ON mysqltest1.t6(f1); CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=InnoDB; INSERT INTO mysqltest1.t7 SET f1= 0; CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=InnoDB; CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=InnoDB; CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=MEMORY; SET AUTOCOMMIT = 0; use mysqltest1; connection slave; connection slave; SET AUTOCOMMIT = 1; use mysqltest1; connection master; ######## SELECT 1 ######## connection master; INSERT INTO t1 SET f1= 0 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 0 connection master; SELECT 1; 1 1 SELECT MAX(f1) FROM t1; MAX(f1) 1 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 0 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 0 TEST-INFO: MASTER: The INSERT is not committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 0 TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) connection master; ######## SELECT COUNT(*) FROM t1 ######## connection master; INSERT INTO t1 SET f1= 0 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 0 connection master; SELECT COUNT(*) FROM t1; COUNT(*) 2 SELECT MAX(f1) FROM t1; MAX(f1) 1 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 0 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 0 TEST-INFO: MASTER: The INSERT is not committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 0 TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) connection master; ######## COMMIT ######## connection master; INSERT INTO t1 SET f1= 0 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 0 connection master; COMMIT; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 1 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 1 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; ######## ROLLBACK ######## connection master; INSERT INTO t1 SET f1= 1 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 2 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 1 TEST-INFO: MASTER: The INSERT is not committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 1 TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) connection master; ######## SET AUTOCOMMIT=1 ######## connection master; INSERT INTO t1 SET f1= 1 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 2 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 1 connection master; SET AUTOCOMMIT=1; SELECT MAX(f1) FROM t1; MAX(f1) 2 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 2 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 2 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 2 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SET AUTOCOMMIT=0; ######## START TRANSACTION ######## connection master; INSERT INTO t1 SET f1= 2 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 3 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 2 connection master; START TRANSACTION; SELECT MAX(f1) FROM t1; MAX(f1) 3 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 3 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 3 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 3 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; ######## BEGIN ######## connection master; INSERT INTO t1 SET f1= 3 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 4 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 3 connection master; BEGIN; SELECT MAX(f1) FROM t1; MAX(f1) 4 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 4 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 4 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 4 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; ######## DROP TABLE mysqltest1.t2 ######## connection master; INSERT INTO t1 SET f1= 4 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 5 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 4 connection master; DROP TABLE mysqltest1.t2; SELECT MAX(f1) FROM t1; MAX(f1) 5 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 5 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 5 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 5 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW TABLES LIKE 't2'; Tables_in_mysqltest1 (t2) connection slave; SHOW TABLES LIKE 't2'; Tables_in_mysqltest1 (t2) connection master; ######## DROP TEMPORARY TABLE mysqltest1.t23 ######## connection master; INSERT INTO t1 SET f1= 5 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 6 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 5 connection master; DROP TEMPORARY TABLE mysqltest1.t23; SELECT MAX(f1) FROM t1; MAX(f1) 6 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 5 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 5 TEST-INFO: MASTER: The INSERT is not committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 6 TEST-INFO: SLAVE: The INSERT is committed (Failed) connection master; SHOW TABLES LIKE 't23'; Tables_in_mysqltest1 (t23) connection slave; SHOW TABLES LIKE 't23'; Tables_in_mysqltest1 (t23) connection master; ######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ######## connection master; INSERT INTO t1 SET f1= 5 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 6 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 6 connection master; RENAME TABLE mysqltest1.t3 to mysqltest1.t20; SELECT MAX(f1) FROM t1; MAX(f1) 6 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 6 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 6 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 6 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW TABLES LIKE 't20'; Tables_in_mysqltest1 (t20) t20 connection slave; SHOW TABLES LIKE 't20'; Tables_in_mysqltest1 (t20) t20 connection master; ######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ######## connection master; INSERT INTO t1 SET f1= 6 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 7 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 6 connection master; ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT; SELECT MAX(f1) FROM t1; MAX(f1) 7 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 7 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 7 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 7 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; describe mysqltest1.t4; Field Type Null Key Default Extra f1 bigint(20) YES NULL f2 bigint(20) YES NULL connection slave; describe mysqltest1.t4; Field Type Null Key Default Extra f1 bigint(20) YES NULL f2 bigint(20) YES NULL connection master; ######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= InnoDB ######## connection master; INSERT INTO t1 SET f1= 7 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 8 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 7 connection master; CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= InnoDB; SELECT MAX(f1) FROM t1; MAX(f1) 8 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 8 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 8 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 8 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; ######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY ######## connection master; INSERT INTO t1 SET f1= 8 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 9 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 8 connection master; CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY; SELECT MAX(f1) FROM t1; MAX(f1) 9 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 8 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 8 TEST-INFO: MASTER: The INSERT is not committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 9 TEST-INFO: SLAVE: The INSERT is committed (Failed) connection master; ######## TRUNCATE TABLE mysqltest1.t7 ######## connection master; INSERT INTO t1 SET f1= 8 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 9 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 9 connection master; TRUNCATE TABLE mysqltest1.t7; SELECT MAX(f1) FROM t1; MAX(f1) 9 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 9 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 9 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 9 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SELECT * FROM mysqltest1.t7; f1 connection slave; connection slave; SELECT * FROM mysqltest1.t7; f1 connection master; ######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ######## connection master; INSERT INTO t1 SET f1= 9 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 9 connection master; LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 10 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; UNLOCK TABLES; ######## UNLOCK TABLES ######## connection master; INSERT INTO t1 SET f1= 10 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 11 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection master; UNLOCK TABLES; SELECT MAX(f1) FROM t1; MAX(f1) 11 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 10 TEST-INFO: MASTER: The INSERT is not committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) connection master; LOCK TABLES mysqltest1.t1 READ; ######## UNLOCK TABLES ######## connection 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 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection master; UNLOCK TABLES; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 10 TEST-INFO: MASTER: The INSERT is not committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) connection master; LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; ######## UNLOCK TABLES ######## connection master; INSERT INTO t1 SET f1= 10 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 11 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 10 connection master; UNLOCK TABLES; SELECT MAX(f1) FROM t1; MAX(f1) 11 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 11 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 11 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 11 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; ######## DROP INDEX my_idx6 ON mysqltest1.t6 ######## connection master; INSERT INTO t1 SET f1= 11 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 12 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 11 connection master; DROP INDEX my_idx6 ON mysqltest1.t6; SELECT MAX(f1) FROM t1; MAX(f1) 12 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 12 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 12 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 12 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection 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 Index_comment Ignored connection 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 Index_comment Ignored connection master; ######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ######## connection master; INSERT INTO t1 SET f1= 12 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 13 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 12 connection master; CREATE INDEX my_idx5 ON mysqltest1.t5(f1); SELECT MAX(f1) FROM t1; MAX(f1) 13 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 13 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 13 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 13 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection 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 Index_comment Ignored t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE NO connection 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 Index_comment Ignored t5 1 my_idx5 1 f1 A NULL NULL NULL YES BTREE NO connection master; ######## DROP DATABASE mysqltest2 ######## connection master; INSERT INTO t1 SET f1= 13 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 14 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 13 connection master; DROP DATABASE mysqltest2; SELECT MAX(f1) FROM t1; MAX(f1) 14 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 14 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 14 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 14 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW DATABASES LIKE "mysqltest2"; Database (mysqltest2) connection slave; SHOW DATABASES LIKE "mysqltest2"; Database (mysqltest2) connection master; ######## CREATE DATABASE mysqltest3 ######## connection master; INSERT INTO t1 SET f1= 14 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 15 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 14 connection master; CREATE DATABASE mysqltest3; SELECT MAX(f1) FROM t1; MAX(f1) 15 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 15 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 15 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 15 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW DATABASES LIKE "mysqltest3"; Database (mysqltest3) mysqltest3 connection slave; SHOW DATABASES LIKE "mysqltest3"; Database (mysqltest3) mysqltest3 connection master; ######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ######## connection master; INSERT INTO t1 SET f1= 15 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 16 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 15 connection master; CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1"; SELECT MAX(f1) FROM t1; MAX(f1) 16 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 16 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 16 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 16 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW PROCEDURE STATUS LIKE 'p1'; Db mysqltest1 Name p1 Type PROCEDURE Definer root@localhost Modified # Created # Security_type DEFINER Comment character_set_client latin1 collation_connection latin1_swedish_ci Database Collation latin1_swedish_ci connection slave; SHOW PROCEDURE STATUS LIKE 'p1'; Db mysqltest1 Name p1 Type PROCEDURE Definer root@localhost Modified # Created # Security_type DEFINER Comment character_set_client latin1 collation_connection latin1_swedish_ci Database Collation latin1_swedish_ci connection master; ######## ALTER PROCEDURE p1 COMMENT "I have been altered" ######## connection master; INSERT INTO t1 SET f1= 16 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 17 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 16 connection master; ALTER PROCEDURE p1 COMMENT "I have been altered"; SELECT MAX(f1) FROM t1; MAX(f1) 17 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 17 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 17 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 17 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection 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 character_set_client latin1 collation_connection latin1_swedish_ci Database Collation latin1_swedish_ci connection 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 character_set_client latin1 collation_connection latin1_swedish_ci Database Collation latin1_swedish_ci connection master; ######## DROP PROCEDURE p1 ######## connection master; INSERT INTO t1 SET f1= 17 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 18 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 17 connection master; DROP PROCEDURE p1; SELECT MAX(f1) FROM t1; MAX(f1) 18 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 18 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 18 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 18 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW PROCEDURE STATUS LIKE 'p1'; connection slave; SHOW PROCEDURE STATUS LIKE 'p1'; connection master; ######## CREATE OR REPLACE VIEW v1 as select * from t1 ######## connection master; INSERT INTO t1 SET f1= 18 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 19 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 18 connection master; CREATE OR REPLACE VIEW v1 as select * from t1; SELECT MAX(f1) FROM t1; MAX(f1) 19 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 19 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 19 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 19 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci connection slave; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci connection master; ######## ALTER VIEW v1 AS select f1 from t1 ######## connection master; INSERT INTO t1 SET f1= 19 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 20 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 19 connection master; ALTER VIEW v1 AS select f1 from t1; SELECT MAX(f1) FROM t1; MAX(f1) 20 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 20 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 20 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 20 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci connection slave; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci connection master; ######## DROP VIEW IF EXISTS v1 ######## connection master; INSERT INTO t1 SET f1= 20 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 21 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 20 connection master; DROP VIEW IF EXISTS v1; SELECT MAX(f1) FROM t1; MAX(f1) 21 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 21 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 21 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 21 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW CREATE VIEW v1; ERROR 42S02: Table 'mysqltest1.v1' doesn't exist connection slave; SHOW CREATE VIEW v1; ERROR 42S02: Table 'mysqltest1.v1' doesn't exist connection master; ######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ######## connection master; INSERT INTO t1 SET f1= 21 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 22 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 21 connection master; CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1; SELECT MAX(f1) FROM t1; MAX(f1) 22 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 22 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 22 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 22 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation trg1 INSERT t1 SET @a:=1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci connection slave; SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation trg1 INSERT t1 SET @a:=1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci connection master; ######## DROP TRIGGER trg1 ######## connection master; INSERT INTO t1 SET f1= 22 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 23 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 22 connection master; DROP TRIGGER trg1; SELECT MAX(f1) FROM t1; MAX(f1) 23 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 23 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 23 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 23 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation connection slave; SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation connection master; ######## CREATE USER user1@localhost ######## connection master; INSERT INTO t1 SET f1= 23 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 24 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 23 connection master; CREATE USER user1@localhost; SELECT MAX(f1) FROM t1; MAX(f1) 24 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 24 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 24 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 24 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SELECT user FROM mysql.user WHERE user = 'user1'; User user1 connection slave; SELECT user FROM mysql.user WHERE user = 'user1'; User user1 connection master; ######## RENAME USER user1@localhost TO rename1@localhost ######## connection master; INSERT INTO t1 SET f1= 24 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 25 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 24 connection master; RENAME USER user1@localhost TO rename1@localhost; SELECT MAX(f1) FROM t1; MAX(f1) 25 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 25 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 25 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 25 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SELECT user FROM mysql.user WHERE user = 'rename1'; User rename1 connection slave; SELECT user FROM mysql.user WHERE user = 'rename1'; User rename1 connection master; ######## DROP USER rename1@localhost ######## connection master; INSERT INTO t1 SET f1= 25 + 1; SELECT MAX(f1) FROM t1; MAX(f1) 26 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 25 connection master; DROP USER rename1@localhost; SELECT MAX(f1) FROM t1; MAX(f1) 26 connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 26 connection master; ROLLBACK; SELECT MAX(f1) FROM t1; MAX(f1) 26 TEST-INFO: MASTER: The INSERT is committed (Succeeded) connection slave; connection slave; SELECT MAX(f1) FROM t1; MAX(f1) 26 TEST-INFO: SLAVE: The INSERT is committed (Succeeded) connection master; SELECT user FROM mysql.user WHERE user = 'rename1'; User connection slave; SELECT user FROM mysql.user WHERE user = 'rename1'; User use test; connection master; DROP TEMPORARY TABLE mysqltest1.t22; DROP DATABASE mysqltest1; DROP DATABASE mysqltest3; set global sql_mode=default; include/rpl_end.inc