summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/connect2.inc56
-rw-r--r--mysql-test/r/connect.result103
-rw-r--r--mysql-test/r/create.result41
-rw-r--r--mysql-test/r/drop.result16
-rw-r--r--mysql-test/r/flush_read_lock_kill.result2
-rw-r--r--mysql-test/r/information_schema_db.result6
-rw-r--r--mysql-test/r/kill.result2
-rw-r--r--mysql-test/r/query_cache.result10
-rw-r--r--mysql-test/r/sp-security.result8
-rw-r--r--mysql-test/r/sp_notembedded.result36
-rw-r--r--mysql-test/r/trigger-trans.result19
-rw-r--r--mysql-test/r/trigger_notembedded.result4
-rw-r--r--mysql-test/r/view_grant.result16
-rw-r--r--mysql-test/t/connect.test190
-rw-r--r--mysql-test/t/create.test50
-rw-r--r--mysql-test/t/drop.test34
-rw-r--r--mysql-test/t/flush_read_lock_kill.test5
-rw-r--r--mysql-test/t/kill.test7
-rw-r--r--mysql-test/t/query_cache.test9
-rw-r--r--mysql-test/t/sp_notembedded.test141
-rw-r--r--mysql-test/t/trigger-trans.test32
21 files changed, 697 insertions, 90 deletions
diff --git a/mysql-test/include/connect2.inc b/mysql-test/include/connect2.inc
new file mode 100644
index 00000000000..6b830a909ed
--- /dev/null
+++ b/mysql-test/include/connect2.inc
@@ -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
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index 25cf4f90e6d..727433d3032 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -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
+# ------------------------------------------------------------------
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 81463a3f0f2..85ce830025d 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1847,4 +1847,45 @@ DROP TABLE t3;
# -- End of Bug#18834.
+# --
+# -- Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type.
+# --
+
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0);
+
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` year(4) DEFAULT '2008',
+ `c2` year(4) DEFAULT '0000'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+
+INSERT INTO t1 VALUES();
+
+SELECT * FROM t1;
+c1 c2
+2008 0000
+
+ALTER TABLE t1 MODIFY c1 YEAR DEFAULT 0;
+
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` year(4) DEFAULT '0000',
+ `c2` year(4) DEFAULT '0000'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+
+INSERT INTO t1 VALUES();
+
+SELECT * FROM t1;
+c1 c2
+2008 0000
+0000 0000
+
+DROP TABLE t1;
+
+# -- End of Bug#34274
+
End of 5.1 tests
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 03445c51e38..cd6877b2967 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -91,6 +91,22 @@ create table mysql_test.`#sql-347f_7` (f1 int);
create table mysql_test.`#sql-347f_8` (f1 int);
drop table mysql_test.`#sql-347f_8`;
drop database mysql_test;
+
+# --
+# -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not
+# -- exist.
+# --
+DROP DATABASE IF EXISTS mysql_test;
+CREATE DATABASE mysql_test;
+DROP TABLE mysql.proc;
+DROP DATABASE mysql_test;
+Warnings:
+Error 1146 Table 'mysql.proc' doesn't exist
+
+# --
+# -- End of Bug#29958.
+# --
+
create database mysqltestbug26703;
use mysqltestbug26703;
create table `#mysql50#abc``def` ( id int );
diff --git a/mysql-test/r/flush_read_lock_kill.result b/mysql-test/r/flush_read_lock_kill.result
index f69656806da..0b599f343f7 100644
--- a/mysql-test/r/flush_read_lock_kill.result
+++ b/mysql-test/r/flush_read_lock_kill.result
@@ -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;
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 3044a11fb39..eff5f117c50 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -128,7 +128,7 @@ grant show view on v6 to testdb_2@localhost;
create table t2 (f1 char(4));
create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
Warnings:
-Note 1449 There is no 'no_such_user'@'no_such_host' registered
+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
show fields from testdb_1.v6;
Field Type Null Key Default Extra
f1 char(4) YES NULL
@@ -144,7 +144,7 @@ show fields from testdb_1.v7;
Field Type Null Key Default Extra
f1 char(4) YES NULL
Warnings:
-Note 1449 There is no 'no_such_user'@'no_such_host' registered
+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
@@ -164,7 +164,7 @@ show fields from testdb_1.v7;
Field Type Null Key Default Extra
f1 char(4) YES NULL
Warnings:
-Note 1449 There is no 'no_such_user'@'no_such_host' registered
+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
show create view testdb_1.v7;
View Create View character_set_client collation_connection
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index a522d18f36b..8b6830d4798 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -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;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 1a728354c7b..ea42b6616a1 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -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;
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 1a1645ca971..cf26f0076d7 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -357,10 +357,10 @@ ERROR 42000: Access denied; you need the SUPER privilege for this operation
use mysqltest;
CREATE DEFINER='a @ b @ c'@localhost PROCEDURE wl2897_p3() SELECT 3;
Warnings:
-Note 1449 There is no 'a @ b @ c'@'localhost' registered
+Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist
CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
Warnings:
-Note 1449 There is no 'a @ b @ c'@'localhost' registered
+Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist
---> connection: con1root
use mysqltest;
@@ -420,9 +420,9 @@ DROP USER mysqltest_1@localhost;
---> connection: mysqltest_2_con
use mysqltest;
CALL bug13198_p1();
-ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
+ERROR HY000: The user specified as a definer ('mysqltest_1'@'localhost') does not exist
SELECT bug13198_f1();
-ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
+ERROR HY000: The user specified as a definer ('mysqltest_1'@'localhost') does not exist
---> connection: root
DROP USER mysqltest_2@localhost;
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index 0b1fa565d28..3efb01fdb94 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -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;
diff --git a/mysql-test/r/trigger-trans.result b/mysql-test/r/trigger-trans.result
index cd5f629564f..dccaa27c5fd 100644
--- a/mysql-test/r/trigger-trans.result
+++ b/mysql-test/r/trigger-trans.result
@@ -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
diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result
index 87e8f68da38..1e13bff03b1 100644
--- a/mysql-test/r/trigger_notembedded.result
+++ b/mysql-test/r/trigger_notembedded.result
@@ -133,9 +133,9 @@ CREATE DEFINER='mysqltest_nonexs'@'localhost'
FOR EACH ROW
SET @new_sum = 0;
Warnings:
-Note 1449 There is no 'mysqltest_nonexs'@'localhost' registered
+Note 1449 The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist
INSERT INTO t1 VALUES(6);
-ERROR HY000: There is no 'mysqltest_nonexs'@'localhost' registered
+ERROR HY000: The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 133fb5600bf..3585635d0f9 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -515,10 +515,10 @@ drop user mysqltest_1@localhost;
drop database mysqltest;
create definer=some_user@`` sql security invoker view v1 as select 1;
Warnings:
-Note 1449 There is no 'some_user'@'' registered
+Note 1449 The user specified as a definer ('some_user'@'') does not exist
create definer=some_user@localhost sql security invoker view v2 as select 1;
Warnings:
-Note 1449 There is no 'some_user'@'localhost' registered
+Note 1449 The user specified as a definer ('some_user'@'localhost') does not exist
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci
@@ -601,14 +601,14 @@ CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
Warnings:
-Note 1449 There is no 'no-such-user'@'localhost' registered
+Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist
SHOW CREATE VIEW v;
View Create View character_set_client collation_connection
v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
Warnings:
Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
SELECT * FROM v;
-ERROR HY000: There is no 'no-such-user'@'localhost' registered
+ERROR HY000: The user specified as a definer ('no-such-user'@'localhost') does not exist
DROP VIEW v;
DROP TABLE t1;
USE test;
@@ -722,7 +722,7 @@ SELECT * FROM v1;
ERROR 42000: SELECT command denied to user 'inv_17254'@'localhost' for table 'v1'
for a superuser
SELECT * FROM v1;
-ERROR HY000: There is no 'def_17254'@'localhost' registered
+ERROR HY000: The user specified as a definer ('def_17254'@'localhost') does not exist
DROP USER inv_17254@localhost;
DROP DATABASE db17254;
DROP DATABASE IF EXISTS mysqltest_db1;
@@ -932,7 +932,7 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1;
Warnings:
-Note 1449 There is no 'no_such'@'user_1' registered
+Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
@@ -940,7 +940,7 @@ Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
Warnings:
-Note 1449 There is no 'no_such'@'user_1' registered
+Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
@@ -948,7 +948,7 @@ Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
Warnings:
-Note 1449 There is no 'no_such'@'user_2' registered
+Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index 2e66c24d877..0893bf9ad18 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -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 # ------------------------------------------------------------------
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 28ae38d943a..9cf38742289 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1365,6 +1365,8 @@ create table t1 like information_schema.character_sets;
show create table t1;
drop table t1;
+###########################################################################
+
--echo
--echo # --
--echo # -- Bug#21380: DEFAULT definition not always transfered by CREATE
@@ -1407,8 +1409,10 @@ DROP TABLE t2;
--echo
--echo # -- End of test case for Bug#21380.
---echo
+###########################################################################
+
+--echo
--echo # --
--echo # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
--echo # --
@@ -1471,6 +1475,50 @@ DROP TABLE t3;
--echo
--echo # -- End of Bug#18834.
+
+###########################################################################
+
+--echo
+--echo # --
+--echo # -- Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type.
+--echo # --
+--echo
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo
+CREATE TABLE t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0);
+
+--echo
+SHOW CREATE TABLE t1;
+
+--echo
+INSERT INTO t1 VALUES();
+
+--echo
+SELECT * FROM t1;
+
+--echo
+ALTER TABLE t1 MODIFY c1 YEAR DEFAULT 0;
+
+--echo
+SHOW CREATE TABLE t1;
+
--echo
+INSERT INTO t1 VALUES();
+--echo
+SELECT * FROM t1;
+
+--echo
+DROP TABLE t1;
+
+--echo
+--echo # -- End of Bug#34274
+
+###########################################################################
+
+--echo
--echo End of 5.1 tests
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index ad26287a666..2c490b51afc 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -134,6 +134,40 @@ drop table mysql_test.`#sql-347f_8`;
copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm;
drop database mysql_test;
+###########################################################################
+
+--echo
+--echo # --
+--echo # -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not
+--echo # -- exist.
+--echo # --
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysql_test;
+--enable_warnings
+
+CREATE DATABASE mysql_test;
+
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI
+
+DROP TABLE mysql.proc;
+
+DROP DATABASE mysql_test;
+
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI
+
+--echo
+--echo # --
+--echo # -- End of Bug#29958.
+--echo # --
+
+###########################################################################
+
+--echo
#
# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks
#
diff --git a/mysql-test/t/flush_read_lock_kill.test b/mysql-test/t/flush_read_lock_kill.test
index c3926d09205..c03f3be2534 100644
--- a/mysql-test/t/flush_read_lock_kill.test
+++ b/mysql-test/t/flush_read_lock_kill.test
@@ -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;
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index b7e1e82fe5d..8ef668f542b 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -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;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 771a32e8cd7..83fe1ab7d6e 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -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.
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 4e298b2076a..16ebb710f25 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -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');
+
+--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;
+
#
-# connection rl_acquirer;
-# --reap
-# connection default;
-# --reap
+# Restore global concurrent_insert value. Keep in the end of the test file.
#
-# 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;
diff --git a/mysql-test/t/trigger-trans.test b/mysql-test/t/trigger-trans.test
index 8103a1ba0b1..5db5b982773 100644
--- a/mysql-test/t/trigger-trans.test
+++ b/mysql-test/t/trigger-trans.test
@@ -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