Commit b545f72d authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: rpl.rpl_invoked_features

parent 5a5ba7f1
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
USE test; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
DROP VIEW IF EXISTS v1,v11; # Create tables
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p11;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e11;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=myisam; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=myisam;
INSERT INTO t1 VALUES (1,1,'1'); INSERT INTO t1 VALUES (1,1,'1');
INSERT INTO t1 VALUES (2,2,UUID()); INSERT INTO t1 VALUES (2,2,UUID());
...@@ -22,7 +14,7 @@ INSERT INTO t11 VALUES (2,2,UUID()); ...@@ -22,7 +14,7 @@ INSERT INTO t11 VALUES (2,2,UUID());
CREATE TABLE t12 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=innodb; CREATE TABLE t12 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=innodb;
INSERT INTO t12 VALUES (1,1,'1'); INSERT INTO t12 VALUES (1,1,'1');
INSERT INTO t12 VALUES (2,2,UUID()); INSERT INTO t12 VALUES (2,2,UUID());
# Create invoked features
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v11 AS SELECT * FROM t11; CREATE VIEW v11 AS SELECT * FROM t11;
CREATE TRIGGER t1_tr1 BEFORE INSERT ON t1 FOR EACH ROW CREATE TRIGGER t1_tr1 BEFORE INSERT ON t1 FOR EACH ROW
...@@ -78,7 +70,7 @@ CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64)) ...@@ -78,7 +70,7 @@ CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
BEGIN BEGIN
INSERT IGNORE INTO t11 VALUES (x,x,y); INSERT IGNORE INTO t11 VALUES (x,x,y);
END| END|
# Do some actions for non-transactional tables
CREATE TABLE t3 SELECT * FROM v1; CREATE TABLE t3 SELECT * FROM v1;
INSERT INTO t1 VALUES (3,3,''); INSERT INTO t1 VALUES (3,3,'');
UPDATE t1 SET c='2' WHERE a = 1; UPDATE t1 SET c='2' WHERE a = 1;
...@@ -90,7 +82,7 @@ INSERT INTO t1 VALUES(6,6,f1(6)); ...@@ -90,7 +82,7 @@ INSERT INTO t1 VALUES(6,6,f1(6));
INSERT INTO t1 VALUES (102,102,''); INSERT INTO t1 VALUES (102,102,'');
INSERT INTO t1 VALUES(7,7,f2(7)); INSERT INTO t1 VALUES(7,7,f2(7));
INSERT INTO t1 VALUES (103,103,''); INSERT INTO t1 VALUES (103,103,'');
# Do some actions for transactional tables
CREATE TABLE t13 SELECT * FROM v11; CREATE TABLE t13 SELECT * FROM v11;
INSERT INTO t11 VALUES (3,3,''); INSERT INTO t11 VALUES (3,3,'');
UPDATE t11 SET c='2' WHERE a = 1; UPDATE t11 SET c='2' WHERE a = 1;
...@@ -102,12 +94,12 @@ INSERT INTO t11 VALUES(6,6,f1(6)); ...@@ -102,12 +94,12 @@ INSERT INTO t11 VALUES(6,6,f1(6));
INSERT INTO t11 VALUES (102,102,''); INSERT INTO t11 VALUES (102,102,'');
INSERT INTO t11 VALUES(7,7,f2(7)); INSERT INTO t11 VALUES(7,7,f2(7));
INSERT INTO t11 VALUES (103,103,''); INSERT INTO t11 VALUES (103,103,'');
# Scheduler is on
SET GLOBAL EVENT_SCHEDULER = on; SET GLOBAL EVENT_SCHEDULER = on;
ALTER EVENT e1 ENABLE; ALTER EVENT e1 ENABLE;
ALTER EVENT e11 ENABLE; ALTER EVENT e11 ENABLE;
SET GLOBAL EVENT_SCHEDULER = off; SET GLOBAL EVENT_SCHEDULER = off;
# Check original objects
SHOW TABLES LIKE 't%'; SHOW TABLES LIKE 't%';
Tables_in_test (t%) Tables_in_test (t%)
t1 t1
...@@ -268,7 +260,7 @@ a b ...@@ -268,7 +260,7 @@ a b
102 102 102 102
103 103 103 103
connection slave; connection slave;
# Check replicated objects
SHOW TABLES LIKE 't%'; SHOW TABLES LIKE 't%';
Tables_in_test (t%) Tables_in_test (t%)
t1 t1
...@@ -297,7 +289,7 @@ SELECT event_name, status FROM information_schema.events WHERE event_schema='tes ...@@ -297,7 +289,7 @@ SELECT event_name, status FROM information_schema.events WHERE event_schema='tes
event_name status event_name status
e1 SLAVESIDE_DISABLED e1 SLAVESIDE_DISABLED
e11 SLAVESIDE_DISABLED e11 SLAVESIDE_DISABLED
# Check replicated data
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
12 12
...@@ -429,7 +421,7 @@ a b ...@@ -429,7 +421,7 @@ a b
102 102 102 102
103 103 103 103
connection master; connection master;
# Remove UUID() before comparing and sort tables
UPDATE t1 SET c=''; UPDATE t1 SET c='';
UPDATE t2 SET c=''; UPDATE t2 SET c='';
UPDATE t3 SET c=''; UPDATE t3 SET c='';
...@@ -439,10 +431,8 @@ UPDATE t13 SET c=''; ...@@ -439,10 +431,8 @@ UPDATE t13 SET c='';
ALTER TABLE t3 ORDER BY a; ALTER TABLE t3 ORDER BY a;
ALTER TABLE t13 ORDER BY a; ALTER TABLE t13 ORDER BY a;
connection slave; connection slave;
# Compare a data from master and slave
connection master; connection master;
DROP VIEW IF EXISTS v1,v11; DROP VIEW IF EXISTS v1,v11;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13; DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p1;
......
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/master-slave.inc --source include/master-slave.inc
disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log;
# --disable_warnings/--enable_warnings added before/after query # --disable_warnings/--enable_warnings added before/after query
# if one uses UUID() function because we need to avoid warnings # if one uses UUID() function because we need to avoid warnings
...@@ -22,60 +20,35 @@ enable_query_log; ...@@ -22,60 +20,35 @@ enable_query_log;
# Transactional engine # Transactional engine
--let $engine_type2= innodb --let $engine_type2= innodb
#
# Clean up
#
USE test;
--disable_warnings
DROP VIEW IF EXISTS v1,v11;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p11;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e11;
--enable_warnings
# #
# Prepare objects (tables etc) # Prepare objects (tables etc)
# #
# Create tables --echo # Create tables
--echo
eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type; eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type;
INSERT INTO t1 VALUES (1,1,'1'); INSERT INTO t1 VALUES (1,1,'1');
--disable_warnings --disable_warnings ONCE
INSERT INTO t1 VALUES (2,2,UUID()); INSERT INTO t1 VALUES (2,2,UUID());
--enable_warnings
eval CREATE TABLE t2 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=$engine_type; eval CREATE TABLE t2 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=$engine_type;
INSERT INTO t2 VALUES (1,1,'1'); INSERT INTO t2 VALUES (1,1,'1');
--disable_warnings --disable_warnings ONCE
INSERT INTO t2 VALUES (2,2,UUID()); INSERT INTO t2 VALUES (2,2,UUID());
--enable_warnings
eval CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type2; eval CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
INSERT INTO t11 VALUES (1,1,'1'); INSERT INTO t11 VALUES (1,1,'1');
--disable_warnings --disable_warnings ONCE
INSERT INTO t11 VALUES (2,2,UUID()); INSERT INTO t11 VALUES (2,2,UUID());
--enable_warnings
eval CREATE TABLE t12 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=$engine_type2; eval CREATE TABLE t12 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
INSERT INTO t12 VALUES (1,1,'1'); INSERT INTO t12 VALUES (1,1,'1');
--disable_warnings --disable_warnings ONCE
INSERT INTO t12 VALUES (2,2,UUID()); INSERT INTO t12 VALUES (2,2,UUID());
--enable_warnings
# Create invoked features --echo # Create invoked features
--echo
# Create view for tables t1,t11
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v11 AS SELECT * FROM t11; CREATE VIEW v11 AS SELECT * FROM t11;
# Create triggers for t1,t11
DELIMITER |; DELIMITER |;
CREATE TRIGGER t1_tr1 BEFORE INSERT ON t1 FOR EACH ROW CREATE TRIGGER t1_tr1 BEFORE INSERT ON t1 FOR EACH ROW
...@@ -102,7 +75,6 @@ BEGIN ...@@ -102,7 +75,6 @@ BEGIN
UPDATE t13 SET c = ''; UPDATE t13 SET c = '';
END| END|
# Create events which will run every 1 sec
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
BEGIN BEGIN
ALTER EVENT e1 DISABLE; ALTER EVENT e1 DISABLE;
...@@ -115,7 +87,6 @@ BEGIN ...@@ -115,7 +87,6 @@ BEGIN
CALL p11(10, ''); CALL p11(10, '');
END| END|
# Create functions and procedures used for events
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64) CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
BEGIN BEGIN
IF x > 5 THEN IF x > 5 THEN
...@@ -146,46 +117,39 @@ DELIMITER ;| ...@@ -146,46 +117,39 @@ DELIMITER ;|
# Start test case # Start test case
# #
# Do some actions for non-transactional tables --echo # Do some actions for non-transactional tables
--echo
CREATE TABLE t3 SELECT * FROM v1; CREATE TABLE t3 SELECT * FROM v1;
INSERT INTO t1 VALUES (3,3,''); INSERT INTO t1 VALUES (3,3,'');
UPDATE t1 SET c='2' WHERE a = 1; UPDATE t1 SET c='2' WHERE a = 1;
--disable_warnings --disable_warnings ONCE
INSERT INTO t1 VALUES(4,4,f1(4)); INSERT INTO t1 VALUES(4,4,f1(4));
--enable_warnings
INSERT INTO t1 VALUES (100,100,''); INSERT INTO t1 VALUES (100,100,'');
--disable_warnings
CALL p1(5, UUID()); CALL p1(5, UUID());
--enable_warnings
INSERT INTO t1 VALUES (101,101,''); INSERT INTO t1 VALUES (101,101,'');
--disable_warnings --disable_warnings ONCE
INSERT INTO t1 VALUES(6,6,f1(6)); INSERT INTO t1 VALUES(6,6,f1(6));
--enable_warnings
INSERT INTO t1 VALUES (102,102,''); INSERT INTO t1 VALUES (102,102,'');
--disable_warnings --disable_warnings ONCE
INSERT INTO t1 VALUES(7,7,f2(7)); INSERT INTO t1 VALUES(7,7,f2(7));
--enable_warnings
INSERT INTO t1 VALUES (103,103,''); INSERT INTO t1 VALUES (103,103,'');
# Do some actions for transactional tables --echo # Do some actions for transactional tables
--echo
--disable_warnings
CREATE TABLE t13 SELECT * FROM v11; CREATE TABLE t13 SELECT * FROM v11;
INSERT INTO t11 VALUES (3,3,''); INSERT INTO t11 VALUES (3,3,'');
UPDATE t11 SET c='2' WHERE a = 1; UPDATE t11 SET c='2' WHERE a = 1;
--disable_warnings ONCE
INSERT INTO t11 VALUES(4,4,f1(4)); INSERT INTO t11 VALUES(4,4,f1(4));
INSERT INTO t11 VALUES (100,100,''); INSERT INTO t11 VALUES (100,100,'');
CALL p11(5, UUID()); CALL p11(5, UUID());
INSERT INTO t11 VALUES (101,101,''); INSERT INTO t11 VALUES (101,101,'');
--disable_warnings ONCE
INSERT INTO t11 VALUES(6,6,f1(6)); INSERT INTO t11 VALUES(6,6,f1(6));
INSERT INTO t11 VALUES (102,102,''); INSERT INTO t11 VALUES (102,102,'');
--disable_warnings ONCE
INSERT INTO t11 VALUES(7,7,f2(7)); INSERT INTO t11 VALUES(7,7,f2(7));
INSERT INTO t11 VALUES (103,103,''); INSERT INTO t11 VALUES (103,103,'');
--enable_warnings
# Scheduler is on --echo # Scheduler is on
--echo
# Temporally events fire sequentally due Bug#29020. # Temporally events fire sequentally due Bug#29020.
SET GLOBAL EVENT_SCHEDULER = on; SET GLOBAL EVENT_SCHEDULER = on;
# Wait while events will executed # Wait while events will executed
...@@ -197,8 +161,7 @@ let $wait_condition= SELECT COUNT(*) = 1 FROM t11 WHERE t11.a = 10; ...@@ -197,8 +161,7 @@ let $wait_condition= SELECT COUNT(*) = 1 FROM t11 WHERE t11.a = 10;
--source include/wait_condition.inc --source include/wait_condition.inc
SET GLOBAL EVENT_SCHEDULER = off; SET GLOBAL EVENT_SCHEDULER = off;
# Check original objects --echo # Check original objects
--echo
--sorted_result --sorted_result
SHOW TABLES LIKE 't%'; SHOW TABLES LIKE 't%';
--sorted_result --sorted_result
...@@ -229,8 +192,7 @@ SELECT a,b FROM v11 ORDER BY a; ...@@ -229,8 +192,7 @@ SELECT a,b FROM v11 ORDER BY a;
--sync_slave_with_master slave --sync_slave_with_master slave
# Check replicated objects --echo # Check replicated objects
--echo
--sorted_result --sorted_result
SHOW TABLES LIKE 't%'; SHOW TABLES LIKE 't%';
--sorted_result --sorted_result
...@@ -242,8 +204,7 @@ SELECT routine_type, routine_name FROM information_schema.routines WHERE routine ...@@ -242,8 +204,7 @@ SELECT routine_type, routine_name FROM information_schema.routines WHERE routine
--sorted_result --sorted_result
SELECT event_name, status FROM information_schema.events WHERE event_schema='test'; SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
# Check replicated data --echo # Check replicated data
--echo
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
SELECT a,b FROM t1 ORDER BY a; SELECT a,b FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t2; SELECT COUNT(*) FROM t2;
...@@ -259,10 +220,8 @@ SELECT COUNT(*) FROM t13; ...@@ -259,10 +220,8 @@ SELECT COUNT(*) FROM t13;
SELECT a,b FROM t13 ORDER BY a; SELECT a,b FROM t13 ORDER BY a;
SELECT a,b FROM v11 ORDER BY a; SELECT a,b FROM v11 ORDER BY a;
# Remove UUID() before comparing and sort tables
--connection master --connection master
--echo --echo # Remove UUID() before comparing and sort tables
UPDATE t1 SET c=''; UPDATE t1 SET c='';
UPDATE t2 SET c=''; UPDATE t2 SET c='';
UPDATE t3 SET c=''; UPDATE t3 SET c='';
...@@ -277,25 +236,19 @@ ALTER TABLE t13 ORDER BY a; ...@@ -277,25 +236,19 @@ ALTER TABLE t13 ORDER BY a;
--sync_slave_with_master slave --sync_slave_with_master slave
# Compare a data from master and slave --echo # Compare a data from master and slave
--echo
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
--diff_files $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql --diff_files $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
# #
# Clean up # Clean up
# #
# Remove dumps
--echo
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql --remove_file $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql --remove_file $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
# Remove tables,views,procedures,functions
--connection master --connection master
--echo
DROP VIEW IF EXISTS v1,v11; DROP VIEW IF EXISTS v1,v11;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13; DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment