Commit 85aea5a1 authored by Sergei Petrunia's avatar Sergei Petrunia

Update .result for rocksdb.rpl_row_triggers (not the whole test works yet)

parent 850702da
include/master-slave.inc include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection master] [connection master]
# Test of row replication with triggers on the slave side # Test of row replication with triggers on the slave side
connection master;
CREATE TABLE t1 (C1 CHAR(1) primary key, C2 CHAR(1)); CREATE TABLE t1 (C1 CHAR(1) primary key, C2 CHAR(1));
SELECT * FROM t1; SELECT * FROM t1;
C1 C2 C1 C2
connection slave;
connection slave;
SET @old_slave_exec_mode= @@global.slave_exec_mode; SET @old_slave_exec_mode= @@global.slave_exec_mode;
SET @old_slave_run_triggers_for_rbr= @@global.slave_run_triggers_for_rbr; SET @old_slave_run_triggers_for_rbr= @@global.slave_run_triggers_for_rbr;
SET @@global.slave_exec_mode= IDEMPOTENT; SET @@global.slave_exec_mode= IDEMPOTENT;
...@@ -38,8 +38,11 @@ i0 0 ...@@ -38,8 +38,11 @@ i0 0
i1 0 i1 0
u0 0 u0 0
u1 0 u1 0
connection master;
# INSERT triggers test # INSERT triggers test
insert into t1 values ('a','b'); insert into t1 values ('a','b');
connection slave;
connection slave;
SELECT * FROM t2 order by id; SELECT * FROM t2 order by id;
id cnt o n id cnt o n
d0 0 d0 0
...@@ -48,8 +51,11 @@ i0 1 a ...@@ -48,8 +51,11 @@ i0 1 a
i1 1 a i1 1 a
u0 0 u0 0
u1 0 u1 0
connection master;
# UPDATE triggers test # UPDATE triggers test
update t1 set C1= 'd'; update t1 set C1= 'd';
connection slave;
connection slave;
SELECT * FROM t2 order by id; SELECT * FROM t2 order by id;
id cnt o n id cnt o n
d0 0 d0 0
...@@ -58,8 +64,11 @@ i0 1 a ...@@ -58,8 +64,11 @@ i0 1 a
i1 1 a i1 1 a
u0 1 a d u0 1 a d
u1 1 a d u1 1 a d
connection master;
# DELETE triggers test # DELETE triggers test
delete from t1 where C1='d'; delete from t1 where C1='d';
connection slave;
connection slave;
SELECT * FROM t2 order by id; SELECT * FROM t2 order by id;
id cnt o n id cnt o n
d0 1 d d0 1 d
...@@ -78,7 +87,10 @@ i0 2 0 ...@@ -78,7 +87,10 @@ i0 2 0
i1 2 0 i1 2 0
u0 1 a d u0 1 a d
u1 1 a d u1 1 a d
connection master;
insert into t1 values ('0','1'); insert into t1 values ('0','1');
connection slave;
connection slave;
SELECT * FROM t2 order by id; SELECT * FROM t2 order by id;
id cnt o n id cnt o n
d0 1 d d0 1 d
...@@ -90,32 +102,44 @@ u1 2 0 0 ...@@ -90,32 +102,44 @@ u1 2 0 0
# INSERT triggers which cause also DELETE test # INSERT triggers which cause also DELETE test
# (insert duplicate row in table referenced by foreign key) # (insert duplicate row in table referenced by foreign key)
insert into t1 values ('1','1'); insert into t1 values ('1','1');
connection master;
drop table if exists t1; drop table if exists t1;
connection slave;
connection slave;
SET @@global.slave_exec_mode= @old_slave_exec_mode; SET @@global.slave_exec_mode= @old_slave_exec_mode;
SET @@global.slave_run_triggers_for_rbr= @old_slave_run_triggers_for_rbr; SET @@global.slave_run_triggers_for_rbr= @old_slave_run_triggers_for_rbr;
drop table t2; drop table t2;
connection master;
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
CREATE TABLE t2 (i INT); CREATE TABLE t2 (i INT);
connection slave;
SET @old_slave_run_triggers_for_rbr= @@global.slave_run_triggers_for_rbr; SET @old_slave_run_triggers_for_rbr= @@global.slave_run_triggers_for_rbr;
SET GLOBAL slave_run_triggers_for_rbr=YES; SET GLOBAL slave_run_triggers_for_rbr=YES;
CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW
INSERT INTO t2 VALUES (new.i); INSERT INTO t2 VALUES (new.i);
connection master;
BEGIN; BEGIN;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
COMMIT; COMMIT;
connection slave;
select * from t2; select * from t2;
i i
1 1
2 2
SET @@global.slave_run_triggers_for_rbr= @old_slave_run_triggers_for_rbr; SET @@global.slave_run_triggers_for_rbr= @old_slave_run_triggers_for_rbr;
connection master;
drop tables t2,t1; drop tables t2,t1;
connection slave;
# Triggers on slave do not work if master has some # Triggers on slave do not work if master has some
connection master;
CREATE TABLE t1 (C1 CHAR(1) primary key, C2 CHAR(1)); CREATE TABLE t1 (C1 CHAR(1) primary key, C2 CHAR(1));
SELECT * FROM t1; SELECT * FROM t1;
C1 C2 C1 C2
create trigger t1_dummy before delete on t1 for each row create trigger t1_dummy before delete on t1 for each row
set @dummy= 1; set @dummy= 1;
connection slave;
connection slave;
SET @old_slave_exec_mode= @@global.slave_exec_mode; SET @old_slave_exec_mode= @@global.slave_exec_mode;
SET @old_slave_run_triggers_for_rbr= @@global.slave_run_triggers_for_rbr; SET @old_slave_run_triggers_for_rbr= @@global.slave_run_triggers_for_rbr;
SET @@global.slave_exec_mode= IDEMPOTENT; SET @@global.slave_exec_mode= IDEMPOTENT;
...@@ -145,8 +169,11 @@ i0 0 ...@@ -145,8 +169,11 @@ i0 0
i1 0 i1 0
u0 0 u0 0
u1 0 u1 0
connection master;
# INSERT triggers test # INSERT triggers test
insert into t1 values ('a','b'); insert into t1 values ('a','b');
connection slave;
connection slave;
SELECT * FROM t2 order by id; SELECT * FROM t2 order by id;
id cnt o n id cnt o n
d0 0 d0 0
...@@ -155,8 +182,11 @@ i0 0 ...@@ -155,8 +182,11 @@ i0 0
i1 0 i1 0
u0 0 u0 0
u1 0 u1 0
connection master;
# UPDATE triggers test # UPDATE triggers test
update t1 set C1= 'd'; update t1 set C1= 'd';
connection slave;
connection slave;
SELECT * FROM t2 order by id; SELECT * FROM t2 order by id;
id cnt o n id cnt o n
d0 0 d0 0
...@@ -165,8 +195,11 @@ i0 0 ...@@ -165,8 +195,11 @@ i0 0
i1 0 i1 0
u0 0 u0 0
u1 0 u1 0
connection master;
# DELETE triggers test # DELETE triggers test
delete from t1 where C1='d'; delete from t1 where C1='d';
connection slave;
connection slave;
SELECT * FROM t2 order by id; SELECT * FROM t2 order by id;
id cnt o n id cnt o n
d0 0 d0 0
...@@ -185,7 +218,10 @@ i0 1 0 ...@@ -185,7 +218,10 @@ i0 1 0
i1 1 0 i1 1 0
u0 0 u0 0
u1 0 u1 0
connection master;
insert into t1 values ('0','1'); insert into t1 values ('0','1');
connection slave;
connection slave;
SELECT * FROM t2 order by id; SELECT * FROM t2 order by id;
id cnt o n id cnt o n
d0 0 d0 0
...@@ -197,22 +233,30 @@ u1 0 ...@@ -197,22 +233,30 @@ u1 0
# INSERT triggers which cause also DELETE test # INSERT triggers which cause also DELETE test
# (insert duplicate row in table referenced by foreign key) # (insert duplicate row in table referenced by foreign key)
insert into t1 values ('1','1'); insert into t1 values ('1','1');
connection master;
drop table if exists t1; drop table if exists t1;
connection slave;
connection slave;
SET @@global.slave_exec_mode= @old_slave_exec_mode; SET @@global.slave_exec_mode= @old_slave_exec_mode;
SET @@global.slave_run_triggers_for_rbr= @old_slave_run_triggers_for_rbr; SET @@global.slave_run_triggers_for_rbr= @old_slave_run_triggers_for_rbr;
drop table t2; drop table t2;
# #
# MDEV-5513: Trigger is applied to the rows after first one # MDEV-5513: Trigger is applied to the rows after first one
# #
connection master;
create table t1 (a int, b int); create table t1 (a int, b int);
create table tlog (a int auto_increment primary key); create table tlog (a int auto_increment primary key);
set sql_log_bin=0; set sql_log_bin=0;
create trigger tr1 after insert on t1 for each row insert into tlog values (null); create trigger tr1 after insert on t1 for each row insert into tlog values (null);
set sql_log_bin=1; set sql_log_bin=1;
connection slave;
connection slave;
set @slave_run_triggers_for_rbr.saved = @@slave_run_triggers_for_rbr; set @slave_run_triggers_for_rbr.saved = @@slave_run_triggers_for_rbr;
set global slave_run_triggers_for_rbr=1; set global slave_run_triggers_for_rbr=1;
create trigger tr2 before insert on t1 for each row set new.b = new.a; create trigger tr2 before insert on t1 for each row set new.b = new.a;
connection master;
insert into t1 values (1,10),(2,20),(3,30); insert into t1 values (1,10),(2,20),(3,30);
connection slave;
select * from t1; select * from t1;
a b a b
1 10 1 10
......
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