Commit f84ed8b4 authored by unknown's avatar unknown

Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.1-rpl

into  dsl-hkibras1-ff5dc300-70.dhcp.inet.fi:/tmp/merge_5.0
parents 00d2a2d9 4d16ab3a
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;
USE test;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP VIEW IF EXISTS v1,v2;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
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());
CREATE TABLE t2 (a INT, b INT, c VARCHAR(64)) ENGINE=myisam;
INSERT INTO t2 VALUES (1,1,'1');
INSERT INTO t2 VALUES (2,2,UUID());
CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=innodb;
INSERT INTO t11 VALUES (1,1,'1');
INSERT INTO t11 VALUES (2,2,UUID());
CREATE TABLE t12 (a INT, b INT, c VARCHAR(64)) ENGINE=innodb;
INSERT INTO t12 VALUES (1,1,'1');
INSERT INTO t12 VALUES (2,2,UUID());
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
BEGIN
INSERT INTO t2 VALUES (NEW.a, NEW.b, NEW.c);
INSERT INTO t3 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER t1_tr2 BEFORE UPDATE ON t1 FOR EACH ROW
BEGIN
UPDATE t2 SET c = '';
UPDATE t3 SET c = '';
END|
CREATE TRIGGER t11_tr1 BEFORE INSERT ON t11 FOR EACH ROW
BEGIN
INSERT INTO t12 VALUES (NEW.a, NEW.b, NEW.c);
INSERT INTO t13 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER t11_tr2 BEFORE UPDATE ON t11 FOR EACH ROW
BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND ENABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t1 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p1(10, '');
END IF;
END|
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND ENABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t11 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p11(10, '');
END IF;
END|
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
BEGIN
IF x > 5 THEN
RETURN UUID();
END IF;
RETURN '';
END|
CREATE FUNCTION f2 (x INT) RETURNS VARCHAR(64)
BEGIN
RETURN f1(x);
END|
CREATE PROCEDURE p1 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t1 VALUES (x,x,y);
END|
CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t11 VALUES (x,x,y);
END|
CREATE TABLE t3 SELECT * FROM v1;
INSERT INTO t1 VALUES (3,3,'');
UPDATE t1 SET c='2' WHERE a = 1;
INSERT INTO t1 VALUES(4,4,f1(4));
INSERT INTO t1 VALUES (100,100,'');
CALL p1(5, UUID());
INSERT INTO t1 VALUES (101,101,'');
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,'');
CREATE TABLE t13 SELECT * FROM v11;
INSERT INTO t11 VALUES (3,3,'');
UPDATE t11 SET c='2' WHERE a = 1;
INSERT INTO t11 VALUES(4,4,f1(4));
INSERT INTO t11 VALUES (100,100,'');
CALL p11(5, UUID());
INSERT INTO t11 VALUES (101,101,'');
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,'');
SET GLOBAL EVENT_SCHEDULER = on;
SHOW TABLES LIKE 't%';
Tables_in_test (t%)
t1
t11
t12
t13
t2
t3
SELECT table_name FROM information_schema.views WHERE table_schema='test';
table_name
v1
v11
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
trigger_name event_manipulation event_object_table
t1_tr1 INSERT t1
t1_tr2 UPDATE t1
t11_tr1 INSERT t11
t11_tr2 UPDATE t11
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
routine_type routine_name
FUNCTION f1
FUNCTION f2
PROCEDURE p1
PROCEDURE p11
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
event_name status
e1 ENABLED
e11 ENABLED
SELECT COUNT(*) FROM t1;
COUNT(*)
12
SELECT a,b FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t2;
COUNT(*)
12
SELECT a,b FROM t2 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t3;
COUNT(*)
12
SELECT a,b FROM t3 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT a,b FROM v1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t11;
COUNT(*)
12
SELECT a,b FROM t11 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t12;
COUNT(*)
12
SELECT a,b FROM t12 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t13;
COUNT(*)
12
SELECT a,b FROM t13 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT a,b FROM v11 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SHOW TABLES LIKE 't%';
Tables_in_test (t%)
t1
t11
t12
t13
t2
t3
SELECT table_name FROM information_schema.views WHERE table_schema='test';
table_name
v1
v11
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
trigger_name event_manipulation event_object_table
t1_tr1 INSERT t1
t1_tr2 UPDATE t1
t11_tr1 INSERT t11
t11_tr2 UPDATE t11
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
routine_type routine_name
FUNCTION f1
FUNCTION f2
PROCEDURE p1
PROCEDURE p11
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
event_name status
e1 SLAVESIDE_DISABLED
e11 SLAVESIDE_DISABLED
SELECT COUNT(*) FROM t1;
COUNT(*)
12
SELECT a,b FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t2;
COUNT(*)
12
SELECT a,b FROM t2 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t3;
COUNT(*)
12
SELECT a,b FROM t3 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT a,b FROM v1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t11;
COUNT(*)
12
SELECT a,b FROM t11 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t12;
COUNT(*)
12
SELECT a,b FROM t12 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t13;
COUNT(*)
12
SELECT a,b FROM t13 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT a,b FROM v11 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
UPDATE t1 SET c='';
UPDATE t2 SET c='';
UPDATE t3 SET c='';
UPDATE t11 SET c='';
UPDATE t12 SET c='';
UPDATE t13 SET c='';
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP VIEW IF EXISTS v1,v2;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
#########################################
# Author: Serge Kozlov skozlov@mysql.com
# Date: 04/25/2007
# Purpose: Testing Invocation and Invoked
# Features for Replication.
#########################################
--source include/master-slave.inc
--source include/have_innodb.inc
#
# Define variables used by test case
#
# Non-transactional engine
--let $engine_type= myisam
# Transactional engine
--let $engine_type2= innodb
#
# Clean up
#
USE test;
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP VIEW IF EXISTS v1,v2;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
--enable_warnings
#
# Prepare objects (tables etc)
#
# 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');
INSERT INTO t1 VALUES (2,2,UUID());
eval CREATE TABLE t2 (a INT, b INT, c VARCHAR(64)) ENGINE=$engine_type;
INSERT INTO t2 VALUES (1,1,'1');
INSERT INTO t2 VALUES (2,2,UUID());
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 (2,2,UUID());
eval CREATE TABLE t12 (a INT, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
INSERT INTO t12 VALUES (1,1,'1');
INSERT INTO t12 VALUES (2,2,UUID());
# Create invoked features
--echo
# Create view for tables t1,t11
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
BEGIN
INSERT INTO t2 VALUES (NEW.a, NEW.b, NEW.c);
INSERT INTO t3 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER t1_tr2 BEFORE UPDATE ON t1 FOR EACH ROW
BEGIN
UPDATE t2 SET c = '';
UPDATE t3 SET c = '';
END|
CREATE TRIGGER t11_tr1 BEFORE INSERT ON t11 FOR EACH ROW
BEGIN
INSERT INTO t12 VALUES (NEW.a, NEW.b, NEW.c);
INSERT INTO t13 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER t11_tr2 BEFORE UPDATE ON t11 FOR EACH ROW
BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
# Create events which will run every 1 sec
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND ENABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t1 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p1(10, '');
END IF;
END|
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND ENABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t11 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p11(10, '');
END IF;
END|
# Create functions and procedures used for events
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
BEGIN
IF x > 5 THEN
RETURN UUID();
END IF;
RETURN '';
END|
CREATE FUNCTION f2 (x INT) RETURNS VARCHAR(64)
BEGIN
RETURN f1(x);
END|
CREATE PROCEDURE p1 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t1 VALUES (x,x,y);
END|
CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t11 VALUES (x,x,y);
END|
DELIMITER ;|
#
# Start test case
#
# Do some actions for non-transactional tables
--echo
CREATE TABLE t3 SELECT * FROM v1;
INSERT INTO t1 VALUES (3,3,'');
UPDATE t1 SET c='2' WHERE a = 1;
INSERT INTO t1 VALUES(4,4,f1(4));
INSERT INTO t1 VALUES (100,100,'');
CALL p1(5, UUID());
INSERT INTO t1 VALUES (101,101,'');
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
--echo
CREATE TABLE t13 SELECT * FROM v11;
INSERT INTO t11 VALUES (3,3,'');
UPDATE t11 SET c='2' WHERE a = 1;
INSERT INTO t11 VALUES(4,4,f1(4));
INSERT INTO t11 VALUES (100,100,'');
CALL p11(5, UUID());
INSERT INTO t11 VALUES (101,101,'');
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
--echo
SET GLOBAL EVENT_SCHEDULER = on;
# Wait 2 sec while events will executed
--sleep 2
# Check original objects
--echo
SHOW TABLES LIKE 't%';
SELECT table_name FROM information_schema.views WHERE table_schema='test';
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
# Check original data
--echo
SELECT COUNT(*) FROM t1;
SELECT a,b FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t2;
SELECT a,b FROM t2 ORDER BY a;
SELECT COUNT(*) FROM t3;
SELECT a,b FROM t3 ORDER BY a;
SELECT a,b FROM v1 ORDER BY a;
SELECT COUNT(*) FROM t11;
SELECT a,b FROM t11 ORDER BY a;
SELECT COUNT(*) FROM t12;
SELECT a,b FROM t12 ORDER BY a;
SELECT COUNT(*) FROM t13;
SELECT a,b FROM t13 ORDER BY a;
SELECT a,b FROM v11 ORDER BY a;
--sync_slave_with_master slave
# Check replicated objects
--echo
SHOW TABLES LIKE 't%';
SELECT table_name FROM information_schema.views WHERE table_schema='test';
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
# Check replicated data
--echo
SELECT COUNT(*) FROM t1;
SELECT a,b FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t2;
SELECT a,b FROM t2 ORDER BY a;
SELECT COUNT(*) FROM t3;
SELECT a,b FROM t3 ORDER BY a;
SELECT a,b FROM v1 ORDER BY a;
SELECT COUNT(*) FROM t11;
SELECT a,b FROM t11 ORDER BY a;
SELECT COUNT(*) FROM t12;
SELECT a,b FROM t12 ORDER BY a;
SELECT COUNT(*) FROM t13;
SELECT a,b FROM t13 ORDER BY a;
SELECT a,b FROM v11 ORDER BY a;
# Remove UUID() before comparing
--connection master
--echo
UPDATE t1 SET c='';
UPDATE t2 SET c='';
UPDATE t3 SET c='';
UPDATE t11 SET c='';
UPDATE t12 SET c='';
UPDATE t13 SET c='';
--sync_slave_with_master slave
# 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_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
--exec rm $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
--exec rm $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
# Remove tables,views,procedures,functions
--echo
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP VIEW IF EXISTS v1,v2;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
--enable_warnings
# End 5.1 test case
......@@ -3295,7 +3295,7 @@ with --log-bin instead.");
}
else
{
global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC;
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
}
else
if (opt_binlog_format_id == BINLOG_FORMAT_UNSPEC)
......
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