Debian Codegraph @

mysql-test/suite/galera/t/galera_trigger.test

raw
1 --source include/galera_cluster.inc
2 #
3 # MDEV-21578 CREATE OR REPLACE TRIGGER in Galera cluster not replicating
4 #
5 CREATE TABLE IF NOT EXISTS t1 (id int(10) not null primary key) engine=innodb;
6 --delimiter |
7 CREATE OR REPLACE TRIGGER tr1
8 BEFORE INSERT ON t1 FOR EACH ROW
9 BEGIN
10 SET NEW.id = 100;
11 END|
12 --delimiter ;
13
14 INSERT INTO t1 VALUES (1);
15 SELECT * from t1;
16
17 --delimiter |
18 CREATE OR REPLACE TRIGGER tr1
19 BEFORE INSERT ON t1 FOR EACH ROW
20 BEGIN
21 SET NEW.id = 200;
22 END|
23 --delimiter ;
24
25 --connection node_2
26 SET SESSION wsrep_sync_wait=15;
27 SELECT * FROM t1;
28 INSERT INTO t1 values (2);
29 SELECT * FROM t1;
30
31 --connection node_1
32 SELECT * FROM t1;
33
34 DROP TRIGGER tr1;
35 DROP TABLE t1;
36 #
37 # MDEV-23638 : DROP TRIGGER in Galera Cluster not replicating
38 #
39 --connection node_1
40 CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb;
41
42 CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id));
43
44 --delimiter |
45 create trigger log_insert after insert on t1
46 for each row begin
47 insert into t2(tbl, action) values ('t1', 'INSERT');
48 end|
49 --delimiter ;
50
51 insert into t1(value) values (1);
52 insert into t1(value) values (2);
53
54 --connection node_2
55 set session wsrep_sync_wait=15;
56 insert into t1(value) values (3);
57 insert into t1(value) values (4);
58 select tbl, action from t2;
59
60 --connection node_1
61 drop trigger if exists log_insert;
62 insert into t1(value) values (5);
63 select tbl, action from t2;
64
65 --connection node_2
66 insert into t1(value) values (6);
67 select tbl, action from t2;
68
69 --connection node_1
70 select tbl, action from t2;
71
72 drop table t1, t2;