| 1 |
############################################################################# |
| 2 |
# Original Author: JBM # |
| 3 |
# Original Date: Aug/14/2005 # |
| 4 |
# Updated: 08/29/2005 added save master pos and sync with master # |
| 5 |
############################################################################# |
| 6 |
# TEST: Taken and modified from BUG#12048 After Insert updates replication # |
| 7 |
############################################################################# |
| 8 |
|
| 9 |
# Includes |
| 10 |
-- source include/have_binlog_format_row.inc |
| 11 |
-- source include/set_privilege_checks_user_as_system_user.inc |
| 12 |
-- source include/master-slave.inc |
| 13 |
|
| 14 |
#-- disable_query_log |
| 15 |
#-- disable_result_log |
| 16 |
|
| 17 |
# Begin clean up test section |
| 18 |
connection master; |
| 19 |
--disable_warnings |
| 20 |
--error 0,1360 |
| 21 |
DROP TRIGGER test.t2_ai; |
| 22 |
DROP TABLE IF EXISTS test.t1; |
| 23 |
DROP TABLE IF EXISTS test.t2; |
| 24 |
DROP TABLE IF EXISTS test.t3; |
| 25 |
--enable_warnings |
| 26 |
|
| 27 |
# test section 1, Taken from bug #12408 |
| 28 |
|
| 29 |
CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id)); |
| 30 |
|
| 31 |
CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id)); |
| 32 |
|
| 33 |
CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id)); |
| 34 |
|
| 35 |
delimiter |; |
| 36 |
CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'| |
| 37 |
delimiter ;| |
| 38 |
|
| 39 |
INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com'); |
| 40 |
|
| 41 |
SELECT * FROM test.t1 ORDER BY id; |
| 42 |
#show binlog events; |
| 43 |
--source include/sync_slave_sql_with_master.inc |
| 44 |
SELECT * FROM test.t1 ORDER BY id; |
| 45 |
connection master; |
| 46 |
|
| 47 |
INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming'); |
| 48 |
INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming'); |
| 49 |
INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming'); |
| 50 |
|
| 51 |
select * from test.t2; |
| 52 |
select * from test.t3 order by value; |
| 53 |
--source include/sync_slave_sql_with_master.inc |
| 54 |
select * from test.t2; |
| 55 |
select * from test.t3 order by value; |
| 56 |
connection master; |
| 57 |
|
| 58 |
DELETE FROM test.t1 WHERE id = 1; |
| 59 |
|
| 60 |
SELECT * FROM test.t1 ORDER BY id; |
| 61 |
connection master; |
| 62 |
SELECT * FROM test.t1 ORDER BY id; |
| 63 |
--source include/sync_slave_sql_with_master.inc |
| 64 |
SELECT * FROM test.t1 ORDER BY id; |
| 65 |
|
| 66 |
# Cleanup |
| 67 |
connection master; |
| 68 |
#show binlog events; |
| 69 |
DROP TRIGGER test.t2_ai; |
| 70 |
DROP TABLE test.t1; |
| 71 |
DROP TABLE test.t2; |
| 72 |
DROP TABLE test.t3; |
| 73 |
--source include/sync_slave_sql_with_master.inc |
| 74 |
|
| 75 |
# End of 5.0 test case |
| 76 |
--source include/rpl_end.inc |