diff options
author | unknown <aelkin@mysql.com> | 2006-01-30 14:33:15 +0200 |
---|---|---|
committer | unknown <aelkin@mysql.com> | 2006-01-30 14:33:15 +0200 |
commit | cb2cc4dabb18089b1b2b99ace43843d202de5d37 (patch) | |
tree | 0829742a8eb3336a5a179ec985bd3c9c3c62f6b9 /mysql-test/t/rpl_trigger.test | |
parent | 5c142d365885352df55c7a1ea748f5e7296fda02 (diff) | |
download | mariadb-git-cb2cc4dabb18089b1b2b99ace43843d202de5d37.tar.gz |
BUG#13227 test case to examine that local slave's triggers that use select work ok even if they fire
for replicated update.
mysql-test/r/rpl_trigger.result:
results are changed to account 13227 addon.
mysql-test/t/rpl_trigger.test:
BUG#13227 test case is added.
Diffstat (limited to 'mysql-test/t/rpl_trigger.test')
-rw-r--r-- | mysql-test/t/rpl_trigger.test | 98 |
1 files changed, 97 insertions, 1 deletions
diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test index fa6054372c7..f3db1cb5841 100644 --- a/mysql-test/t/rpl_trigger.test +++ b/mysql-test/t/rpl_trigger.test @@ -163,7 +163,103 @@ drop table t1,t2; drop database other; # -# End of test +# Test specific triggers including SELECT into var with replication +# BUG#13227: +# slave performs an update to the replicatable table, t1, +# and modifies its local data, t3, by mean of its local trigger that uses +# another local table t2. +# Expected values are commented into queries. +# +# Body of the test executes in a loop since the problem occurred randomly. +# + +let $max_rows=5; +let $rnd=10; + +--echo test case for BUG#13227 +while ($rnd) +{ + --echo ------------------- + echo $rnd; + --echo ------------------- + +### SETUP + +--disable_warnings + connection master; + eval drop table if exists t1$rnd; + connection slave; + eval drop table if exists t2$rnd,t3$rnd; +--enable_warnings + + connection master; + eval create table t1$rnd (f1 int) /* 2 replicate */; + let $i=$max_rows; + while ($i) + { + eval insert into t1$rnd values (-$i); + dec $i; + } + + sync_slave_with_master; +#connection slave; + eval select * from t1$rnd; + delimiter |; + eval create trigger trg1$rnd before update on t1$rnd /* slave local */ + for each row + begin + DECLARE r integer; + SELECT f2 INTO r FROM t2$rnd where f1=NEW.f1; + INSERT INTO t3$rnd values (r); + end| + delimiter ;| + eval create table t2$rnd (f1 int, f2 int) /* slave local */; + eval create table t3$rnd (f3 int) /* slave local */; + let $i=$max_rows; + while ($i) + { + eval insert into t2$rnd values ($i, $i*100); + dec $i; + } + +### Test + +#connection slave; + +# trigger works as specified when updates from slave + eval select * from t2$rnd; + eval UPDATE t1$rnd SET f1=$max_rows where f1=-$max_rows; + eval SELECT * from t1$rnd /* must be f1 $max_rows, 1 - $max_rows 2 - $max_rows ... -1 */; + eval SELECT * from t3$rnd /* must be f3 $max_rows*100 */; + + connection master; + let $i=$max_rows; + while ($i) + { + eval UPDATE t1$rnd SET f1=$i where f1=-$i; + dec $i; + } + + sync_slave_with_master; +#connection slave; + eval SELECT * from t1$rnd /* must be f1 $max_rows ... 1 */; + eval SELECT * from t3$rnd /* must be f3 $max_rows * 100 ... 100 */; + +### CLEANUP +#connection slave; + eval drop trigger trg1$rnd; + eval drop table t2$rnd,t3$rnd; + + connection master; + eval drop table t1$rnd; + + dec $rnd; +} + + + +# +# End of tests # save_master_pos; connection slave; |