diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2016-03-25 20:51:22 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2016-03-31 10:11:16 +0400 |
commit | 282497dd6d1049b4fb963641504c2733752845a7 (patch) | |
tree | 7288d17c29fbbe9ac47ec51f6988fb954f59a361 /mysql-test/t/sp-lock.test | |
parent | 5052e2479e873461bebfcedbc674bbaf57d3c968 (diff) | |
download | mariadb-git-282497dd6d1049b4fb963641504c2733752845a7.tar.gz |
MDEV-6720 - enable connection log in mysqltest by default
Diffstat (limited to 'mysql-test/t/sp-lock.test')
-rw-r--r-- | mysql-test/t/sp-lock.test | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/mysql-test/t/sp-lock.test b/mysql-test/t/sp-lock.test index a01c9e19908..83ea07d4bda 100644 --- a/mysql-test/t/sp-lock.test +++ b/mysql-test/t/sp-lock.test @@ -142,7 +142,6 @@ drop temporary table t1; --echo # connection, try to use the routine. --echo # That should block on the pending exclusive lock. --echo # ---echo # Establish helper connections. connect(con1, localhost, root,,); connect(con2, localhost, root,,); connect(con3, localhost, root,,); @@ -150,7 +149,6 @@ connect(con3, localhost, root,,); --echo # --echo # Test DROP PROCEDURE. --echo # ---echo # --> connection default connection default; create procedure p1() begin end; delimiter |; @@ -162,11 +160,9 @@ end| delimiter ;| begin; select f1(); ---echo # --> connection con1 connection con1; --echo # Sending 'drop procedure p1'... send drop procedure p1; ---echo # --> connection con2 connection con2; --echo # Waiting for 'drop procedure t1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -176,24 +172,19 @@ info='drop procedure p1'; --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); ---echo # --> connection con3 connection con3; --echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored procedure metadata lock' and info='select f1()'; ---echo # --> connection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'drop procedure p1'... reap; ---echo # --> connection con2 connection con2; --echo # Reaping 'select f1()' --error ER_SP_DOES_NOT_EXIST reap; ---echo # --> connection default connection default; --echo # @@ -202,11 +193,9 @@ connection default; create procedure p1() begin end; begin; select f1(); ---echo # --> connection con1 connection con1; --echo # Sending 'create procedure p1'... send create procedure p1() begin end; ---echo # --> connection con2 connection con2; --echo # Waiting for 'create procedure t1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -216,20 +205,16 @@ info='create procedure p1() begin end'; --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); ---echo # --> connection con3 connection con3; --echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored procedure metadata lock' and info='select f1()'; ---echo # --> connection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'create procedure p1'... --error ER_SP_ALREADY_EXISTS reap; ---echo # --> connection con2 connection con2; --echo # Reaping 'select f1()' reap; @@ -240,11 +225,9 @@ connection default; --echo # begin; select f1(); ---echo # --> connection con1 connection con1; --echo # Sending 'alter procedure p1'... send alter procedure p1 contains sql; ---echo # --> connection con2 connection con2; --echo # Waiting for 'alter procedure t1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -254,23 +237,18 @@ info='alter procedure p1 contains sql'; --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); ---echo # --> connection con3 connection con3; --echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored procedure metadata lock' and info='select f1()'; ---echo # --> connection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'alter procedure p1'... reap; ---echo # --> connection con2 connection con2; --echo # Reaping 'select f1()' reap; ---echo # --> connection default connection default; --echo # @@ -278,11 +256,9 @@ connection default; --echo # begin; select f1(); ---echo # --> connection con1 connection con1; --echo # Sending 'drop function f1'... send drop function f1; ---echo # --> connection con2 connection con2; --echo # Waiting for 'drop function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -292,24 +268,19 @@ info='drop function f1'; --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); ---echo # --> connection con3 connection con3; --echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored function metadata lock' and info='select f1()'; ---echo # --> connection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'drop function f1'... reap; ---echo # --> connection con2 connection con2; --echo # Reaping 'select f1()' --error ER_SP_DOES_NOT_EXIST reap; ---echo # --> connection default connection default; --echo # @@ -318,11 +289,9 @@ connection default; create function f1() returns int return 1; begin; select f1(); ---echo # --> connection con1 connection con1; --echo # Sending 'create function f1'... send create function f1() returns int return 2; ---echo # --> connection con2 connection con2; --echo # Waiting for 'create function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -332,24 +301,19 @@ info='create function f1() returns int return 2'; --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); ---echo # --> connection con3 connection con3; --echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored function metadata lock' and info='select f1()'; ---echo # --> connection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'create function f1'... --error ER_SP_ALREADY_EXISTS reap; ---echo # --> connection con2 connection con2; --echo # Reaping 'select f1()' reap; ---echo # --> connection default connection default; --echo # @@ -357,11 +321,9 @@ connection default; --echo # begin; select f1(); ---echo # --> connection con1 connection con1; --echo # Sending 'alter function f1'... send alter function f1 contains sql; ---echo # --> connection con2 connection con2; --echo # Waiting for 'alter function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -371,23 +333,18 @@ info='alter function f1 contains sql'; --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); ---echo # --> connection con3 connection con3; --echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored function metadata lock' and info='select f1()'; ---echo # --> connection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'alter function f1'... reap; ---echo # --> connection con2 connection con2; --echo # Reaping 'select f1()' reap; ---echo # --> connection default connection default; drop function f1; drop procedure p1; @@ -427,13 +384,11 @@ call p4(); prepare stmt from "call p4()"; execute stmt; execute stmt; ---echo # --> connection con1 connection con1; drop procedure p1; drop procedure p2; drop procedure p3; drop procedure p4; ---echo # --> connection default connection default; --echo # This is to verify there was no implicit commit. rollback to savepoint sv; @@ -456,25 +411,20 @@ create trigger t1_ai after insert on t1 for each row insert into t2 (a, b) values (new.a, f1()); begin; insert into t1 (a) values (1); ---echo # --> connection con1 connection con1; --echo # Sending 'drop function f1' send drop function f1; ---echo # --> connection con2 connection con2; --echo # Waiting for 'drop function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored function metadata lock' and info='drop function f1'; --source include/wait_condition.inc ---echo # --> connnection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'drop function f1'... reap; ---echo # --> connection default connection default; --echo # --echo # A function is used from a view. @@ -483,25 +433,20 @@ create function f1() returns int return 1; create view v1 as select f1() as a; begin; select * from v1; ---echo # --> connection con1 connection con1; --echo # Sending 'drop function f1' send drop function f1; ---echo # --> connection con2 connection con2; --echo # Waiting for 'drop function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored function metadata lock' and info='drop function f1'; --source include/wait_condition.inc ---echo # --> connnection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'drop function f1'... reap; ---echo # --> connection default connection default; --echo # --echo # A procedure is used from a function. @@ -517,25 +462,20 @@ delimiter ;| create procedure p1(out v_out int) set v_out=3; begin; select * from v1; ---echo # --> connection con1 connection con1; --echo # Sending 'drop procedure p1' send drop procedure p1; ---echo # --> connection con2 connection con2; --echo # Waiting for 'drop procedure p1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored procedure metadata lock' and info='drop procedure p1'; --source include/wait_condition.inc ---echo # --> connnection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'drop procedure p1'... reap; ---echo # --> connection default connection default; --echo # @@ -549,25 +489,20 @@ create trigger t1_ai after insert on t1 for each row insert into t2 (a, b) values (new.a, (select max(a) from v1)); begin; insert into t1 (a) values (3); ---echo # --> connection con1 connection con1; --echo # Sending 'drop function f2' send drop function f2; ---echo # --> connection con2 connection con2; --echo # Waiting for 'drop function f2' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for stored function metadata lock' and info='drop function f2'; --source include/wait_condition.inc ---echo # --> connnection default connection default; commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'drop function f2'... reap; ---echo # --> connection default connection default; drop view v1; @@ -612,11 +547,9 @@ lock table v1 read; select * from v1; savepoint sv; select f2(); ---echo # --> connection con1 connection con1; --echo # Sending 'drop function f1'... send drop function f1; ---echo # --> connection con2 connection con2; --echo # Waiting for 'drop function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -625,7 +558,6 @@ info='drop function f1'; --source include/wait_condition.inc --echo # Sending 'drop function f2'... send drop function f2; ---echo # --> connection default connection default; --echo # Waiting for 'drop function f2' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -633,18 +565,14 @@ where state='Waiting for stored function metadata lock' and info='drop function f2'; --source include/wait_condition.inc rollback to savepoint sv; ---echo # --> connection con2 connection con2; --echo # Reaping 'drop function f2'... reap; ---echo # --> connection default connection default; unlock tables; ---echo # --> connection con1 connection con1; --echo # Reaping 'drop function f1'... reap; ---echo # --> connection default connection default; --error ER_SP_DOES_NOT_EXIST drop function f1; @@ -683,18 +611,14 @@ begin execute stmt; end| delimiter ;| ---echo # --> connection con2 connection con2; prepare stmt from "select f2()"; ---echo # --> connection default connection default; begin; select f1(); ---echo # --> connection con1 connection con1; --echo # Sending 'alter function f1 ...'... send alter function f1 comment "comment"; ---echo # --> connection con2 connection con2; --echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -711,16 +635,13 @@ info='select f1() into @var'; --source include/wait_condition.inc --echo # Let 'alter function f1 ...' go through... commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'alter function f1 ...' reap; ---echo # --> connection con2 connection con2; --echo # Reaping 'call p1()'... reap; deallocate prepare stmt; ---echo # --> connection default connection default; drop function f1; drop function f2; @@ -739,11 +660,9 @@ drop procedure p1; create function f1() returns int return 1; begin; select f1(); ---echo # --> connection con1 connection con1; --echo # Sending 'alter function f1 ...'... send alter function f1 comment "comment"; ---echo # --> connection con2 connection con2; --echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -781,15 +700,12 @@ info='select f1() into @var'; --source include/wait_condition.inc --echo # Let 'alter function f1 ...' go through... commit; ---echo # --> connection con1 connection con1; --echo # Reaping 'alter function f1 ...' reap; ---echo # --> connection con2 connection con2; --echo # Reaping 'call p1()'... reap; ---echo # --> connection default connection default; drop function f1; drop function f2; @@ -817,14 +733,11 @@ begin return res; end| delimiter ;| ---echo # --> connection con1 connection con1; select get_lock("30977", 0); ---echo # --> connection default connection default; --echo # Sending 'select f3()'... send select f3(); ---echo # --> connection con1 connection con1; --echo # Waiting for 'select f3()' to get blocked on the user level lock... let $wait_condition=select count(*)=1 from information_schema.processlist @@ -834,7 +747,6 @@ where state='User lock' and info='select f1() into @var'; create function f4() returns int return 4; drop function f4; select release_lock("30977"); ---echo # --> connection default connection default; --echo # Reaping 'select f3()'... --echo # Routine 'f2()' should exist and get executed successfully. @@ -880,19 +792,15 @@ drop procedure p1; drop function f1; set @@session.max_sp_recursion_depth=default; ---echo # --> connection con1 connection con1; disconnect con1; --source include/wait_until_disconnected.inc ---echo # --> connection con2 connection con2; disconnect con2; --source include/wait_until_disconnected.inc ---echo # --> connection con3 connection con3; disconnect con3; --source include/wait_until_disconnected.inc ---echo # --> connection default connection default; @@ -914,17 +822,14 @@ delimiter ;| connect (con2, localhost, root); connect (con3, localhost, root); ---echo # Connection default connection default; SELECT get_lock("test", 10); ---echo # Connection 2 connection con2; --echo # Will halt before executing SHOW CREATE PROCEDURE p1 --echo # Sending: --send CALL p1() ---echo # Connection 3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE state='User lock' and info='SELECT get_lock("test", 10)'; @@ -933,25 +838,20 @@ let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist DROP PROCEDURE p1; CREATE PROCEDURE p1() BEGIN END; ---echo # Connection default connection default; --echo # Resume CALL p1, now with new p1 SELECT release_lock("test"); ---echo # Connection 2 connection con2; --echo # Reaping: CALL p1() --reap ---echo # Connection 3 connection con3; disconnect con3; --source include/wait_until_disconnected.inc ---echo # Connection 2 connection con2; disconnect con2; --source include/wait_until_disconnected.inc ---echo # Connection default; connection default; DROP PROCEDURE p1; @@ -972,19 +872,16 @@ connect(con2, localhost, root); --echo # Test 1: Check that DROP DATABASE block if a function is used --echo # by an active transaction. ---echo # Connection default connection default; CREATE DATABASE db1; CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1; START TRANSACTION; SELECT db1.f1(); ---echo # Connection con1 connection con1; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection default connection default; --echo # Waiting for DROP DATABASE to be blocked by the lock on f1() let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist @@ -993,7 +890,6 @@ let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist --source include/wait_condition.inc COMMIT; ---echo # Connection con1 connection con1; --echo # Reaping: DROP DATABASE db1 --reap @@ -1001,7 +897,6 @@ connection con1; --echo # Test 2: Check that DROP DATABASE blocks if a procedure is --echo # used by an active transaction. ---echo # Connection default connection default; CREATE DATABASE db1; CREATE PROCEDURE db1.p1() BEGIN END; @@ -1015,12 +910,10 @@ delimiter ;| START TRANSACTION; SELECT f1(); ---echo # Connection con1 connection con1; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection default connection default; --echo # Waiting for DROP DATABASE to be blocked by the lock on p1() let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist @@ -1029,7 +922,6 @@ let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist --source include/wait_condition.inc COMMIT; ---echo # Connection con1 connection con1; --echo # Reaping: DROP DATABASE db1 --reap @@ -1037,7 +929,6 @@ connection con1; --echo # Test 3: Check that DROP DATABASE is not selected as a victim if a --echo # deadlock is discovered with DML statements. ---echo # Connection default connection default; CREATE DATABASE db1; CREATE TABLE db1.t1 (a INT); @@ -1046,12 +937,10 @@ START TRANSACTION; # DROP DATABASE will lock tables (t1) before functions (f1) SELECT db1.f1(); ---echo # Connection con1 connection con1; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection default connection default; --echo # Waiting for DROP DATABASE to be blocked by the lock on f1() let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist @@ -1062,14 +951,12 @@ let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist SELECT * FROM db1.t1; COMMIT; ---echo # Connection con1 connection con1; --echo # Reaping: DROP DATABASE db1 --reap --echo # Test 4: Check that active DROP DATABASE blocks stored routine DDL. ---echo # Connection default connection default; CREATE DATABASE db1; CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1; @@ -1077,12 +964,10 @@ CREATE FUNCTION db1.f2() RETURNS INTEGER RETURN 2; START TRANSACTION; SELECT db1.f2(); ---echo # Connection con1 connection con1; --echo # Sending: --send DROP DATABASE db1 ---echo # Connection con2 connection con2; --echo # Waiting for DROP DATABASE to be blocked by the lock on f2() let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist @@ -1092,7 +977,6 @@ let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist --echo # Sending: --send ALTER FUNCTION db1.f1 COMMENT "test" ---echo # Connection default connection default; --echo # Waiting for ALTER FUNCTION to be blocked by the schema lock on db1 let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist @@ -1101,14 +985,12 @@ let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist --source include/wait_condition.inc COMMIT; ---echo # Connection con1 connection con1; --echo # Reaping: DROP DATABASE db1 --reap disconnect con1; --source include/wait_until_disconnected.inc ---echo # Connection con2 connection con2; --echo # Reaping: ALTER FUNCTION f1 COMMENT 'test' --error ER_SP_DOES_NOT_EXIST @@ -1116,7 +998,6 @@ connection con2; disconnect con2; --source include/wait_until_disconnected.inc ---echo # Connection default connection default; DROP FUNCTION f1; |