mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Move test from main.trigger to main.trigger_notembedded, as it now depends on INFORMATION_SCHEMA.PROCESSLIST (rather than sleeps) to synchronise.
This commit is contained in:
parent
37d9810d01
commit
03854661c5
4 changed files with 100 additions and 99 deletions
|
@ -1448,33 +1448,6 @@ isave
|
|||
1
|
||||
2
|
||||
drop table t1, t2, t3;
|
||||
CREATE TABLE t1 (id INTEGER);
|
||||
CREATE TABLE t2 (id INTEGER);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW
|
||||
INSERT INTO t2 VALUES (new.id);
|
||||
SELECT GET_LOCK('B26162',120);
|
||||
GET_LOCK('B26162',120)
|
||||
1
|
||||
SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
|
||||
SET SESSION LOW_PRIORITY_UPDATES=1;
|
||||
SET GLOBAL LOW_PRIORITY_UPDATES=1;
|
||||
INSERT INTO t1 VALUES (5);
|
||||
SELECT 'rl_contender', id FROM t2 WHERE id > 1;
|
||||
SELECT RELEASE_LOCK('B26162');
|
||||
RELEASE_LOCK('B26162')
|
||||
1
|
||||
rl_acquirer GET_LOCK('B26162',120) id
|
||||
rl_acquirer 1 1
|
||||
SELECT RELEASE_LOCK('B26162');
|
||||
RELEASE_LOCK('B26162')
|
||||
1
|
||||
rl_contender id
|
||||
rl_contender 2
|
||||
DROP TRIGGER t1_test;
|
||||
DROP TABLE t1,t2;
|
||||
SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
|
||||
SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
|
||||
|
||||
Bug#28502 Triggers that update another innodb table will block
|
||||
on X lock unnecessarily
|
||||
|
|
|
@ -445,6 +445,33 @@ DROP TABLE t2;
|
|||
DROP TABLE t1;
|
||||
DROP DATABASE mysqltest_db1;
|
||||
USE test;
|
||||
CREATE TABLE t1 (id INTEGER);
|
||||
CREATE TABLE t2 (id INTEGER);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW
|
||||
INSERT INTO t2 VALUES (new.id);
|
||||
SELECT GET_LOCK('B26162',120);
|
||||
GET_LOCK('B26162',120)
|
||||
1
|
||||
SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
|
||||
SET SESSION LOW_PRIORITY_UPDATES=1;
|
||||
SET GLOBAL LOW_PRIORITY_UPDATES=1;
|
||||
INSERT INTO t1 VALUES (5);
|
||||
SELECT 'rl_contender', id FROM t2 WHERE id > 1;
|
||||
SELECT RELEASE_LOCK('B26162');
|
||||
RELEASE_LOCK('B26162')
|
||||
1
|
||||
rl_acquirer GET_LOCK('B26162',120) id
|
||||
rl_acquirer 1 1
|
||||
SELECT RELEASE_LOCK('B26162');
|
||||
RELEASE_LOCK('B26162')
|
||||
1
|
||||
rl_contender id
|
||||
rl_contender 2
|
||||
DROP TRIGGER t1_test;
|
||||
DROP TABLE t1,t2;
|
||||
SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
|
||||
SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
|
||||
End of 5.0 tests.
|
||||
drop table if exists t1;
|
||||
create table t1 (i int);
|
||||
|
|
|
@ -1767,78 +1767,6 @@ drop table t1, t2, t3;
|
|||
disconnect addconroot1;
|
||||
disconnect addconroot2;
|
||||
disconnect addconwithoutdb;
|
||||
#
|
||||
# Bug #26162: Trigger DML ignores low_priority_updates setting
|
||||
#
|
||||
CREATE TABLE t1 (id INTEGER);
|
||||
CREATE TABLE t2 (id INTEGER);
|
||||
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
|
||||
# trigger that produces the high priority insert, but should be low, adding
|
||||
# LOW_PRIORITY fixes this
|
||||
CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW
|
||||
INSERT INTO t2 VALUES (new.id);
|
||||
|
||||
CONNECT (rl_holder, localhost, root,,);
|
||||
CONNECT (rl_acquirer, localhost, root,,);
|
||||
CONNECT (wl_acquirer, localhost, root,,);
|
||||
CONNECT (rl_contender, localhost, root,,);
|
||||
|
||||
CONNECTION rl_holder;
|
||||
SELECT GET_LOCK('B26162',120);
|
||||
|
||||
CONNECTION rl_acquirer;
|
||||
let $rl_acquirer_thread_id = `SELECT @@pseudo_thread_id`;
|
||||
--send
|
||||
SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
|
||||
|
||||
CONNECTION wl_acquirer;
|
||||
let $wl_acquirer_thread_id = `SELECT @@pseudo_thread_id`;
|
||||
SET SESSION LOW_PRIORITY_UPDATES=1;
|
||||
SET GLOBAL LOW_PRIORITY_UPDATES=1;
|
||||
#need to wait for rl_acquirer to lock on the B26162 lock
|
||||
let $wait_condition=
|
||||
SELECT STATE = 'User lock' FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE ID = $rl_acquirer_thread_id;
|
||||
--source include/wait_condition.inc
|
||||
--send
|
||||
INSERT INTO t1 VALUES (5);
|
||||
|
||||
CONNECTION rl_contender;
|
||||
# Wait until wl_acquirer is waiting for the read lock on t2 to be released.
|
||||
let $wait_condition=
|
||||
SELECT STATE = 'Locked' FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE ID = $wl_acquirer_thread_id;
|
||||
--source include/wait_condition.inc
|
||||
# must not "see" the row inserted by the INSERT (as it must run before the
|
||||
# INSERT)
|
||||
--send
|
||||
SELECT 'rl_contender', id FROM t2 WHERE id > 1;
|
||||
|
||||
CONNECTION rl_holder;
|
||||
#need to wait for wl_acquirer and rl_contender to lock on t2
|
||||
sleep 2;
|
||||
SELECT RELEASE_LOCK('B26162');
|
||||
|
||||
CONNECTION rl_acquirer;
|
||||
--reap
|
||||
SELECT RELEASE_LOCK('B26162');
|
||||
CONNECTION wl_acquirer;
|
||||
--reap
|
||||
CONNECTION rl_contender;
|
||||
--reap
|
||||
|
||||
CONNECTION default;
|
||||
DISCONNECT rl_acquirer;
|
||||
DISCONNECT wl_acquirer;
|
||||
DISCONNECT rl_contender;
|
||||
DISCONNECT rl_holder;
|
||||
|
||||
DROP TRIGGER t1_test;
|
||||
DROP TABLE t1,t2;
|
||||
SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
|
||||
SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
|
||||
--echo
|
||||
--echo Bug#28502 Triggers that update another innodb table will block
|
||||
--echo on X lock unnecessarily
|
||||
|
|
|
@ -875,6 +875,79 @@ DROP TABLE t1;
|
|||
DROP DATABASE mysqltest_db1;
|
||||
USE test;
|
||||
|
||||
#
|
||||
# Bug #26162: Trigger DML ignores low_priority_updates setting
|
||||
#
|
||||
CREATE TABLE t1 (id INTEGER);
|
||||
CREATE TABLE t2 (id INTEGER);
|
||||
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
|
||||
# trigger that produces the high priority insert, but should be low, adding
|
||||
# LOW_PRIORITY fixes this
|
||||
CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW
|
||||
INSERT INTO t2 VALUES (new.id);
|
||||
|
||||
CONNECT (rl_holder, localhost, root,,);
|
||||
CONNECT (rl_acquirer, localhost, root,,);
|
||||
CONNECT (wl_acquirer, localhost, root,,);
|
||||
CONNECT (rl_contender, localhost, root,,);
|
||||
|
||||
CONNECTION rl_holder;
|
||||
SELECT GET_LOCK('B26162',120);
|
||||
|
||||
CONNECTION rl_acquirer;
|
||||
let $rl_acquirer_thread_id = `SELECT @@pseudo_thread_id`;
|
||||
--send
|
||||
SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
|
||||
|
||||
CONNECTION wl_acquirer;
|
||||
let $wl_acquirer_thread_id = `SELECT @@pseudo_thread_id`;
|
||||
SET SESSION LOW_PRIORITY_UPDATES=1;
|
||||
SET GLOBAL LOW_PRIORITY_UPDATES=1;
|
||||
#need to wait for rl_acquirer to lock on the B26162 lock
|
||||
let $wait_condition=
|
||||
SELECT STATE = 'User lock' FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE ID = $rl_acquirer_thread_id;
|
||||
--source include/wait_condition.inc
|
||||
--send
|
||||
INSERT INTO t1 VALUES (5);
|
||||
|
||||
CONNECTION rl_contender;
|
||||
# Wait until wl_acquirer is waiting for the read lock on t2 to be released.
|
||||
let $wait_condition=
|
||||
SELECT STATE = 'Locked' FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE ID = $wl_acquirer_thread_id;
|
||||
--source include/wait_condition.inc
|
||||
# must not "see" the row inserted by the INSERT (as it must run before the
|
||||
# INSERT)
|
||||
--send
|
||||
SELECT 'rl_contender', id FROM t2 WHERE id > 1;
|
||||
|
||||
CONNECTION rl_holder;
|
||||
#need to wait for wl_acquirer and rl_contender to lock on t2
|
||||
sleep 2;
|
||||
SELECT RELEASE_LOCK('B26162');
|
||||
|
||||
CONNECTION rl_acquirer;
|
||||
--reap
|
||||
SELECT RELEASE_LOCK('B26162');
|
||||
CONNECTION wl_acquirer;
|
||||
--reap
|
||||
CONNECTION rl_contender;
|
||||
--reap
|
||||
|
||||
CONNECTION default;
|
||||
DISCONNECT rl_acquirer;
|
||||
DISCONNECT wl_acquirer;
|
||||
DISCONNECT rl_contender;
|
||||
DISCONNECT rl_holder;
|
||||
|
||||
DROP TRIGGER t1_test;
|
||||
DROP TABLE t1,t2;
|
||||
SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
|
||||
SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue