diff options
author | unknown <anozdrin/alik@booka.> | 2006-07-28 02:49:18 +0400 |
---|---|---|
committer | unknown <anozdrin/alik@booka.> | 2006-07-28 02:49:18 +0400 |
commit | d36f57813094135cf4cf7f4ab3ca275714b9c44c (patch) | |
tree | c10c09a840456bf62d7906ab2295f10857cf900b /mysql-test/t/rpl_trigger.test | |
parent | 3c108584740ca89fb77c7f002c67982abb86651c (diff) | |
download | mariadb-git-d36f57813094135cf4cf7f4ab3ca275714b9c44c.tar.gz |
Fix for BUG#20438: CREATE statements for views, stored routines and triggers
can be not replicable.
Now CREATE statements for writing in the binlog are created as follows:
- the beginning of the statement is re-created;
- the rest of the statement is copied from the original query.
The problem appears when there is a version-specific comment (produced by
mysqldump), started in the re-created part of the statement and closed in the
copied part -- there is closing comment-parenthesis, but there is no opening
one.
The proper fix could be to re-create original statement, but we can not
implement it in 5.0. So, for 5.0 the fix is just to cut closing
comment-parenthesis. This technique is also used for SHOW CREATE PROCEDURE
statement (so we are able to reuse existing code).
mysql-test/r/rpl_sp.result:
Updated result file.
mysql-test/r/rpl_trigger.result:
Updated result file.
mysql-test/r/rpl_view.result:
Updated result file.
mysql-test/t/rpl_sp.test:
Added test case for BUG#20438.
mysql-test/t/rpl_trigger.test:
Added test case for BUG#20438.
mysql-test/t/rpl_view.test:
Added test case for BUG#20438.
sql/sp.cc:
Trim comments at the end.
sql/sp_head.cc:
Moved this code to the separate function to be re-used.
sql/sql_lex.cc:
Added a new function.
sql/sql_lex.h:
Added a new function.
sql/sql_trigger.cc:
Trim comments at the end.
sql/sql_view.cc:
Trim comments at the end.
Diffstat (limited to 'mysql-test/t/rpl_trigger.test')
-rw-r--r-- | mysql-test/t/rpl_trigger.test | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test index 35f0a0b0a4b..3c8cbb97b31 100644 --- a/mysql-test/t/rpl_trigger.test +++ b/mysql-test/t/rpl_trigger.test @@ -331,6 +331,98 @@ SHOW TRIGGERS; RESET MASTER; +# Restart slave. + +connection slave; +START SLAVE; + + +# +# BUG#20438: CREATE statements for views, stored routines and triggers can be +# not replicable. +# + +--echo +--echo ---> Test for BUG#20438 + +# Prepare environment. + +--echo +--echo ---> Preparing environment... +--echo ---> connection: master +--connection master + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +--enable_warnings + +--echo +--echo ---> Synchronizing slave with master... + +--save_master_pos +--connection slave +--sync_with_master + +--echo +--echo ---> connection: master +--connection master + +# Test. + +--echo +--echo ---> Creating objects... + +CREATE TABLE t1(c INT); +CREATE TABLE t2(c INT); + +/*!50003 CREATE TRIGGER t1_bi BEFORE INSERT ON t1 + FOR EACH ROW + INSERT INTO t2 VALUES(NEW.c * 10) */; + +--echo +--echo ---> Inserting value... + +INSERT INTO t1 VALUES(1); + +--echo +--echo ---> Checking on master... + +SELECT * FROM t1; +SELECT * FROM t2; + +--echo +--echo ---> Synchronizing slave with master... + +--save_master_pos +--connection slave +--sync_with_master + +--echo ---> connection: master + +--echo +--echo ---> Checking on slave... + +SELECT * FROM t1; +SELECT * FROM t2; + +# Cleanup. + +--echo +--echo ---> connection: master +--connection master + +--echo +--echo ---> Cleaning up... + +DROP TABLE t1; +DROP TABLE t2; + +--save_master_pos +--connection slave +--sync_with_master +--connection master + # # End of tests |