MDEV-26048: Table 'test._test_new' doesn't exist when add trigger (use pt-osc) - #1872
MDEV-26048: Table 'test._test_new' doesn't exist when add trigger (use pt-osc)#1872cstarc wants to merge 2 commits into
Conversation
|
Why not creating an MTR test instead of providing a test case in the description of this PR? |
|
Does |
|
yes. pt-osc refer to pt-online-schema-change . and it can be reproduced by using mysql client to simulate this scene. |
|
Thank you for the patch, what it is really lack description what was going on and what was fixed. I am trying to reconstruct it now... |
|
IMHO it is part of bigger problem of changing tables during procedure execition and shoud be fixed with all other problems. changing tables during SP execution if not preventible shoud lead to SP error (as it is now) or fixed all together (i.e. behaviour should be consistent) |
gkodinov
left a comment
There was a problem hiding this comment.
This is a preliminary review. I sincerely hope you'd still be willing to see that merged.
In case you are, here are the steps to restart this:
- rebase on the lates 10.11: this is a bug and that is where it needs to go.
- squash the commits into a single one with a suitable commit message describing the change
- please make sure to add a regression test
- reply to Sanja's comment about it being a bigger problem
Sorry for the delay and thank you in advance for your understanding and cooperation.
Description
the patch try to solve the problem : Table 'test._test_new' doesn't exist when add trigger (use pt-osc).
after patch apply it will not report table doesn‘t exist.
and I'm not sure this patch may introduce side-effects in
other parts of the server.
How can this PR be tested?
create table t1(key1 int, key2 int);
DELIMITER $
CREATE PROCEDURE sp()
BEGIN
DECLARE a INT DEFAULT 1;
WHILE a < 20001 DO
INSERT INTO t1 VALUES(1,1);
SET a = a + 1;
END WHILE;
END$
DELIMITER ;
connect (user1, localhost, root, ,);
connect (user2, localhost, root, ,);
connection user1;
--send call sp();
connection user2;
create table t2(key1 int, key2 int);
CREATE TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM t2 ;
DROP TRIGGER tr1;
CREATE TRIGGER tr2 AFTER INSERT ON t1 FOR EACH ROW insert INTO t2 VALUES (1,1);
DROP TRIGGER tr2;
DROP TABLE t2;
connection user1;
--reap
select count(*) from t1;
provide by Alice Sherepa.
Basing the PR against the correct MariaDB version