Commit c710c450 authored by Jan Lindström's avatar Jan Lindström

MDEV-21578 : CREATE OR REPLACE TRIGGER in Galera cluster not replicating

While doing TOI buffer OR REPLACE option was not added to replicated
string.
parent df07ea0b
CREATE TABLE IF NOT EXISTS t1 (id int(10) not null primary key) engine=innodb;
CREATE OR REPLACE TRIGGER tr1
BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
SET NEW.id = 100;
END|
INSERT INTO t1 VALUES (1);
SELECT * from t1;
id
100
CREATE OR REPLACE TRIGGER tr1
BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
SET NEW.id = 200;
END|
connection node_2;
SET SESSION wsrep_sync_wait=15;
SELECT * FROM t1;
id
100
INSERT INTO t1 values (2);
SELECT * FROM t1;
id
100
200
connection node_1;
SELECT * FROM t1;
id
100
200
DROP TRIGGER tr1;
DROP TABLE t1;
--source include/galera_cluster.inc
#
# MDEV-21578 CREATE OR REPLACE TRIGGER in Galera cluster not replicating
#
CREATE TABLE IF NOT EXISTS t1 (id int(10) not null primary key) engine=innodb;
--delimiter |
CREATE OR REPLACE TRIGGER tr1
BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
SET NEW.id = 100;
END|
--delimiter ;
INSERT INTO t1 VALUES (1);
SELECT * from t1;
--delimiter |
CREATE OR REPLACE TRIGGER tr1
BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
SET NEW.id = 200;
END|
--delimiter ;
--connection node_2
SET SESSION wsrep_sync_wait=15;
SELECT * FROM t1;
INSERT INTO t1 values (2);
SELECT * FROM t1;
--connection node_1
SELECT * FROM t1;
DROP TRIGGER tr1;
DROP TABLE t1;
......@@ -2924,7 +2924,12 @@ static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
definer_host.length= 0;
}
stmt_query.append(STRING_WITH_LEN("CREATE "));
const LEX_STRING command[3]=
{{ C_STRING_WITH_LEN("CREATE ") },
{ C_STRING_WITH_LEN("ALTER ") },
{ C_STRING_WITH_LEN("CREATE OR REPLACE ") }};
stmt_query.append(command[thd->lex->create_view_mode].str,
command[thd->lex->create_view_mode].length);
append_definer(thd, &stmt_query, &definer_user, &definer_host);
......
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