mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
This commit is contained in:
56
mysql-test/include/connect2.inc
Normal file
56
mysql-test/include/connect2.inc
Normal file
@@ -0,0 +1,56 @@
|
||||
# include/connect2.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Make several attempts to connect.
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# EXAMPLE
|
||||
#
|
||||
# connect.test
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
|
||||
let $wait_counter= 300;
|
||||
if ($wait_timeout)
|
||||
{
|
||||
let $wait_counter= `SELECT $wait_timeout * 10`;
|
||||
}
|
||||
# Reset $wait_timeout so that its value won't be used on subsequent
|
||||
# calls, and default will be used instead.
|
||||
let $wait_timeout= 0;
|
||||
|
||||
--echo # -- Establishing connection '$con_name' (user: $con_user_name)...
|
||||
|
||||
while ($wait_counter)
|
||||
{
|
||||
--disable_abort_on_error
|
||||
--disable_result_log
|
||||
--connect ($con_name,localhost,$con_user_name)
|
||||
--enable_result_log
|
||||
--enable_abort_on_error
|
||||
|
||||
let $error = $mysql_errno;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
let $wait_counter= 0;
|
||||
}
|
||||
if ($error)
|
||||
{
|
||||
real_sleep 0.1;
|
||||
dec $wait_counter;
|
||||
}
|
||||
}
|
||||
if ($error)
|
||||
{
|
||||
--echo # -- Error: can not establish connection '$con_name'.
|
||||
}
|
||||
if (!$error)
|
||||
{
|
||||
--echo # -- Connection '$con_name' has been established.
|
||||
}
|
||||
|
||||
--enable_query_log
|
@@ -115,3 +115,106 @@ create temporary table t2(id integer not null auto_increment primary key);
|
||||
set @id := 1;
|
||||
delete from t1 where id like @id;
|
||||
drop table t1;
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 4.1 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
# -- Bug#33507: Event scheduler creates more threads than max_connections
|
||||
# -- which results in user lockout.
|
||||
|
||||
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
|
||||
|
||||
SET GLOBAL max_connections = 3;
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
|
||||
# -- Waiting for Event Scheduler to start...
|
||||
|
||||
# -- Disconnecting default connection...
|
||||
|
||||
# -- Check that we allow exactly three user connections, no matter how
|
||||
# -- many threads are running.
|
||||
|
||||
# -- Connecting (1)...
|
||||
# -- Establishing connection 'con_1' (user: mysqltest_u1)...
|
||||
# -- Connection 'con_1' has been established.
|
||||
|
||||
# -- Connecting (2)...
|
||||
# -- Establishing connection 'con_2' (user: mysqltest_u1)...
|
||||
# -- Connection 'con_2' has been established.
|
||||
|
||||
# -- Connecting (3)...
|
||||
# -- Establishing connection 'con_3' (user: mysqltest_u1)...
|
||||
# -- Connection 'con_3' has been established.
|
||||
|
||||
# -- Connecting (4) [should fail]...
|
||||
# -- Establishing connection 'con_4' (user: mysqltest_u1)...
|
||||
# -- Error: can not establish connection 'con_4'.
|
||||
|
||||
# -- Check that we allow one extra SUPER-user connection.
|
||||
|
||||
# -- Connecting super (1)...
|
||||
# -- Establishing connection 'con_super_1' (user: root)...
|
||||
# -- Connection 'con_super_1' has been established.
|
||||
|
||||
# -- Connecting super (2) [should fail]...
|
||||
# -- Establishing connection 'con_super_2' (user: root)...
|
||||
# -- Error: can not establish connection 'con_super_2'.
|
||||
|
||||
# -- Ensure that we have Event Scheduler thread, 3 ordinary user
|
||||
# -- connections and one extra super-user connection.
|
||||
SELECT user FROM information_schema.processlist ORDER BY id;
|
||||
user
|
||||
event_scheduler
|
||||
mysqltest_u1
|
||||
mysqltest_u1
|
||||
mysqltest_u1
|
||||
root
|
||||
|
||||
# -- Resetting variables...
|
||||
SET GLOBAL max_connections = 151;
|
||||
|
||||
# -- Stopping Event Scheduler...
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
|
||||
# -- Waiting for Event Scheduler to stop...
|
||||
|
||||
# -- That's it. Closing connections...
|
||||
|
||||
# -- Restoring default connection...
|
||||
|
||||
# -- Waiting for connections to close...
|
||||
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
|
||||
# -- End of Bug#33507.
|
||||
|
||||
# -- Bug#35074: max_used_connections is not correct.
|
||||
|
||||
FLUSH STATUS;
|
||||
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
Max_used_connections 1
|
||||
|
||||
# -- Starting Event Scheduler...
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
# -- Waiting for Event Scheduler to start...
|
||||
|
||||
# -- Opening a new connection to check max_used_connections...
|
||||
|
||||
# -- Check that max_used_connections hasn't changed.
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
Max_used_connections 2
|
||||
|
||||
# -- Closing new connection...
|
||||
|
||||
# -- Stopping Event Scheduler...
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
# -- Waiting for Event Scheduler to stop...
|
||||
|
||||
# -- End of Bug#35074.
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.1 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
@@ -1,3 +1,4 @@
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
drop table if exists t1;
|
||||
create table t1 (kill_id int);
|
||||
@@ -8,3 +9,4 @@ select ((@id := kill_id) - kill_id) from t1;
|
||||
0
|
||||
kill connection @id;
|
||||
drop table t1;
|
||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||
|
@@ -1,3 +1,4 @@
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
drop table if exists t1, t2, t3;
|
||||
create table t1 (kill_id int);
|
||||
@@ -137,3 +138,4 @@ KILL CONNECTION_ID();
|
||||
# of close of the connection socket
|
||||
SELECT 1;
|
||||
Got one of the listed errors
|
||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||
|
@@ -1650,6 +1650,16 @@ a (select count(*) from t2)
|
||||
3 0
|
||||
4 0
|
||||
drop table t1,t2;
|
||||
#
|
||||
# Bug#25132 disabled query cache: Qcache_free_blocks = 1
|
||||
#
|
||||
set global query_cache_size=100000;
|
||||
set global query_cache_size=0;
|
||||
set global query_cache_type=0;
|
||||
show status like 'Qcache_free_blocks';
|
||||
Variable_name Value
|
||||
Qcache_free_blocks 0
|
||||
Restore default values.
|
||||
set GLOBAL query_cache_type=default;
|
||||
set GLOBAL query_cache_limit=default;
|
||||
set GLOBAL query_cache_min_res_unit=default;
|
||||
|
@@ -1,3 +1,5 @@
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
drop table if exists t1,t3;
|
||||
drop procedure if exists bug4902|
|
||||
create procedure bug4902()
|
||||
@@ -17,11 +19,11 @@ begin
|
||||
show processlist;
|
||||
end|
|
||||
call bug4902_2()|
|
||||
Id User Host db Command Time State Info
|
||||
# root localhost test Query # NULL show processlist
|
||||
show warnings|
|
||||
Level Code Message
|
||||
call bug4902_2()|
|
||||
Id User Host db Command Time State Info
|
||||
# root localhost test Query # NULL show processlist
|
||||
show warnings|
|
||||
Level Code Message
|
||||
drop procedure bug4902_2|
|
||||
drop table if exists t1|
|
||||
create table t1 (
|
||||
@@ -68,7 +70,7 @@ c
|
||||
2
|
||||
show status like 'Qcache_hits'|
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
Qcache_hits 0
|
||||
set global query_cache_size = @x|
|
||||
flush status|
|
||||
flush query cache|
|
||||
@@ -208,3 +210,27 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
drop user mysqltest_1@localhost;
|
||||
drop procedure 15298_1;
|
||||
drop procedure 15298_2;
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
create table t1 (value varchar(15));
|
||||
create procedure p1() update t1 set value='updated' where value='old';
|
||||
call p1();
|
||||
insert into t1 (value) values ("old");
|
||||
select get_lock('b26162',120);
|
||||
get_lock('b26162',120)
|
||||
1
|
||||
select 'rl_acquirer', value from t1 where get_lock('b26162',120);;
|
||||
set session low_priority_updates=on;
|
||||
call p1();;
|
||||
select 'rl_contender', value from t1;
|
||||
rl_contender value
|
||||
rl_contender old
|
||||
select release_lock('b26162');
|
||||
release_lock('b26162')
|
||||
1
|
||||
rl_acquirer value
|
||||
rl_acquirer old
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
set session low_priority_updates=default;
|
||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||
|
@@ -140,4 +140,23 @@ select * from t3;
|
||||
c
|
||||
1
|
||||
drop table t1, t2, t3;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=innodb;
|
||||
CREATE TABLE t2(b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=innodb;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW SET @a = 1;
|
||||
CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW SET @b = 1;
|
||||
SET @a = 0;
|
||||
SET @b = 0;
|
||||
TRUNCATE t1;
|
||||
SELECT @a, @b;
|
||||
@a @b
|
||||
0 0
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DELETE FROM t1;
|
||||
SELECT @a, @b;
|
||||
@a @b
|
||||
1 1
|
||||
DROP TABLE t2, t1;
|
||||
End of 5.0 tests
|
||||
|
@@ -102,4 +102,192 @@ disconnect con7;
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
--disconnect con1
|
||||
--disconnect con2
|
||||
--disconnect con3
|
||||
--disconnect con4
|
||||
--disconnect con5
|
||||
--disconnect con6
|
||||
--disconnect con10
|
||||
|
||||
--echo # ------------------------------------------------------------------
|
||||
--echo # -- End of 4.1 tests
|
||||
--echo # ------------------------------------------------------------------
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo # -- Bug#33507: Event scheduler creates more threads than max_connections
|
||||
--echo # -- which results in user lockout.
|
||||
|
||||
--echo
|
||||
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
|
||||
|
||||
# NOTE: if the test case fails sporadically due to spurious connections,
|
||||
# consider disabling all users.
|
||||
|
||||
--echo
|
||||
let $saved_max_connections = `SELECT @@global.max_connections`;
|
||||
SET GLOBAL max_connections = 3;
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
|
||||
--echo
|
||||
--echo # -- Waiting for Event Scheduler to start...
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 1
|
||||
FROM information_schema.processlist
|
||||
WHERE user = 'event_scheduler';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo
|
||||
--echo # -- Disconnecting default connection...
|
||||
--disconnect default
|
||||
|
||||
--echo
|
||||
--echo # -- Check that we allow exactly three user connections, no matter how
|
||||
--echo # -- many threads are running.
|
||||
|
||||
--echo
|
||||
--echo # -- Connecting (1)...
|
||||
let $con_name = con_1;
|
||||
let $con_user_name = mysqltest_u1;
|
||||
--source include/connect2.inc
|
||||
|
||||
--echo
|
||||
--echo # -- Connecting (2)...
|
||||
let $con_name = con_2;
|
||||
let $con_user_name = mysqltest_u1;
|
||||
--source include/connect2.inc
|
||||
|
||||
--echo
|
||||
--echo # -- Connecting (3)...
|
||||
let $con_name = con_3;
|
||||
let $con_user_name = mysqltest_u1;
|
||||
--source include/connect2.inc
|
||||
|
||||
--echo
|
||||
--echo # -- Connecting (4) [should fail]...
|
||||
let $con_name = con_4;
|
||||
let $con_user_name = mysqltest_u1;
|
||||
let $wait_timeout = 5;
|
||||
--source include/connect2.inc
|
||||
|
||||
--echo
|
||||
--echo # -- Check that we allow one extra SUPER-user connection.
|
||||
|
||||
--echo
|
||||
--echo # -- Connecting super (1)...
|
||||
let $con_name = con_super_1;
|
||||
let $con_user_name = root;
|
||||
--source include/connect2.inc
|
||||
|
||||
--echo
|
||||
--echo # -- Connecting super (2) [should fail]...
|
||||
let $con_name = con_super_2;
|
||||
let $con_user_name = root;
|
||||
let $wait_timeout = 5;
|
||||
--source include/connect2.inc
|
||||
|
||||
--echo
|
||||
--echo # -- Ensure that we have Event Scheduler thread, 3 ordinary user
|
||||
--echo # -- connections and one extra super-user connection.
|
||||
SELECT user FROM information_schema.processlist ORDER BY id;
|
||||
|
||||
--echo
|
||||
--echo # -- Resetting variables...
|
||||
--eval SET GLOBAL max_connections = $saved_max_connections
|
||||
|
||||
--echo
|
||||
--echo # -- Stopping Event Scheduler...
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
|
||||
--echo
|
||||
--echo # -- Waiting for Event Scheduler to stop...
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 0
|
||||
FROM information_schema.processlist
|
||||
WHERE user = 'event_scheduler';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo
|
||||
--echo # -- That's it. Closing connections...
|
||||
--disconnect con_1
|
||||
--disconnect con_2
|
||||
--disconnect con_3
|
||||
--disconnect con_super_1
|
||||
|
||||
--echo
|
||||
--echo # -- Restoring default connection...
|
||||
--connect (default,localhost,root,,test)
|
||||
|
||||
--echo
|
||||
--echo # -- Waiting for connections to close...
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 1
|
||||
FROM information_schema.processlist
|
||||
WHERE db = 'test';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
|
||||
--echo
|
||||
--echo # -- End of Bug#33507.
|
||||
--echo
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo # -- Bug#35074: max_used_connections is not correct.
|
||||
--echo
|
||||
|
||||
FLUSH STATUS;
|
||||
|
||||
--echo
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
|
||||
--echo
|
||||
--echo # -- Starting Event Scheduler...
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
|
||||
--echo # -- Waiting for Event Scheduler to start...
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 1
|
||||
FROM information_schema.processlist
|
||||
WHERE user = 'event_scheduler';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
# NOTE: We should use a new connection here instead of reconnect in order to
|
||||
# avoid races (we can not for sure when the connection being disconnected is
|
||||
# actually disconnected on the server).
|
||||
|
||||
--echo
|
||||
--echo # -- Opening a new connection to check max_used_connections...
|
||||
--connect (con_1,localhost,root)
|
||||
|
||||
--echo
|
||||
--echo # -- Check that max_used_connections hasn't changed.
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
|
||||
--echo
|
||||
--echo # -- Closing new connection...
|
||||
--disconnect con_1
|
||||
--connection default
|
||||
|
||||
--echo
|
||||
--echo # -- Stopping Event Scheduler...
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
|
||||
--echo # -- Waiting for Event Scheduler to stop...
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 0
|
||||
FROM information_schema.processlist
|
||||
WHERE user = 'event_scheduler';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo
|
||||
--echo # -- End of Bug#35074.
|
||||
--echo
|
||||
|
||||
--echo # ------------------------------------------------------------------
|
||||
--echo # -- End of 5.1 tests
|
||||
--echo # ------------------------------------------------------------------
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
# Disable concurrent inserts to avoid test failures when reading the
|
||||
# connection id which was inserted into a table by another thread.
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
@@ -58,3 +59,7 @@ reap;
|
||||
|
||||
connection con2;
|
||||
drop table t1;
|
||||
connection default;
|
||||
|
||||
# Restore global concurrent_insert value
|
||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
# Disable concurrent inserts to avoid test failures when reading the
|
||||
# connection id which was inserted into a table by another thread.
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
|
||||
connect (con1, localhost, root,,);
|
||||
@@ -326,3 +327,9 @@ KILL CONNECTION_ID();
|
||||
--echo # of close of the connection socket
|
||||
--error 2013, 2006
|
||||
SELECT 1;
|
||||
--connection default
|
||||
|
||||
###########################################################################
|
||||
|
||||
# Restore global concurrent_insert value. Keep in the end of the test file.
|
||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||
|
@@ -1251,6 +1251,15 @@ disconnect user2;
|
||||
disconnect user3;
|
||||
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug#25132 disabled query cache: Qcache_free_blocks = 1
|
||||
--echo #
|
||||
set global query_cache_size=100000;
|
||||
set global query_cache_size=0;
|
||||
set global query_cache_type=0;
|
||||
show status like 'Qcache_free_blocks';
|
||||
|
||||
--echo Restore default values.
|
||||
# Bug #28211 RENAME DATABASE and query cache don't play nicely together
|
||||
#
|
||||
# TODO: enable these tests when RENAME DATABASE is implemented.
|
||||
|
@@ -1,7 +1,9 @@
|
||||
# Can't test with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
# Disable concurrent inserts to avoid test failures
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
|
||||
--sleep 2
|
||||
--disable_warnings
|
||||
drop table if exists t1,t3;
|
||||
--enable_warnings
|
||||
@@ -39,10 +41,14 @@ create procedure bug4902_2()
|
||||
begin
|
||||
show processlist;
|
||||
end|
|
||||
--replace_column 1 # 6 # 3 localhost
|
||||
--disable_result_log
|
||||
call bug4902_2()|
|
||||
--replace_column 1 # 6 # 3 localhost
|
||||
--enable_result_log
|
||||
show warnings|
|
||||
--disable_result_log
|
||||
call bug4902_2()|
|
||||
--enable_result_log
|
||||
show warnings|
|
||||
drop procedure bug4902_2|
|
||||
|
||||
#
|
||||
@@ -268,69 +274,72 @@ drop procedure 15298_1;
|
||||
drop procedure 15298_2;
|
||||
|
||||
#
|
||||
# Test case disabled due to Bug#34891: sp_notembedded.test fails sporadically.
|
||||
# Bug#29936 Stored Procedure DML ignores low_priority_updates setting
|
||||
#
|
||||
# #
|
||||
# # Bug#29936 Stored Procedure DML ignores low_priority_updates setting
|
||||
# #
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (value varchar(15));
|
||||
create procedure p1() update t1 set value='updated' where value='old';
|
||||
|
||||
# load the procedure into sp cache and execute once
|
||||
call p1();
|
||||
|
||||
insert into t1 (value) values ("old");
|
||||
|
||||
connect (rl_holder, localhost, root,,);
|
||||
connect (rl_acquirer, localhost, root,,);
|
||||
connect (rl_contender, localhost, root,,);
|
||||
connect (rl_wait, localhost, root,,);
|
||||
|
||||
connection rl_holder;
|
||||
select get_lock('b26162',120);
|
||||
|
||||
connection rl_acquirer;
|
||||
--send select 'rl_acquirer', value from t1 where get_lock('b26162',120);
|
||||
|
||||
# we must wait till this select opens and locks the tables
|
||||
connection rl_wait;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "User lock" and
|
||||
info = "select 'rl_acquirer', value from t1 where get_lock('b26162',120)";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
connection default;
|
||||
set session low_priority_updates=on;
|
||||
--send call p1();
|
||||
|
||||
connection rl_wait;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and
|
||||
info = "update t1 set value='updated' where value='old'";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
connection rl_contender;
|
||||
select 'rl_contender', value from t1;
|
||||
|
||||
connection rl_holder;
|
||||
select release_lock('b26162');
|
||||
|
||||
connection rl_acquirer;
|
||||
--reap
|
||||
connection default;
|
||||
--reap
|
||||
|
||||
disconnect rl_holder;
|
||||
disconnect rl_acquirer;
|
||||
disconnect rl_wait;
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
set session low_priority_updates=default;
|
||||
|
||||
#
|
||||
# --disable_warnings
|
||||
# drop table if exists t1;
|
||||
# drop procedure if exists p1;
|
||||
# --enable_warnings
|
||||
# Restore global concurrent_insert value. Keep in the end of the test file.
|
||||
#
|
||||
# create table t1 (value varchar(15));
|
||||
# create procedure p1() update t1 set value='updated' where value='old';
|
||||
#
|
||||
# # load the procedure into sp cache and execute once
|
||||
# call p1();
|
||||
#
|
||||
# insert into t1 (value) values ("old");
|
||||
#
|
||||
# connect (rl_holder, localhost, root,,);
|
||||
# connect (rl_acquirer, localhost, root,,);
|
||||
# connect (rl_contender, localhost, root,,);
|
||||
# connect (rl_wait, localhost, root,,);
|
||||
#
|
||||
# connection rl_holder;
|
||||
# select get_lock('b26162',120);
|
||||
#
|
||||
# connection rl_acquirer;
|
||||
# --send select 'rl_acquirer', value from t1 where get_lock('b26162',120);
|
||||
#
|
||||
# # we must wait till this select opens and locks the tables
|
||||
# connection rl_wait;
|
||||
# let $wait_condition=
|
||||
# select count(*) = 1 from information_schema.processlist
|
||||
# where state = "User lock" and
|
||||
# info = "select 'rl_acquirer', value from t1 where get_lock('b26162',120)";
|
||||
# --source include/wait_condition.inc
|
||||
#
|
||||
# connection default;
|
||||
# set session low_priority_updates=on;
|
||||
# --send call p1();
|
||||
#
|
||||
# connection rl_wait;
|
||||
# let $wait_condition=
|
||||
# select count(*) = 1 from information_schema.processlist
|
||||
# where state = "Locked" and
|
||||
# info = "update t1 set value='updated' where value='old'";
|
||||
# --source include/wait_condition.inc
|
||||
#
|
||||
# connection rl_contender;
|
||||
# select 'rl_contender', value from t1;
|
||||
#
|
||||
# connection rl_holder;
|
||||
# select release_lock('b26162');
|
||||
#
|
||||
# connection rl_acquirer;
|
||||
# --reap
|
||||
# connection default;
|
||||
# --reap
|
||||
#
|
||||
# disconnect rl_holder;
|
||||
# disconnect rl_acquirer;
|
||||
# disconnect rl_wait;
|
||||
# drop procedure p1;
|
||||
# drop table t1;
|
||||
# set session low_priority_updates=default;
|
||||
|
||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||
|
@@ -128,5 +128,37 @@ drop table t1, t2, t3;
|
||||
disconnect connection_update;
|
||||
disconnect connection_aux;
|
||||
|
||||
#
|
||||
# Bug#34643: TRUNCATE crash if trigger and foreign key.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=innodb;
|
||||
CREATE TABLE t2(b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=innodb;
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW SET @a = 1;
|
||||
CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW SET @b = 1;
|
||||
|
||||
SET @a = 0;
|
||||
SET @b = 0;
|
||||
|
||||
TRUNCATE t1;
|
||||
|
||||
SELECT @a, @b;
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
DELETE FROM t1;
|
||||
|
||||
SELECT @a, @b;
|
||||
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user