Commit b545f72d authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: rpl.rpl_invoked_features

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