Merge 5.0 -> 5.1 of fix for Bug#42003 and Bug#43114

This commit is contained in:
Matthias Leich 2009-03-06 15:56:17 +01:00
commit e7004ec5ef
41 changed files with 1401 additions and 986 deletions

View File

@ -2,11 +2,20 @@
# #
# SUMMARY # SUMMARY
# #
# Waits until the passed number ($count_sessions) of concurrent sessions was # Waits until the passed number ($count_sessions) of concurrent sessions or
# observed via # a smaller number was observed via
# SHOW STATUS LIKE 'Threads_connected' # SHOW STATUS LIKE 'Threads_connected'
# or the operation times out. # or the operation times out.
# Note: Starting with 5.1 we could also use # Note:
# 1. We wait for $current_sessions <= $count_sessions because in the use case
# with count_sessions.inc before and wait_until_count_sessions.inc after
# the core of the test it could happen that the disconnects of sessions
# belonging to the preceeding test are not finished.
# sessions at test begin($count_sessions) = m + n
# sessions of the previous test which will be soon disconnected = n (n >= 0)
# sessions at test end ($current sessions, assuming the test disconnects
# all additional sessions) = m
# 2. Starting with 5.1 we could also use
# SELECT COUNT(*) FROM information_schema.processlist # SELECT COUNT(*) FROM information_schema.processlist
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this # I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
# runs in all versions 5.0+ # runs in all versions 5.0+
@ -19,7 +28,7 @@
# #
# OR typical example of a test which uses more than one session # OR typical example of a test which uses more than one session
# Such a test could harm successing tests if there is no server shutdown # Such a test could harm successing tests if there is no server shutdown
# and start between.cw # and start between.
# #
# If the testing box is slow than the disconnect of sessions belonging to # If the testing box is slow than the disconnect of sessions belonging to
# the current test might happen when the successing test gets executed. # the current test might happen when the successing test gets executed.
@ -79,7 +88,11 @@
# backup.test, grant3.test # backup.test, grant3.test
# #
# #
# Created: 2009-01-14 mleich # Created:
# 2009-01-14 mleich
# Modified:
# 2009-02-24 mleich Fix Bug#43114 wait_until_count_sessions too restrictive,
# random PB failures
# #
let $wait_counter= 100; let $wait_counter= 100;
@ -93,7 +106,7 @@ let $wait_timeout= 0;
while ($wait_counter) while ($wait_counter)
{ {
let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
let $success= `SELECT $current_sessions = $count_sessions`; let $success= `SELECT $current_sessions <= $count_sessions`;
if ($success) if ($success)
{ {
let $wait_counter= 0; let $wait_counter= 0;
@ -107,7 +120,7 @@ while ($wait_counter)
if (!$success) if (!$success)
{ {
--echo # Timeout in wait_until_count_sessions.inc --echo # Timeout in wait_until_count_sessions.inc
--echo # Number of sessions expected: $count_sessions found: $current_sessions --echo # Number of sessions expected: <= $count_sessions found: $current_sessions
SHOW PROCESSLIST; SHOW PROCESSLIST;
} }

View File

@ -1,15 +1,23 @@
drop table if exists t1; DROP TABLE IF EXISTS t1;
create table t1 (a int) engine=innodb; # Establish connection con1 (user=root)
start transaction with consistent snapshot; # Establish connection con2 (user=root)
insert into t1 values(1); # Switch to connection con1
select * from t1; CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
# Switch to connection con2
INSERT INTO t1 VALUES(1);
# Switch to connection con1
SELECT * FROM t1;
a a
commit; COMMIT;
delete from t1; DELETE FROM t1;
start transaction; START TRANSACTION;
insert into t1 values(1); # Switch to connection con2
select * from t1; INSERT INTO t1 VALUES(1);
# Switch to connection con1
SELECT * FROM t1;
a a
1 1
commit; COMMIT;
drop table t1; # Switch to connection default + close connections con1 and con2
DROP TABLE t1;

View File

@ -1,9 +1,9 @@
drop table if exists t1; DROP TABLE IF EXISTS t1;
create table t1 (n int); CREATE TABLE t1 (n INT);
insert into t1 values (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
select * from t1; SELECT * FROM t1;
n n
1 1
2 2
3 3
drop table t1; DROP TABLE t1;

View File

@ -1,39 +1,57 @@
drop table if exists t1; # Establish connection con1 (user=root)
create table t1 (a int) engine=innodb; # Establish connection con2 (user=root)
begin; # Establish connection con3 (user=root)
insert into t1 values(1); # Switch to connection con1
flush tables with read lock; DROP TABLE IF EXISTS t1;
select * from t1; CREATE TABLE t1 (a INT) ENGINE=innodb;
BEGIN;
INSERT INTO t1 VALUES(1);
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
SELECT * FROM t1;
a a
commit; # Switch to connection con1
select * from t1; COMMIT;
# Switch to connection con2
SELECT * FROM t1;
a a
unlock tables; UNLOCK TABLES;
begin; # Switch to connection con1
select * from t1 for update; # Switch to connection con1
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a a
1 1
begin; # Switch to connection con2
select * from t1 for update; BEGIN;
flush tables with read lock; SELECT * FROM t1 FOR UPDATE;
commit; # Switch to connection con3
FLUSH TABLES WITH READ LOCK;
# Switch to connection con1
COMMIT;
# Switch to connection con2
a a
1 1
unlock tables; # Switch to connection con3
commit; UNLOCK TABLES;
begin; # Switch to connection con2
insert into t1 values(10); COMMIT;
flush tables with read lock; # Switch to connection con1
commit; BEGIN;
unlock tables; INSERT INTO t1 VALUES(10);
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
unlock tables; COMMIT;
begin; UNLOCK TABLES;
select * from t1; # Switch to connection con2
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
BEGIN;
SELECT * FROM t1;
a a
1 1
10 10
show create database test; SHOW CREATE DATABASE test;
Database Create Database Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table t1; DROP TABLE t1;
# Switch to connection default and close connections con1, con2, con3

View File

@ -1,15 +1,23 @@
create table t1 (a int) engine=innodb; # Establish connection con1 (user=root)
reset master; # Establish connection con2 (user=root)
set autocommit=0; # Switch to connection con1
insert t1 values (1); CREATE TABLE t1 (a INT) ENGINE=innodb;
flush tables with read lock; RESET MASTER;
show master status; SET AUTOCOMMIT=0;
INSERT t1 VALUES (1);
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106 master-bin.000001 106
commit; # Switch to connection con1
show master status; COMMIT;
# Switch to connection con2
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106 master-bin.000001 106
unlock tables; UNLOCK TABLES;
drop table t1; # Switch to connection con1
set autocommit=1; DROP TABLE t1;
SET AUTOCOMMIT=1;
# Switch to connection default and close connections con1 and con2

View File

@ -1,12 +1,12 @@
set @old_concurrent_insert= @@global.concurrent_insert; SET @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0; SET @@global.concurrent_insert= 0;
drop table if exists t1; DROP TABLE IF EXISTS t1;
create table t1 (kill_id int); CREATE TABLE t1 (kill_id INT);
insert into t1 values(connection_id()); INSERT INTO t1 VALUES(connection_id());
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
select ((@id := kill_id) - kill_id) from t1; SELECT ((@id := kill_id) - kill_id) FROM t1;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0
kill connection @id; KILL CONNECTION @id;
drop table t1; DROP TABLE t1;
set @@global.concurrent_insert= @old_concurrent_insert; SET @@global.concurrent_insert= @old_concurrent_insert;

View File

@ -51,10 +51,10 @@ Field Type Null Key Default Extra
a int(11) YES NULL a int(11) YES NULL
unlock tables; unlock tables;
drop table t1; drop table t1;
use mysql; USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE; LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES; FLUSH TABLES;
use mysql; USE mysql;
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
OPTIMIZE TABLES columns_priv, db, host, user; OPTIMIZE TABLES columns_priv, db, host, user;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
@ -65,7 +65,7 @@ mysql.user optimize status OK
UNLOCK TABLES; UNLOCK TABLES;
Select_priv Select_priv
N N
use test; USE test;
use test; use test;
CREATE TABLE t1 (c1 int); CREATE TABLE t1 (c1 int);
LOCK TABLE t1 WRITE; LOCK TABLE t1 WRITE;
@ -133,8 +133,8 @@ DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
create table t1 (i int); create table t1 (i int);
lock table t1 read; lock table t1 read;
update t1 set i= 10;; update t1 set i= 10;
select * from t1;; select * from t1;
kill query ID; kill query ID;
i i
ERROR 70100: Query execution was interrupted ERROR 70100: Query execution was interrupted

View File

@ -391,9 +391,9 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
CREATE TABLE t1 (c1 CHAR(10)); CREATE TABLE t1 (c1 CHAR(10));
flush logs; FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789'); INSERT INTO t1 VALUES ('0123456789');
flush logs; FLUSH LOGS;
DROP TABLE t1; DROP TABLE t1;
We expect this value to be 1 We expect this value to be 1
The bug being tested was that 'Query' lines were not preceded by '#' The bug being tested was that 'Query' lines were not preceded by '#'
@ -403,16 +403,16 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
BUG#28293_expect_1 BUG#28293_expect_1
1 1
DROP TABLE patch; DROP TABLE patch;
flush logs; FLUSH LOGS;
create table t1(a int); CREATE TABLE t1(a INT);
insert into t1 values(connection_id()); INSERT INTO t1 VALUES(connection_id());
flush logs; FLUSH LOGS;
drop table t1; DROP TABLE t1;
1 1
drop table t1; DROP TABLE t1;
shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
flush logs; FLUSH LOGS;
BUG#31611: Security risk with BINLOG statement Bug#31611 Security risk with BINLOG statement
SET BINLOG_FORMAT=ROW; SET BINLOG_FORMAT=ROW;
CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest1;
CREATE USER untrusted@localhost; CREATE USER untrusted@localhost;
@ -435,7 +435,7 @@ a b
1 root@localhost 1 root@localhost
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
DROP USER untrusted@localhost; DROP USER untrusted@localhost;
BUG#32580: mysqlbinlog cannot read binlog event with user variables Bug#32580 mysqlbinlog cannot read binlog event with user variables
USE test; USE test;
SET BINLOG_FORMAT = STATEMENT; SET BINLOG_FORMAT = STATEMENT;
FLUSH LOGS; FLUSH LOGS;
@ -460,15 +460,15 @@ an_int 1000
a_decimal 907.79 a_decimal 907.79
a_string Just a test a_string Just a test
DROP TABLE t1; DROP TABLE t1;
set @@global.server_id= 4294967295; SET @@global.server_id= 4294967295;
reset master; RESET MASTER;
flush logs; FLUSH LOGS;
select SELECT
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) (@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null; IS NOT NULL;
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) (@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null IS NOT NULL
1 1
*** Unsigned server_id 4294967295 is found: 1 *** *** Unsigned server_id 4294967295 is found: 1 ***
set @@global.server_id= 1; SET @@global.server_id= 1;
End of 5.1 tests End of 5.1 tests

View File

@ -743,10 +743,12 @@ select 1;
-- a comment for the server; -- a comment for the server;
mysqltest: At line 1: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment mysqltest: At line 1: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
con1 con1
con2
default default
con1 con1
default con2
con1
con1 con1
con2
con2
-closed_connection- -closed_connection-
End of tests End of tests

View File

@ -664,7 +664,7 @@ show create table t1;
ERROR HY000: Incorrect information in file: './test/t1.frm' ERROR HY000: Incorrect information in file: './test/t1.frm'
drop table if exists t1; drop table if exists t1;
# Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar. # Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar.
DROP DATABASE IF EXISTS mysqltest1; DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest1;

View File

@ -5,10 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255' GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255'; REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255'; DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
select user(); SELECT USER();
user() USER()
# #
show processlist; SHOW PROCESSLIST;
Id User Host db Command Time State Info Id User Host db Command Time State Info
<id> root <host> test <command> <time> <state> <info> <id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info> <id> root <host> test <command> <time> <state> <info>

View File

@ -342,12 +342,12 @@ GRANT SUPER ON *.* TO mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost; GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_2_con ---> connection: mysqltest_2_con
use mysqltest; USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1; CREATE PROCEDURE wl2897_p1() SELECT 1;
CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1; CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
---> connection: mysqltest_1_con ---> connection: mysqltest_1_con
use mysqltest; USE mysqltest;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2; CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
ERROR 42000: Access denied; you need the SUPER privilege for this operation ERROR 42000: Access denied; you need the SUPER privilege for this operation
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2; CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
@ -363,7 +363,7 @@ Warnings:
Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist
---> connection: con1root ---> connection: con1root
use mysqltest; USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1; SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`() wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
@ -393,7 +393,7 @@ CREATE USER mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost; GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_1_con ---> connection: mysqltest_1_con
use mysqltest; USE mysqltest;
CREATE PROCEDURE bug13198_p1() CREATE PROCEDURE bug13198_p1()
SELECT 1; SELECT 1;
CREATE FUNCTION bug13198_f1() RETURNS INT CREATE FUNCTION bug13198_f1() RETURNS INT
@ -406,7 +406,7 @@ bug13198_f1()
1 1
---> connection: mysqltest_2_con ---> connection: mysqltest_2_con
use mysqltest; USE mysqltest;
CALL bug13198_p1(); CALL bug13198_p1();
1 1
1 1
@ -418,7 +418,7 @@ bug13198_f1()
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
---> connection: mysqltest_2_con ---> connection: mysqltest_2_con
use mysqltest; USE mysqltest;
CALL bug13198_p1(); CALL bug13198_p1();
ERROR HY000: The user specified as a definer ('mysqltest_1'@'localhost') does not exist ERROR HY000: The user specified as a definer ('mysqltest_1'@'localhost') does not exist
SELECT bug13198_f1(); SELECT bug13198_f1();
@ -435,7 +435,7 @@ Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
---> connection: mysqltest_2_con ---> connection: mysqltest_2_con
use test; USE test;
CREATE PROCEDURE sp19857() DETERMINISTIC CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN BEGIN
DECLARE a INT; DECLARE a INT;

View File

@ -3598,7 +3598,7 @@ DROP VIEW v2;
DROP VIEW v3; DROP VIEW v3;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#29477: Not all fields of the target table were checked to have # Bug#29477 Not all fields of the target table were checked to have
# a default value when inserting into a view. # a default value when inserting into a view.
# #
create table t1(f1 int, f2 int not null); create table t1(f1 int, f2 int not null);
@ -3638,7 +3638,7 @@ MAX(a) COUNT(DISTINCT a)
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# -- Bug#34337: Server crash when Altering a view using a table name. # -- Bug#34337 Server crash when Altering a view using a table name.
# ----------------------------------------------------------------- # -----------------------------------------------------------------
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
@ -3655,7 +3655,7 @@ DROP TABLE t1;
# -- End of test case for Bug#34337. # -- End of test case for Bug#34337.
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# -- Bug#35193: VIEW query is rewritten without "FROM DUAL", # -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
# -- causing syntax error # -- causing syntax error
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@ -3723,7 +3723,7 @@ DROP DATABASE `d-1`;
USE test; USE test;
# #
# Bug#26676: VIEW using old table schema in a session. # Bug#26676 VIEW using old table schema in a session.
# #
DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1;
@ -3765,7 +3765,7 @@ DROP TABLE t1;
# End of test case for Bug#26676. # End of test case for Bug#26676.
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# -- Bug#32538: View definition picks up character set, but not collation # -- Bug#32538 View definition picks up character set, but not collation
# ----------------------------------------------------------------- # -----------------------------------------------------------------
DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1;

View File

@ -790,7 +790,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP USER u26813@localhost; DROP USER u26813@localhost;
DROP DATABASE db26813; DROP DATABASE db26813;
# #
# Bug#29908: A user can gain additional access through the ALTER VIEW. # Bug#29908 A user can gain additional access through the ALTER VIEW.
# #
CREATE DATABASE mysqltest_29908; CREATE DATABASE mysqltest_29908;
USE mysqltest_29908; USE mysqltest_29908;
@ -1043,3 +1043,4 @@ DROP VIEW v1, v2;
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
DROP VIEW test.v3; DROP VIEW test.v3;
DROP USER mysqluser1@localhost; DROP USER mysqluser1@localhost;
USE test;

View File

@ -9,10 +9,9 @@
# in proper order. # in proper order.
--source include/have_binlog_format_mixed_or_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
# #
# Test for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global # Test for Bug#25044 ALTER TABLE ... ENABLE KEYS acquires global
# 'opening tables' lock". # 'opening tables' lock
# #
# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for # ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
# the whole its duration as it prevents other queries from execution. # the whole its duration as it prevents other queries from execution.
@ -56,6 +55,7 @@ show binlog events in 'master-bin.000001' from 106;
# Clean up # Clean up
drop tables t1, t2; drop tables t1, t2;
disconnect addconroot;
--echo End of 5.0 tests --echo End of 5.0 tests
@ -76,6 +76,7 @@ create table t1 (i int);
reset master; reset master;
set session debug="+d,sleep_alter_before_main_binlog"; set session debug="+d,sleep_alter_before_main_binlog";
--send alter table t1 change i c char(10) default 'Test1'; --send alter table t1 change i c char(10) default 'Test1';
connect (addconroot, localhost, root,,);
connection addconroot; connection addconroot;
--sleep 2 --sleep 2
insert into t1 values (); insert into t1 values ();
@ -105,6 +106,7 @@ connection addconroot;
rename table t1 to t3; rename table t1 to t3;
connection default; connection default;
--reap --reap
disconnect addconroot;
drop table t3; drop table t3;
set session debug="-d,sleep_alter_before_main_binlog"; set session debug="-d,sleep_alter_before_main_binlog";
@ -114,3 +116,4 @@ show binlog events in 'master-bin.000001' from 106;
--echo End of 5.1 tests --echo End of 5.1 tests

View File

@ -9,11 +9,14 @@
# of the log tables (which are CSV-based). By connect mysql; show tables; # of the log tables (which are CSV-based). By connect mysql; show tables;
--source include/have_csv.inc --source include/have_csv.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2;
--enable_warnings --enable_warnings
#connect (con1,localhost,root,,""); #connect (con1,localhost,root,,"");
#show tables; #show tables;
connect (con1,localhost,root,,mysql); connect (con1,localhost,root,,mysql);
@ -22,12 +25,16 @@ connect (con2,localhost,root,,test);
show tables; show tables;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,test2); connect (fail_con,localhost,root,z,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,); connect (fail_con,localhost,root,z,);
connection default;
disconnect con1;
disconnect con2;
grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling";
@ -39,20 +46,23 @@ show tables;
connect (con4,localhost,test,gambling,test); connect (con4,localhost,test,gambling,test);
show tables; show tables;
connection default;
disconnect con3;
disconnect con4;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2); connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,""); connect (fail_con,localhost,test,,"");
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2); connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,); connect (fail_con,localhost,test,zorro,);
# check if old password version also works # check if old password version also works
update mysql.user set password=old_password("gambling2") where user=_binary"test"; update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges; flush privileges;
@ -61,55 +71,57 @@ connect (con10,localhost,test,gambling2,);
connect (con5,localhost,test,gambling2,mysql); connect (con5,localhost,test,gambling2,mysql);
connection con5; connection con5;
set password=""; set password="";
--error 1372 --error ER_PASSWD_LENGTH
set password='gambling3'; set password='gambling3';
set password=old_password('gambling3'); set password=old_password('gambling3');
show tables; show tables;
connect (con6,localhost,test,gambling3,test); connect (con6,localhost,test,gambling3,test);
show tables; show tables;
connection default;
disconnect con10;
disconnect con5;
disconnect con6;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2); connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,); connect (fail_con,localhost,test,,);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2); connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,); connect (fail_con,localhost,test,zorro,);
# remove user 'test' so that other tests which may use 'test' # remove user 'test' so that other tests which may use 'test'
# do not depend on this test. # do not depend on this test.
delete from mysql.user where user=_binary"test"; delete from mysql.user where user=_binary"test";
flush privileges; flush privileges;
# #
# Bug#12517: Clear user variables and replication events before # Bug#12517 Clear user variables and replication events before
# closing temp tables in thread cleanup. # closing temp tables in thread cleanup.
connect (con7,localhost,root,,test); connect (con7,localhost,root,,test);
connection con7; connection con7;
let $connection_id= `select connection_id()`;
create table t1 (id integer not null auto_increment primary key); create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key);
set @id := 1; set @id := 1;
delete from t1 where id like @id; delete from t1 where id like @id;
disconnect con7;
--sleep 5
connection default; connection default;
disconnect con7;
# Wait till the session con7 is disconnected
let $wait_condition =
SELECT COUNT(*) = 0
FROM information_schema.processlist
WHERE id = '$connection_id';
--source include/wait_condition.inc
drop table t1; drop table t1;
--disconnect con1
--disconnect con2
--disconnect con3
--disconnect con4
--disconnect con5
--disconnect con6
--disconnect con10
--echo # ------------------------------------------------------------------ --echo # ------------------------------------------------------------------
--echo # -- End of 4.1 tests --echo # -- End of 4.1 tests
--echo # ------------------------------------------------------------------ --echo # ------------------------------------------------------------------
@ -250,11 +262,7 @@ SHOW STATUS LIKE 'max_used_connections';
SET GLOBAL event_scheduler = ON; SET GLOBAL event_scheduler = ON;
--echo # -- Waiting for Event Scheduler to start... --echo # -- Waiting for Event Scheduler to start...
let $wait_condition = --source include/running_event_scheduler.inc
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 # 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 # avoid races (we can not for sure when the connection being disconnected is
@ -278,11 +286,7 @@ SHOW STATUS LIKE 'max_used_connections';
SET GLOBAL event_scheduler = OFF; SET GLOBAL event_scheduler = OFF;
--echo # -- Waiting for Event Scheduler to stop... --echo # -- Waiting for Event Scheduler to stop...
let $wait_condition = --source include/no_running_events.inc
SELECT COUNT(*) = 0
FROM information_schema.processlist
WHERE user = 'event_scheduler';
--source include/wait_condition.inc
--echo --echo
--echo # -- End of Bug#35074. --echo # -- End of Bug#35074.
@ -291,3 +295,7 @@ let $wait_condition =
--echo # ------------------------------------------------------------------ --echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests --echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------ --echo # ------------------------------------------------------------------
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,43 +1,61 @@
--source include/have_innodb.inc --source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
### Test 1: ### Test 1:
### - While a consistent snapshot transaction is executed, ### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction. ### no external inserts should be visible to the transaction.
--echo # Switch to connection con1
connection con1; connection con1;
create table t1 (a int) engine=innodb; CREATE TABLE t1 (a INT) ENGINE=innodb;
start transaction with consistent snapshot; START TRANSACTION WITH CONSISTENT SNAPSHOT;
--echo # Switch to connection con2
connection con2; connection con2;
insert into t1 values(1); INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
connection con1; connection con1;
select * from t1; # if consistent snapshot was set as expected, we SELECT * FROM t1; # if consistent snapshot was set as expected, we
# should see nothing. # should see nothing.
commit; COMMIT;
### Test 2: ### Test 2:
### - For any non-consistent snapshot transaction, external ### - For any non-consistent snapshot transaction, external
### committed inserts should be visible to the transaction. ### committed inserts should be visible to the transaction.
delete from t1; DELETE FROM t1;
start transaction; # Now we omit WITH CONSISTENT SNAPSHOT START TRANSACTION; # Now we omit WITH CONSISTENT SNAPSHOT
--echo # Switch to connection con2
connection con2; connection con2;
insert into t1 values(1); INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
connection con1; connection con1;
select * from t1; # if consistent snapshot was not set, as expected, we SELECT * FROM t1; # if consistent snapshot was not set, as expected, we
# should see 1. # should see 1.
commit; COMMIT;
drop table t1; --echo # Switch to connection default + close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,3 +1,7 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
@ -5,12 +9,19 @@ dirty_close con1;
connection con2; connection con2;
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
create table t1 (n int); CREATE TABLE t1 (n INT);
insert into t1 values (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
select * from t1; SELECT * FROM t1;
drop table t1; DROP TABLE t1;
connection default;
disconnect con2;
# End of 4.1 tests # End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -6,72 +6,104 @@
# And it requires InnoDB # And it requires InnoDB
--source include/have_innodb.inc --source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
--echo # Establish connection con3 (user=root)
connect (con3,localhost,root,,); connect (con3,localhost,root,,);
--echo # Switch to connection con1
connection con1; connection con1;
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
create table t1 (a int) engine=innodb; CREATE TABLE t1 (a INT) ENGINE=innodb;
# blocks COMMIT ? # blocks COMMIT ?
begin; BEGIN;
insert into t1 values(1); INSERT INTO t1 VALUES(1);
--echo # Switch to connection con2
connection con2; connection con2;
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
select * from t1; SELECT * FROM t1;
--echo # Switch to connection con1
connection con1; connection con1;
send commit; # blocked by con2 send COMMIT; # blocked by con2
sleep 1; sleep 1;
--echo # Switch to connection con2
connection con2; connection con2;
select * from t1; # verify con1 was blocked and data did not move SELECT * FROM t1; # verify con1 was blocked and data did not move
unlock tables; UNLOCK TABLES;
--echo # Switch to connection con1
connection con1; connection con1;
reap; reap;
# No deadlock ? # No deadlock ?
--echo # Switch to connection con1
connection con1; connection con1;
begin; BEGIN;
select * from t1 for update; SELECT * FROM t1 FOR UPDATE;
--echo # Switch to connection con2
connection con2; connection con2;
begin; BEGIN;
send select * from t1 for update; # blocked by con1 send SELECT * FROM t1 FOR UPDATE; # blocked by con1
sleep 1; sleep 1;
--echo # Switch to connection con3
connection con3; connection con3;
send flush tables with read lock; # blocked by con2 send FLUSH TABLES WITH READ LOCK; # blocked by con2
--echo # Switch to connection con1
connection con1; connection con1;
commit; # should not be blocked by con3 COMMIT; # should not be blocked by con3
--echo # Switch to connection con2
connection con2; connection con2;
reap; reap;
--echo # Switch to connection con3
connection con3; connection con3;
reap; reap;
unlock tables; UNLOCK TABLES;
# BUG#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES # Bug#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# WITH READ LOCK # WITH READ LOCK
--echo # Switch to connection con2
connection con2; connection con2;
commit; # unlock InnoDB row locks to allow insertions COMMIT; # unlock InnoDB row locks to allow insertions
--echo # Switch to connection con1
connection con1; connection con1;
begin; BEGIN;
insert into t1 values(10); INSERT INTO t1 VALUES(10);
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
commit; COMMIT;
unlock tables; UNLOCK TABLES;
--echo # Switch to connection con2
connection con2; connection con2;
flush tables with read lock; # bug caused hang here FLUSH TABLES WITH READ LOCK; # bug caused hang here
unlock tables; UNLOCK TABLES;
# BUG#7358 SHOW CREATE DATABASE fails if open transaction # Bug#7358 SHOW CREATE DATABASE fails if open transaction
begin; BEGIN;
select * from t1; SELECT * FROM t1;
show create database test; SHOW CREATE DATABASE test;
drop table t1; DROP TABLE t1;
# Cleanup
--echo # Switch to connection default and close connections con1, con2, con3
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
# End of 4.1 tests # End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -9,26 +9,45 @@
--source include/have_log_bin.inc --source include/have_log_bin.inc
--source include/have_innodb.inc --source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
# FLUSH TABLES WITH READ LOCK should block writes to binlog too # FLUSH TABLES WITH READ LOCK should block writes to binlog too
--echo # Switch to connection con1
connection con1; connection con1;
create table t1 (a int) engine=innodb; CREATE TABLE t1 (a INT) ENGINE=innodb;
reset master; RESET MASTER;
set autocommit=0; SET AUTOCOMMIT=0;
insert t1 values (1); INSERT t1 VALUES (1);
--echo # Switch to connection con2
connection con2; connection con2;
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
show master status; SHOW MASTER STATUS;
--echo # Switch to connection con1
connection con1; connection con1;
send commit; send COMMIT;
--echo # Switch to connection con2
connection con2; connection con2;
sleep 1; sleep 1;
show master status; SHOW MASTER STATUS;
unlock tables; UNLOCK TABLES;
--echo # Switch to connection con1
connection con1; connection con1;
reap; reap;
drop table t1; DROP TABLE t1;
set autocommit=1; SET AUTOCOMMIT=1;
--echo # Switch to connection default and close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -12,20 +12,23 @@
--source include/have_debug.inc --source include/have_debug.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Disable concurrent inserts to avoid test failures when reading the # Disable concurrent inserts to avoid test failures when reading the
# connection id which was inserted into a table by another thread. # connection id which was inserted into a table by another thread.
set @old_concurrent_insert= @@global.concurrent_insert; SET @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0; SET @@global.concurrent_insert= 0;
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
create table t1 (kill_id int); CREATE TABLE t1 (kill_id INT);
insert into t1 values(connection_id()); INSERT INTO t1 VALUES(connection_id());
# Thanks to the parameter we passed to --debug, this FLUSH will # Thanks to the parameter we passed to --debug, this FLUSH will
# block on a debug build running with our --debug=make_global... It # block on a debug build running with our --debug=make_global... It
@ -33,11 +36,11 @@ insert into t1 values(connection_id());
# --debug) it will succeed immediately # --debug) it will succeed immediately
connection con1; connection con1;
send flush tables with read lock; send FLUSH TABLES WITH READ LOCK;
# kill con1 # kill con1
connection con2; connection con2;
select ((@id := kill_id) - kill_id) from t1; SELECT ((@id := kill_id) - kill_id) FROM t1;
# Wait for the debug sync point, test won't run on non-debug # Wait for the debug sync point, test won't run on non-debug
# builds anyway. # builds anyway.
@ -47,7 +50,7 @@ let $wait_condition=
and info = "flush tables with read lock"; and info = "flush tables with read lock";
--source include/wait_condition.inc --source include/wait_condition.inc
kill connection @id; KILL CONNECTION @id;
connection con1; connection con1;
# On debug builds it will be error 1053 (killed); on non-debug, or # On debug builds it will be error 1053 (killed); on non-debug, or
@ -58,8 +61,14 @@ connection con1;
reap; reap;
connection con2; connection con2;
drop table t1; DROP TABLE t1;
connection default; connection default;
disconnect con2;
# Restore global concurrent_insert value # Restore global concurrent_insert value
set @@global.concurrent_insert= @old_concurrent_insert; SET @@global.concurrent_insert= @old_concurrent_insert;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# should work with embedded server after mysqltest is fixed # should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc --source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--source include/add_anonymous_users.inc --source include/add_anonymous_users.inc
connect (con0,localhost,root,,); connect (con0,localhost,root,,);
@ -233,7 +236,8 @@ connect (con1,localhost,mysqltest1,,);
connection con1; connection con1;
select * from t1; select * from t1;
connection con0; connection default;
disconnect con0;
disconnect con1; disconnect con1;
drop trigger trg1; drop trigger trg1;
@ -244,3 +248,7 @@ set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost; revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost; drop user mysqltest1@localhost;
drop table t1, t2; drop table t1, t2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,4 +1,8 @@
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2;
--enable_warnings --enable_warnings
@ -14,14 +18,18 @@ create table t1(n int);
insert into t1 values (1); insert into t1 values (1);
lock tables t1 write; lock tables t1 write;
connection writer; connection writer;
send update low_priority t1 set n = 4; send
update low_priority t1 set n = 4;
connection reader; connection reader;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Locked" and info = "update low_priority t1 set n = 4"; where state = "Locked" and info = "update low_priority t1 set n = 4";
--source include/wait_condition.inc --source include/wait_condition.inc
send select n from t1; send
select n from t1;
connection locker; connection locker;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Locked" and info = "select n from t1"; where state = "Locked" and info = "select n from t1";
@ -38,8 +46,10 @@ create table t1(n int);
insert into t1 values (1); insert into t1 values (1);
lock tables t1 read; lock tables t1 read;
connection writer; connection writer;
send update low_priority t1 set n = 4; send
update low_priority t1 set n = 4;
connection reader; connection reader;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Locked" and info = "update low_priority t1 set n = 4"; where state = "Locked" and info = "update low_priority t1 set n = 4";
@ -72,7 +82,7 @@ drop table t1;
drop table t2; drop table t2;
# #
# Test problem when using locks on many tables and droping a table that # Test problem when using locks on many tables and dropping a table that
# is to-be-locked by another thread # is to-be-locked by another thread
# #
# #
@ -81,7 +91,8 @@ create table t1 (a int);
create table t2 (a int); create table t2 (a int);
lock table t1 write, t2 write; lock table t1 write, t2 write;
connection reader; connection reader;
send insert t1 select * from t2; send
insert t1 select * from t2;
connection locker; connection locker;
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
@ -89,7 +100,7 @@ let $wait_condition=
--source include/wait_condition.inc --source include/wait_condition.inc
drop table t2; drop table t2;
connection reader; connection reader;
--error 1146 --error ER_NO_SUCH_TABLE
reap; reap;
connection locker; connection locker;
drop table t1; drop table t1;
@ -103,15 +114,17 @@ create table t1 (a int);
create table t2 (a int); create table t2 (a int);
lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write; lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
connection reader; connection reader;
send insert t1 select * from t2; send
insert t1 select * from t2;
connection locker; connection locker;
# Sleep a bit till the insert of connection reader is in work and hangs
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Locked" and info = "insert t1 select * from t2"; where state = "Locked" and info = "insert t1 select * from t2";
--source include/wait_condition.inc --source include/wait_condition.inc
drop table t2; drop table t2;
connection reader; connection reader;
--error 1146 --error ER_NO_SUCH_TABLE
reap; reap;
connection locker; connection locker;
drop table t1; drop table t1;
@ -120,7 +133,7 @@ drop table t1;
--echo End of 4.1 tests --echo End of 4.1 tests
# #
# BUG#9998 - MySQL client hangs on USE "database" # Bug#9998 MySQL client hangs on USE "database"
# #
create table t1(a int); create table t1(a int);
lock tables t1 write; lock tables t1 write;
@ -131,23 +144,25 @@ unlock tables;
drop table t1; drop table t1;
# #
# Bug#16986 - Deadlock condition with MyISAM tables # Bug#16986 Deadlock condition with MyISAM tables
# #
# Need a matching user in mysql.user for multi-table select # Need a matching user in mysql.user for multi-table select
--source include/add_anonymous_users.inc --source include/add_anonymous_users.inc
connection locker; connection locker;
use mysql; USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE; LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES; FLUSH TABLES;
# #
connection reader; connection reader;
use mysql; USE mysql;
#NOTE: This must be a multi-table select, otherwise the deadlock will not occur # Note: This must be a multi-table select, otherwise the deadlock will not occur
send SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; send
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
# #
connection locker; connection locker;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = where state = "Waiting for table" and info =
@ -160,7 +175,7 @@ UNLOCK TABLES;
# #
connection reader; connection reader;
reap; reap;
use test; USE test;
# #
connection locker; connection locker;
use test; use test;
@ -175,9 +190,11 @@ LOCK TABLE t1 WRITE;
# #
# This waits until t1 is unlocked. # This waits until t1 is unlocked.
connection locker; connection locker;
send FLUSH TABLES WITH READ LOCK; send
FLUSH TABLES WITH READ LOCK;
# #
connection writer; connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Flushing tables" and info = "FLUSH TABLES WITH READ LOCK"; where state = "Flushing tables" and info = "FLUSH TABLES WITH READ LOCK";
@ -202,15 +219,17 @@ LOCK TABLE t1 WRITE;
# #
# This waits until t1 is unlocked. # This waits until t1 is unlocked.
connection locker; connection locker;
send FLUSH TABLES WITH READ LOCK; send
FLUSH TABLES WITH READ LOCK;
# #
# This must not block. # This must not block.
connection writer; connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Flushing tables" and info = "FLUSH TABLES WITH READ LOCK"; where state = "Flushing tables" and info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc --source include/wait_condition.inc
--error 1100 --error ER_TABLE_NOT_LOCKED
CREATE TABLE t2 AS SELECT * FROM t1; CREATE TABLE t2 AS SELECT * FROM t1;
UNLOCK TABLES; UNLOCK TABLES;
# #
@ -225,7 +244,7 @@ DROP TABLE t1;
--source include/delete_anonymous_users.inc --source include/delete_anonymous_users.inc
# #
# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock # Bug#19815 CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
# #
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
@ -237,7 +256,8 @@ FLUSH TABLES WITH READ LOCK;
# With bug in place: acquire LOCK_mysql_create_table and # With bug in place: acquire LOCK_mysql_create_table and
# wait in wait_if_global_read_lock(). # wait in wait_if_global_read_lock().
connection con2; connection con2;
send DROP DATABASE mysqltest_1; send
DROP DATABASE mysqltest_1;
# #
# With bug in place: try to acquire LOCK_mysql_create_table... # With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock. # When fixed: Reject dropping db because of the read lock.
@ -263,7 +283,7 @@ disconnect con2;
DROP DATABASE mysqltest_1; DROP DATABASE mysqltest_1;
# #
# Bug #17264: MySQL Server freeze # Bug#17264 MySQL Server freeze
# #
connection locker; connection locker;
# Disable warnings to allow test to run also without InnoDB # Disable warnings to allow test to run also without InnoDB
@ -272,14 +292,18 @@ create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) e
--enable_warnings --enable_warnings
lock tables t1 write; lock tables t1 write;
connection writer; connection writer;
send alter table t1 auto_increment=0; send
alter table t1 auto_increment=0;
connection reader; connection reader;
# Wait till connection writer is blocked
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Locked" and info = "alter table t1 auto_increment=0"; where state = "Locked" and info = "alter table t1 auto_increment=0";
--source include/wait_condition.inc --source include/wait_condition.inc
send alter table t1 auto_increment=0; send
alter table t1 auto_increment=0;
connection locker; connection locker;
# Wait till connection reader is blocked
let $wait_condition= let $wait_condition=
select count(*) = 2 from information_schema.processlist select count(*) = 2 from information_schema.processlist
where state = "Locked" and info = "alter table t1 auto_increment=0"; where state = "Locked" and info = "alter table t1 auto_increment=0";
@ -293,7 +317,7 @@ connection locker;
drop table t1; drop table t1;
# #
# Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while # Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK'' # ``FLUSH TABLES WITH READ LOCK''
# #
@ -365,7 +389,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL; ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b; UPDATE t2 SET a=b;
@ -373,11 +397,11 @@ while ($i) {
--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b --send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a; ALTER TABLE t2 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 --error 0,ER_BAD_FIELD_ERROR
--reap --reap
} }
--enable_query_log --enable_query_log
@ -390,7 +414,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL; ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b; UPDATE t2 SET a=b;
@ -399,11 +423,11 @@ while ($i) {
--send EXECUTE stmt --send EXECUTE stmt
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a; ALTER TABLE t2 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 --error 0,ER_BAD_FIELD_ERROR
--reap --reap
} }
@ -411,8 +435,9 @@ while ($i) {
--connection default --connection default
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
# #
# Bug#38499: flush tables and multitable table update with derived table cause # Bug#38499 flush tables and multitable table update with derived table cause
# crash # crash
# #
@ -471,7 +496,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL; ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b; UPDATE t1 SET a=b;
@ -479,11 +504,11 @@ while ($i) {
--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0; --send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 # unknown column error --error 0,ER_BAD_FIELD_ERROR # unknown column error
--reap --reap
} }
--enable_query_log --enable_query_log
@ -496,7 +521,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT; ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b; UPDATE t1 SET a=b;
@ -505,11 +530,11 @@ while ($i) {
--send EXECUTE stmt --send EXECUTE stmt
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 # Unknown column 'a' in 'field list' --error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap --reap
} }
--enable_query_log --enable_query_log
@ -568,7 +593,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL; ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b; UPDATE t1 SET a=b;
@ -576,11 +601,11 @@ while ($i) {
--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0; --send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 # Unknown column 'a' in 'field list' --error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap --reap
} }
--enable_query_log --enable_query_log
@ -593,7 +618,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT; ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b; UPDATE t1 SET a=b;
@ -602,11 +627,11 @@ while ($i) {
--send EXECUTE stmt --send EXECUTE stmt
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 # Unknown column 'a' in 'field list' --error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap --reap
} }
--enable_query_log --enable_query_log
@ -617,20 +642,22 @@ DROP TABLE t1;
# #
# Bug #21281 "Pending write lock is incorrectly removed when its # Bug#21281 Pending write lock is incorrectly removed when its
# statement being KILLed" # statement being KILLed
# #
create table t1 (i int); create table t1 (i int);
connection locker; connection locker;
lock table t1 read; lock table t1 read;
connection writer; connection writer;
--send update t1 set i= 10; send
update t1 set i= 10;
connection reader; connection reader;
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Locked" and info = "update t1 set i= 10"; where state = "Locked" and info = "update t1 set i= 10";
--source include/wait_condition.inc --source include/wait_condition.inc
--send select * from t1; send
select * from t1;
connection default; connection default;
let $wait_condition= let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
@ -650,7 +677,7 @@ connection default;
drop table t1; drop table t1;
# #
# Bug#25856 - HANDLER table OPEN in one connection lock DROP TABLE in another one # Bug#25856 HANDLER table OPEN in one connection lock DROP TABLE in another one
# #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
@ -658,12 +685,19 @@ drop table if exists t1;
create table t1 (a int) ENGINE=MEMORY; create table t1 (a int) ENGINE=MEMORY;
--echo --> client 2 --echo --> client 2
connection locker; connection locker;
--error 1031 --error ER_ILLEGAL_HA
handler t1 open; handler t1 open;
--echo --> client 1 --echo --> client 1
connection default; connection default;
drop table t1; drop table t1;
# Disconnect sessions used in many subtests above
disconnect locker;
disconnect reader;
disconnect writer;
# #
# Bug#32395 Alter table under a impending global read lock causes a server crash # Bug#32395 Alter table under a impending global read lock causes a server crash
# #
@ -764,7 +798,7 @@ disconnect flush;
drop table t1; drop table t1;
# #
# Bug#30331: Table_locks_waited shows inaccurate values # Bug#30331 Table_locks_waited shows inaccurate values
# #
--disable_warnings --disable_warnings
@ -794,3 +828,7 @@ eval SET @tlwb= SUBSTRING_INDEX('$tlwb', ' ', -1);
select @tlwa < @tlwb; select @tlwa < @tlwb;
--echo End of 5.1 tests --echo End of 5.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -109,7 +109,7 @@ select "--- --position --" as "";
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=239 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=239 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 (mysqlbinlog does not accept input from stdin) # Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log --disable_query_log
select "--- reading stdin --" as ""; select "--- reading stdin --" as "";
--enable_query_log --enable_query_log
@ -123,7 +123,7 @@ select "--- reading stdin --" as "";
drop table t1,t2; drop table t1,t2;
# #
#BUG#14157: utf8 encoding in binlog without set character_set_client # Bug#14157 utf8 encoding in binlog without set character_set_client
# #
flush logs; flush logs;
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
@ -228,9 +228,9 @@ flush logs;
CREATE TABLE t1 (c1 CHAR(10)); CREATE TABLE t1 (c1 CHAR(10));
# we need this for getting fixed timestamps inside of this test # we need this for getting fixed timestamps inside of this test
flush logs; FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789'); INSERT INTO t1 VALUES ('0123456789');
flush logs; FLUSH LOGS;
DROP TABLE t1; DROP TABLE t1;
# We create a table, patch, and load the output into it # We create a table, patch, and load the output into it
@ -239,10 +239,10 @@ DROP TABLE t1;
# as described in the original bug # as described in the original bug
--disable_query_log --disable_query_log
CREATE TABLE patch (a blob); CREATE TABLE patch (a BLOB);
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat --exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat' eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
INTO TABLE patch FIELDS TERMINATED by '' LINES STARTING BY '#'; INTO TABLE patch FIELDS TERMINATED BY '' LINES STARTING BY '#';
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log --enable_query_log
@ -254,40 +254,42 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP TABLE patch; DROP TABLE patch;
# #
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
# #
flush logs; FLUSH LOGS;
create table t1(a int); CREATE TABLE t1(a INT);
insert into t1 values(connection_id()); INSERT INTO t1 VALUES(connection_id());
let $a= `select a from t1`; let $a= `SELECT a FROM t1`;
flush logs; FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
drop table t1; --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $outfile
DROP TABLE t1;
connect (con1, localhost, root, , test); connect (con1, localhost, root, , test);
connection con1; connection con1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql --exec $MYSQL test < $outfile
--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql --remove_file $outfile
let $b= `select a from t1`; let $b= `SELECT a FROM t1`;
disconnect con1; disconnect con1;
connection default; connection default;
let $c= `select $a=$b`; let $c= `SELECT $a=$b`;
--echo $c --echo $c
drop table t1; DROP TABLE t1;
echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql; echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
error 1; error 1;
exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql; exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
--remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql
# #
# Test --disable-force-if-open and --force-if-open # Test --disable-force-if-open and --force-if-open
# #
flush logs; FLUSH LOGS;
--error 1 --error 1
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
--echo BUG#31611: Security risk with BINLOG statement --echo Bug#31611 Security risk with BINLOG statement
SET BINLOG_FORMAT=ROW; SET BINLOG_FORMAT=ROW;
CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest1;
@ -306,6 +308,7 @@ connect (unsecure,localhost,untrusted,,mysqltest1);
echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql; echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql;
error 1; error 1;
exec $MYSQL mysqltest1 -uuntrusted < $MYSQLTEST_VARDIR/tmp/bug31611.sql; exec $MYSQL mysqltest1 -uuntrusted < $MYSQLTEST_VARDIR/tmp/bug31611.sql;
--remove_file $MYSQLTEST_VARDIR/tmp/bug31611.sql
connection unsecure; connection unsecure;
error ER_TABLEACCESS_DENIED_ERROR; error ER_TABLEACCESS_DENIED_ERROR;
INSERT INTO t1 VALUES (1,USER()); INSERT INTO t1 VALUES (1,USER());
@ -315,7 +318,7 @@ connection default;
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
DROP USER untrusted@localhost; DROP USER untrusted@localhost;
--echo BUG#32580: mysqlbinlog cannot read binlog event with user variables --echo Bug#32580 mysqlbinlog cannot read binlog event with user variables
# Testing that various kinds of events can be read and restored properly. # Testing that various kinds of events can be read and restored properly.
@ -346,21 +349,22 @@ DROP TABLE t1;
# Bug#37313 BINLOG Contains Incorrect server id # Bug#37313 BINLOG Contains Incorrect server id
# #
let $save_server_id= `select @@global.server_id`; let $binlog_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog;
let $s_id_max=`select (1 << 32) - 1`; let $save_server_id= `SELECT @@global.server_id`;
eval set @@global.server_id= $s_id_max; let $s_id_max= `SELECT (1 << 32) - 1`;
eval SET @@global.server_id= $s_id_max;
reset master; RESET MASTER;
flush logs; FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select eval SELECT
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) (@a:=LOAD_FILE("$binlog_file"))
is not null; IS NOT NULL;
let $s_id_unsigned= `select @a like "%server id $s_id_max%" /* must return 1 */`; let $s_id_unsigned= `SELECT @a LIKE "%server id $s_id_max%" /* must return 1 */`;
echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***; echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
eval set @@global.server_id= $save_server_id; eval SET @@global.server_id= $save_server_id;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog --remove_file $binlog_file
--echo End of 5.1 tests --echo End of 5.1 tests

View File

@ -6,6 +6,9 @@
# This test uses chmod, can't be run with root permissions # This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc -- source include/not_as_root.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# ============================================================================ # ============================================================================
# #
# Test of mysqltest itself # Test of mysqltest itself
@ -707,7 +710,7 @@ echo Not a banana: $cat;
--error 1 --error 1
--exec echo "let hi;" | $MYSQL_TEST 2>&1 --exec echo "let hi;" | $MYSQL_TEST 2>&1
# More advanced test for bug#17280 # More advanced test for Bug#17280
let $success= 1; let $success= 1;
--echo # Execute: --echo # <whatever> success: \$success --echo # Execute: --echo # <whatever> success: \$success
--echo # <whatever> success: $success --echo # <whatever> success: $success
@ -1391,7 +1394,7 @@ connection default;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test bug#12386 # Test Bug#12386
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
let $num= 2; let $num= 2;
while ($num) while ($num)
@ -1407,7 +1410,7 @@ SELECT 1 as a;
# #
# Bug #10251: Identifiers containing quotes not handled correctly # Bug#10251 Identifiers containing quotes not handled correctly
# #
select 1 as `a'b`, 2 as `a"b`; select 1 as `a'b`, 2 as `a"b`;
@ -1465,6 +1468,8 @@ remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result;
--error 0,1 --error 0,1
remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.reject; remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.reject;
--error 0,1 --error 0,1
remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.log;
--error 0,1
remove_file $MYSQL_TEST_DIR/r/zero_length_file.reject; remove_file $MYSQL_TEST_DIR/r/zero_length_file.reject;
# #
@ -1539,7 +1544,7 @@ remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql; remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
# #
# Bug#19890 mysqltest: "query" command is broken # Bug#19890 mysqltest "query" command is broken
# #
# It should be possible to use the command "query" to force mysqltest to # It should be possible to use the command "query" to force mysqltest to
@ -2170,7 +2175,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt;
rmdir $MYSQLTEST_VARDIR/tmp/testdir; rmdir $MYSQLTEST_VARDIR/tmp/testdir;
# #
# Bug #36041: mysql-test-run doesn't seem to string match 100% effectively # Bug#36041 mysql-test-run doesn't seem to string match 100% effectively
# on Windows # on Windows
# #
@ -2212,12 +2217,14 @@ select 1;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# BUG#35701: please allow test language variables in connection and sync_slave_with_master # BUG#35701 please allow test language variables in connection and sync_slave_with_master
# Test that "connection $variable" works and that $CURRENT_CONNECTION has the right value. # Test that "connection $variable" works and that $CURRENT_CONNECTION has the right value.
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
--echo $CURRENT_CONNECTION --echo $CURRENT_CONNECTION
connect (con2,localhost,root,,);
--echo $CURRENT_CONNECTION
connection default; connection default;
--echo $CURRENT_CONNECTION --echo $CURRENT_CONNECTION
@ -2225,8 +2232,11 @@ connection default;
connection con1; connection con1;
--echo $CURRENT_CONNECTION --echo $CURRENT_CONNECTION
let $x= default; connection con2;
let $y= con1; --echo $CURRENT_CONNECTION
let $x= con1;
let $y= con2;
connection $x; connection $x;
--echo $CURRENT_CONNECTION --echo $CURRENT_CONNECTION
@ -2245,3 +2255,6 @@ disconnect $y;
--echo End of tests --echo End of tests
connection default;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -3,10 +3,12 @@
# should work with embedded server after mysqltest is fixed # should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/count_sessions.inc
set @start_read_only= @@global.read_only; set @start_read_only= @@global.read_only;
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,t2,t3; DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings --enable_warnings
@ -110,7 +112,7 @@ drop table t1;
insert into t1 values(1); insert into t1 values(1);
# #
# BUG#11733: COMMITs should not happen if read-only is set # Bug#11733 COMMITs should not happen if read-only is set
# #
# LOCK TABLE ... WRITE / READ_ONLY # LOCK TABLE ... WRITE / READ_ONLY
@ -238,8 +240,9 @@ set global read_only=1;
connection default; connection default;
select @@global.read_only; select @@global.read_only;
unlock tables; unlock tables;
disconnect root2;
# BUG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set" # Bug#22077 DROP TEMPORARY TABLE fails with wrong error if read_only is set
# #
# check if DROP TEMPORARY on a non-existing temporary table returns the right # check if DROP TEMPORARY on a non-existing temporary table returns the right
# error # error
@ -256,8 +259,10 @@ drop temporary table if exists ttt;
--echo connection default; --echo connection default;
connection default; connection default;
set global read_only=0; set global read_only=0;
disconnect con1;
drop table t1,t2; drop table t1,t2;
drop user test@localhost; drop user test@localhost;
--echo # --echo #
--echo # Bug#27440 read_only allows create and drop database --echo # Bug#27440 read_only allows create and drop database
--echo # --echo #
@ -297,7 +302,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges; flush privileges;
drop database mysqltest_db1; drop database mysqltest_db1;
set global read_only= @start_read_only; set global read_only= @start_read_only;
disconnect con1;
disconnect root2; # Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# depends on the presence of the log tables (which are CSV-based). # depends on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc --source include/have_csv.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# #
# Test of some show commands # Test of some show commands
# #
@ -195,7 +198,7 @@ show columns from t1;
drop table t1; drop table t1;
# #
# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes" # Test for Bug#2593 SHOW CREATE TABLE doesn't properly double quotes
# #
SET @old_sql_mode= @@sql_mode, sql_mode= ''; SET @old_sql_mode= @@sql_mode, sql_mode= '';
@ -248,7 +251,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create;
SET sql_mode= @old_sql_mode; SET sql_mode= @old_sql_mode;
# #
# Test for bug #2719 "Heap tables status shows wrong or missing data." # Test for Bug#2719 Heap tables status shows wrong or missing data.
# #
select @@max_heap_table_size; select @@max_heap_table_size;
@ -309,7 +312,7 @@ show table status;
drop table t1, t2, t3; drop table t1, t2, t3;
# #
# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege # Test for Bug#3342 SHOW CREATE DATABASE seems to require DROP privilege
# #
create database mysqltest; create database mysqltest;
@ -324,29 +327,32 @@ connect (con1,localhost,mysqltest_1,,mysqltest);
connection con1; connection con1;
select * from t1; select * from t1;
show create database mysqltest; show create database mysqltest;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
drop table t1; drop table t1;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
drop database mysqltest; drop database mysqltest;
disconnect con1;
connect (con2,localhost,mysqltest_2,,test); connect (con2,localhost,mysqltest_2,,test);
connection con2; connection con2;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1; select * from mysqltest.t1;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
show create database mysqltest; show create database mysqltest;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
drop table mysqltest.t1; drop table mysqltest.t1;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
drop database mysqltest; drop database mysqltest;
disconnect con2;
connect (con3,localhost,mysqltest_3,,test); connect (con3,localhost,mysqltest_3,,test);
connection con3; connection con3;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1; select * from mysqltest.t1;
show create database mysqltest; show create database mysqltest;
drop table mysqltest.t1; drop table mysqltest.t1;
drop database mysqltest; drop database mysqltest;
disconnect con3;
connection default; connection default;
set names binary; set names binary;
@ -397,7 +403,7 @@ ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
# Test for BUG#9439 "Reporting wrong datatype for sub_part on show index" # Test for Bug#9439 Reporting wrong datatype for sub_part on show index
CREATE TABLE t1( CREATE TABLE t1(
field1 text NOT NULL, field1 text NOT NULL,
PRIMARY KEY(field1(1000)) PRIMARY KEY(field1(1000))
@ -407,7 +413,7 @@ show index from t1;
--disable_metadata --disable_metadata
drop table t1; drop table t1;
# Test for BUG#11635: mysqldump exports TYPE instead of USING for HASH # Test for Bug#11635 mysqldump exports TYPE instead of USING for HASH
create table t1 ( create table t1 (
c1 int NOT NULL, c1 int NOT NULL,
c2 int NOT NULL, c2 int NOT NULL,
@ -417,7 +423,7 @@ create table t1 (
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
# Test for BUG#93: 4.1 protocl crash on corupted frm and SHOW TABLE STATUS # Test for Bug#93 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
flush tables; flush tables;
@ -426,19 +432,19 @@ let $MYSQLD_DATADIR= `select @@datadir`;
system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ; system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 #
SHOW TABLE STATUS like 't1'; SHOW TABLE STATUS like 't1';
--error 1033 --error ER_NOT_FORM_FILE
show create table t1; show create table t1;
drop table if exists t1; drop table if exists t1;
--error 1,0 --error 1,0
--remove_file $MYSQLD_DATADIR/test/t1.frm --remove_file $MYSQLD_DATADIR/test/t1.frm
# #
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar # Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar
# First we close all open tables with FLUSH tables and then we open some. # First we close all open tables with FLUSH tables and then we open some.
# #
--echo --echo
--echo # Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar. --echo # Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar.
--echo --echo
# NOTE: SHOW OPEN TABLES does not sort result list by database or table names. # NOTE: SHOW OPEN TABLES does not sort result list by database or table names.
@ -497,15 +503,15 @@ use test;
--echo --echo
# #
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message) # Bug#12591 SHOW TABLES FROM dbname produces wrong error message
# #
--error 1049 --error ER_BAD_DB_ERROR
SHOW TABLES FROM non_existing_database; SHOW TABLES FROM non_existing_database;
--echo End of 4.1 tests --echo End of 4.1 tests
# #
# Bug#17203: "sql_no_cache sql_cache" in views created from prepared # Bug#17203 "sql_no_cache sql_cache" in views created from prepared
# statement # statement
# #
# The problem was that initial user setting was forgotten, and current # The problem was that initial user setting was forgotten, and current
@ -585,7 +591,7 @@ SHOW COLUMNS FROM no_such_table;
# #
# Bug #19764: SHOW commands end up in the slow log as table scans # Bug#19764 SHOW commands end up in the slow log as table scans
# #
flush status; flush status;
show status like 'slow_queries'; show status like 'slow_queries';
@ -657,8 +663,9 @@ drop table t1;
drop procedure p1; drop procedure p1;
drop function f1; drop function f1;
drop event e1; drop event e1;
# #
# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT # Bug#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S. # FROM I_S.
# #
@ -930,7 +937,7 @@ DROP DATABASE mysqltest1;
use test; use test;
# #
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored # Bug#28808 log_queries_not_using_indexes variable dynamic change is ignored
# #
flush status; flush status;
show variables like "log_queries_not_using_indexes"; show variables like "log_queries_not_using_indexes";
@ -946,7 +953,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries'; show status like 'slow_queries';
# #
# Bug #30088: Can't disable myisam-recover by a value of "" # Bug#30088 Can't disable myisam-recover by a value of ""
# #
show variables like 'myisam_recover_options'; show variables like 'myisam_recover_options';
@ -977,7 +984,8 @@ SHOW AUTHORS;
--enable_result_log --enable_result_log
# #
# Test for bug #9785 SELECT privilege for the whole database is needed to do SHOW CREATE DATABASE # Bug#9785 SELECT privilege for the whole database is needed to do
# SHOW CREATE DATABASE
# #
create database mysqltest; create database mysqltest;
show create database mysqltest; show create database mysqltest;
@ -993,6 +1001,8 @@ delete from mysql.db where user='mysqltest_4';
delete from mysql.tables_priv where user='mysqltest_4'; delete from mysql.tables_priv where user='mysqltest_4';
flush privileges; flush privileges;
drop database mysqltest; drop database mysqltest;
connection default;
disconnect con4;
# #
# Ensure that show plugin code is tested # Ensure that show plugin code is tested
@ -1008,7 +1018,7 @@ show plugins;
--enable_result_log --enable_result_log
# #
# Bug #19874: SHOW COLUMNS and SHOW KEYS handle identifiers containing # Bug#19874 SHOW COLUMNS and SHOW KEYS handle identifiers containing
# \ incorrectly # \ incorrectly
# #
create database `mysqlttest\1`; create database `mysqlttest\1`;
@ -1021,7 +1031,7 @@ drop table `mysqlttest\1`.`a\b`;
drop database `mysqlttest\1`; drop database `mysqlttest\1`;
# #
# Bug#24392: SHOW ENGINE MUTEX STATUS is a synonym for SHOW INNODB STATUS # Bug#24392 SHOW ENGINE MUTEX STATUS is a synonym for SHOW INNODB STATUS
# #
--error ER_UNKNOWN_STORAGE_ENGINE --error ER_UNKNOWN_STORAGE_ENGINE
@ -1107,7 +1117,7 @@ DROP PROCEDURE p1;
DEALLOCATE PREPARE stmt1; DEALLOCATE PREPARE stmt1;
# #
# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT # Bug#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM INFORMATION_SCHEMA. # FROM INFORMATION_SCHEMA.
# #
# Before the change performed to fix the bug, the metadata of the output of # Before the change performed to fix the bug, the metadata of the output of
@ -1171,16 +1181,16 @@ DROP TABLE t1;
DROP EVENT ev1; DROP EVENT ev1;
# #
# Bug #30036: SHOW TABLE TYPES causes the debug client to crash # Bug#30036 SHOW TABLE TYPES causes the debug client to crash
# #
--disable_result_log --disable_result_log
SHOW TABLE TYPES; SHOW TABLE TYPES;
--enable_result_log --enable_result_log
#
# Bug #32710: SHOW INNODB STATUS requires SUPER
#
#
# Bug#32710 SHOW INNODB STATUS requires SUPER
#
CREATE USER test_u@localhost; CREATE USER test_u@localhost;
GRANT PROCESS ON *.* TO test_u@localhost; GRANT PROCESS ON *.* TO test_u@localhost;
@ -1198,3 +1208,7 @@ DROP USER test_u@localhost;
--echo End of 5.1 tests --echo End of 5.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,7 +1,10 @@
# Can't be tested with embedded server # Can't be tested with embedded server
--source include/not_embedded.inc --source include/not_embedded.inc
# Bug #8471: IP address with mask fail when skip-name-resolve is on # Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Bug#8471 IP address with mask fail when skip-name-resolve is on
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255'; GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255'; SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255'; REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
@ -9,12 +12,17 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
# End of 4.1 tests # End of 4.1 tests
# Bug #13407 "Remote connecting crashes server". # Bug#13407 Remote connecting crashes server
# Server crashed when one used USER() function in connection for which # Server crashed when one used USER() function in connection for which
# was impossible to obtain peer hostname. # was impossible to obtain peer hostname.
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, ); connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 # --replace_column 1 #
select user(); SELECT USER();
--replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info> --replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info>
show processlist; SHOW PROCESSLIST;
connection default; connection default;
disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# Can't test with embedded server that doesn't support grants # Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1root,localhost,root,,); connect (con1root,localhost,root,,);
connection con1root; connection con1root;
@ -156,7 +159,7 @@ call db1_secret.stamp(6);
select db1_secret.db(); select db1_secret.db();
# #
# BUG#2777 # Bug#2777 Stored procedure doesn't observe definer's rights
# #
connection con1root; connection con1root;
@ -215,7 +218,7 @@ call q();
select * from t2; select * from t2;
# #
# BUG#6030: Stored procedure has no appropriate DROP privilege # Bug#6030 Stored procedure has no appropriate DROP privilege
# (or ALTER for that matter) # (or ALTER for that matter)
# still connection con2user1 in db2 # still connection con2user1 in db2
@ -330,7 +333,7 @@ flush privileges;
drop table t1; drop table t1;
# #
# BUG#9503: reseting correct parameters of thread after error in SP function # Bug#9503 reseting correct parameters of thread after error in SP function
# #
connect (root,localhost,root,,test); connect (root,localhost,root,,test);
connection root; connection root;
@ -366,10 +369,12 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop function bug_9503; drop function bug_9503;
use test; use test;
drop database mysqltest; drop database mysqltest;
connection default;
disconnect root;
# #
# correct value from current_user() in function run from "security definer" # correct value from current_user() in function run from "security definer"
# (BUG#7291) # (Bug#7291 Stored procedures: wrong CURRENT_USER value)
# #
connection con1root; connection con1root;
use test; use test;
@ -398,7 +403,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop user user1@localhost; drop user user1@localhost;
# #
# Bug #12318: Wrong error message when accessing an inaccessible stored # Bug#12318 Wrong error message when accessing an inaccessible stored
# procedure in another database when the current database is # procedure in another database when the current database is
# information_schema. # information_schema.
# #
@ -438,7 +443,7 @@ revoke usage on *.* from mysqltest_1@localhost;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
# #
# BUG#12812 create view calling a function works without execute right # Bug#12812 create view calling a function works without execute right
# on function # on function
delimiter |; delimiter |;
--disable_warnings --disable_warnings
@ -464,7 +469,7 @@ delimiter ;|
# #
# BUG#14834: Server denies to execute Stored Procedure # Bug#14834 Server denies to execute Stored Procedure
# #
# The problem here was with '_' in the database name. # The problem here was with '_' in the database name.
# #
@ -507,7 +512,7 @@ drop database db_bug14834;
# #
# BUG#14533: 'desc tbl' in stored procedure causes error # Bug#14533 'desc tbl' in stored procedure causes error
# ER_TABLEACCESS_DENIED_ERROR # ER_TABLEACCESS_DENIED_ERROR
# #
create database db_bug14533; create database db_bug14533;
@ -546,7 +551,7 @@ drop database db_bug14533;
# #
# WL#2897: Complete definer support in the stored routines. # WL#2897 Complete definer support in the stored routines.
# #
# The following cases are tested: # The following cases are tested:
# 1. check that if DEFINER-clause is not explicitly specified, stored routines # 1. check that if DEFINER-clause is not explicitly specified, stored routines
@ -591,7 +596,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_2_con --echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con --connection mysqltest_2_con
use mysqltest; USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1; CREATE PROCEDURE wl2897_p1() SELECT 1;
@ -603,7 +608,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
--echo ---> connection: mysqltest_1_con --echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con --connection mysqltest_1_con
use mysqltest; USE mysqltest;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR --error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2; CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
@ -629,7 +634,7 @@ CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
--echo ---> connection: con1root --echo ---> connection: con1root
--connection con1root --connection con1root
use mysqltest; USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1; SHOW CREATE PROCEDURE wl2897_p1;
SHOW CREATE PROCEDURE wl2897_p3; SHOW CREATE PROCEDURE wl2897_p3;
@ -649,7 +654,7 @@ DROP DATABASE mysqltest;
# #
# BUG#13198: SP executes if definer does not exist # Bug#13198 SP executes if definer does not exist
# #
# Prepare environment. # Prepare environment.
@ -679,7 +684,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_1_con --echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con --connection mysqltest_1_con
use mysqltest; USE mysqltest;
CREATE PROCEDURE bug13198_p1() CREATE PROCEDURE bug13198_p1()
SELECT 1; SELECT 1;
@ -697,7 +702,7 @@ SELECT bug13198_f1();
--echo ---> connection: mysqltest_2_con --echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con --connection mysqltest_2_con
use mysqltest; USE mysqltest;
CALL bug13198_p1(); CALL bug13198_p1();
@ -719,7 +724,7 @@ DROP USER mysqltest_1@localhost;
--echo ---> connection: mysqltest_2_con --echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con --connection mysqltest_2_con
use mysqltest; USE mysqltest;
--error ER_NO_SUCH_USER --error ER_NO_SUCH_USER
CALL bug13198_p1(); CALL bug13198_p1();
@ -740,7 +745,7 @@ DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest; DROP DATABASE mysqltest;
# #
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine, # Bug#19857 When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w # it results in NULL p/w
# #
@ -756,7 +761,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
--echo ---> connection: mysqltest_2_con --echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con --connection mysqltest_2_con
use test; USE test;
DELIMITER //; DELIMITER //;
CREATE PROCEDURE sp19857() DETERMINISTIC CREATE PROCEDURE sp19857() DETERMINISTIC
@ -790,8 +795,7 @@ DROP USER user19857@localhost;
use test; use test;
# #
# BUG#18630: Arguments of suid routine calculated in wrong security # Bug#18630 Arguments of suid routine calculated in wrong security context
# context
# #
# Arguments of suid routines were calculated in definer's security # Arguments of suid routines were calculated in definer's security
# context instead of caller's context thus creating security hole. # context instead of caller's context thus creating security hole.
@ -862,3 +866,7 @@ DROP FUNCTION f_suid;
DROP TABLE t1; DROP TABLE t1;
--echo End of 5.0 tests. --echo End of 5.0 tests.
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,13 +4,17 @@
set @old_concurrent_insert= @@global.concurrent_insert; set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0; set @@global.concurrent_insert= 0;
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1,t3; drop table if exists t1,t3;
--enable_warnings --enable_warnings
delimiter |; delimiter |;
# #
# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error # Bug#4902 Stored procedure with SHOW WARNINGS leads to packet error
# #
# Added tests for show grants command # Added tests for show grants command
--disable_warnings --disable_warnings
@ -52,9 +56,8 @@ show warnings|
drop procedure bug4902_2| drop procedure bug4902_2|
# #
# BUG#3583: query cache doesn't work for stored procedures # Bug#3583 query cache doesn't work for stored procedures
# #
--disable_warnings --disable_warnings
drop table if exists t1| drop table if exists t1|
--enable_warnings --enable_warnings
@ -97,8 +100,9 @@ delete from t1|
drop procedure bug3583| drop procedure bug3583|
drop table t1| drop table t1|
# #
# BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY # Bug#6807 Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
# #
--disable_warnings --disable_warnings
drop procedure if exists bug6807| drop procedure if exists bug6807|
@ -112,16 +116,16 @@ begin
select 'Not reached'; select 'Not reached';
end| end|
--error 1317 --error ER_QUERY_INTERRUPTED
call bug6807()| call bug6807()|
--error 1317 --error ER_QUERY_INTERRUPTED
call bug6807()| call bug6807()|
drop procedure bug6807| drop procedure bug6807|
# #
# BUG#10100: function (and stored procedure?) recursivity problem # Bug#10100 function (and stored procedure?) recursivity problem
# #
--disable_warnings --disable_warnings
drop function if exists bug10100f| drop function if exists bug10100f|
@ -253,6 +257,7 @@ drop table t3|
delimiter ;| delimiter ;|
# #
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context # Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
# #
@ -269,6 +274,7 @@ call 15298_1();
call 15298_2(); call 15298_2();
connection default; connection default;
disconnect con1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
drop procedure 15298_1; drop procedure 15298_1;
drop procedure 15298_2; drop procedure 15298_2;
@ -334,6 +340,7 @@ connection default;
disconnect rl_holder; disconnect rl_holder;
disconnect rl_acquirer; disconnect rl_acquirer;
disconnect rl_wait; disconnect rl_wait;
disconnect rl_contender;
drop procedure p1; drop procedure p1;
drop table t1; drop table t1;
set session low_priority_updates=default; set session low_priority_updates=default;
@ -343,3 +350,7 @@ set session low_priority_updates=default;
# #
set @@global.concurrent_insert= @old_concurrent_insert; set @@global.concurrent_insert= @old_concurrent_insert;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
-- source include/have_ssl.inc -- source include/have_ssl.inc
-- source include/big_test.inc -- source include/big_test.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
--enable_warnings --enable_warnings
@ -53,4 +56,9 @@ while ($count)
connect (ssl_con,localhost,root,,,,,SSL); connect (ssl_con,localhost,root,,,,,SSL);
drop table t1; drop table t1;
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -3,6 +3,9 @@
-- source include/have_ssl.inc -- source include/have_ssl.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_con,localhost,root,,,,,SSL); connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on # Check ssl turned on
@ -14,4 +17,9 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl turned on # Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
-- source include/have_ssl.inc -- source include/have_ssl.inc
-- source include/have_compress.inc -- source include/have_compress.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS); connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on # Check ssl turned on
@ -20,3 +23,10 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on # Check compression turned on
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
connection default;
disconnect ssl_compress_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -268,6 +268,7 @@ show status like 'Com%function';
# #
connect (root, localhost, root,,test); connect (root, localhost, root,,test);
connection root; connection root;
let $root_connection_id= `select connection_id()`;
--disable_warnings --disable_warnings
create database db37908; create database db37908;
--enable_warnings --enable_warnings
@ -282,6 +283,7 @@ delimiter ;|
connect (user1,localhost,mysqltest_1,,test); connect (user1,localhost,mysqltest_1,,test);
connection user1; connection user1;
let $user1_connection_id= `select connection_id()`;
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
select * from db37908.t1; select * from db37908.t1;
@ -300,8 +302,12 @@ drop procedure proc37908;
drop function func37908; drop function func37908;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
# Wait till we reached the initial number of concurrent sessions # Wait till the sessions user1 and root are disconnected
--source include/wait_until_count_sessions.inc let $wait_condition =
SELECT COUNT(*) = 0
FROM information_schema.processlist
WHERE id in ('$root_connection_id','$user1_connection_id');
--source include/wait_condition.inc
# #
# Bug#41131 "Questions" fails to increment - ignores statements instead stored procs # Bug#41131 "Questions" fails to increment - ignores statements instead stored procs

View File

@ -5,6 +5,9 @@
# Requires privileges to be enabled # Requires privileges to be enabled
--source include/not_embedded.inc --source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Prepare play-ground # Prepare play-ground
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,);
connection mqph; connection mqph;
select * from t1; select * from t1;
select * from t1; select * from t1;
--error 1226 --error ER_USER_LIMIT_REACHED
select * from t1; select * from t1;
connect (mqph2, localhost, mysqltest_1,,); connect (mqph2, localhost, mysqltest_1,,);
connection mqph2; connection mqph2;
--error 1226 --error ER_USER_LIMIT_REACHED
select * from t1; select * from t1;
# cleanup # cleanup
connection default; connection default;
@ -50,12 +53,12 @@ select * from t1;
select * from t1; select * from t1;
delete from t1; delete from t1;
delete from t1; delete from t1;
--error 1226 --error ER_USER_LIMIT_REACHED
delete from t1; delete from t1;
select * from t1; select * from t1;
connect (muph2, localhost, mysqltest_1,,); connect (muph2, localhost, mysqltest_1,,);
connection muph2; connection muph2;
--error 1226 --error ER_USER_LIMIT_REACHED
delete from t1; delete from t1;
select * from t1; select * from t1;
# Cleanup # Cleanup
@ -74,7 +77,7 @@ connect (mcph2, localhost, mysqltest_1,,);
connection mcph2; connection mcph2;
select * from t1; select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226 --error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,); connect (mcph3, localhost, mysqltest_1,,);
# Old connection is still ok # Old connection is still ok
select * from t1; select * from t1;
@ -83,7 +86,7 @@ select * from t1;
disconnect mcph1; disconnect mcph1;
disconnect mcph2; disconnect mcph2;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226 --error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,); connect (mcph3, localhost, mysqltest_1,,);
# Cleanup # Cleanup
connection default; connection default;
@ -101,7 +104,7 @@ connect (muc2, localhost, mysqltest_1,,);
connection muc2; connection muc2;
select * from t1; select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226 --error ER_USER_LIMIT_REACHED
connect (muc3, localhost, mysqltest_1,,); connect (muc3, localhost, mysqltest_1,,);
# Closing of one of connections should help # Closing of one of connections should help
disconnect muc1; disconnect muc1;
@ -115,7 +118,7 @@ connect (muc4, localhost, mysqltest_1,,);
connection muc4; connection muc4;
select * from t1; select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226 --error ER_USER_LIMIT_REACHED
connect (muc5, localhost, mysqltest_1,,); connect (muc5, localhost, mysqltest_1,,);
# Clean up # Clean up
connection default; connection default;
@ -129,7 +132,7 @@ drop user mysqltest_1@localhost;
select @@session.max_user_connections, @@global.max_user_connections; select @@session.max_user_connections, @@global.max_user_connections;
# Local max_user_connections variable can't be set directly # Local max_user_connections variable can't be set directly
# since this limit is per-account # since this limit is per-account
--error 1229 --error ER_GLOBAL_VARIABLE
set session max_user_connections= 2; set session max_user_connections= 2;
# But it is ok to set global max_user_connections # But it is ok to set global max_user_connections
set global max_user_connections= 2; set global max_user_connections= 2;
@ -144,7 +147,7 @@ connect (muca2, localhost, mysqltest_1,,);
connection muca2; connection muca2;
select * from t1; select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1203 --error ER_TOO_MANY_USER_CONNECTIONS
connect (muca3, localhost, mysqltest_1,,); connect (muca3, localhost, mysqltest_1,,);
# Now we are testing that per-account limit prevails over gloabl limit # Now we are testing that per-account limit prevails over gloabl limit
connection default; connection default;
@ -154,7 +157,7 @@ connect (muca3, localhost, mysqltest_1,,);
connection muca3; connection muca3;
select @@session.max_user_connections, @@global.max_user_connections; select @@session.max_user_connections, @@global.max_user_connections;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226 --error ER_USER_LIMIT_REACHED
connect (muca4, localhost, mysqltest_1,,); connect (muca4, localhost, mysqltest_1,,);
# Cleanup # Cleanup
connection default; connection default;
@ -167,3 +170,7 @@ drop user mysqltest_1@localhost;
# Final cleanup # Final cleanup
drop table t1; drop table t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,9 @@
# Can't test with embedded server # Can't test with embedded server
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop database if exists mysqltest; drop database if exists mysqltest;
drop view if exists v1,v2,v3; drop view if exists v1,v2,v3;
@ -36,15 +39,15 @@ connection user1;
create definer=root@localhost view v1 as select * from mysqltest.t1; create definer=root@localhost view v1 as select * from mysqltest.t1;
create view v1 as select * from mysqltest.t1; create view v1 as select * from mysqltest.t1;
# try to modify view without DROP privilege on it # try to modify view without DROP privilege on it
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
alter view v1 as select * from mysqltest.t1; alter view v1 as select * from mysqltest.t1;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
create or replace view v1 as select * from mysqltest.t1; create or replace view v1 as select * from mysqltest.t1;
# no CRETE VIEW privilege # no CRETE VIEW privilege
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v2 as select * from mysqltest.t1; create view mysqltest.v2 as select * from mysqltest.t1;
# no SELECT privilege # no SELECT privilege
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
create view v2 as select * from mysqltest.t2; create view v2 as select * from mysqltest.t2;
connection root; connection root;
@ -54,7 +57,7 @@ show create view v1;
grant create view,drop,select on test.* to mysqltest_1@localhost; grant create view,drop,select on test.* to mysqltest_1@localhost;
connection user1; connection user1;
# following 'use' command is workaround of bug #9582 and should be removed # following 'use' command is workaround of Bug#9582 and should be removed
# when that bug will be fixed # when that bug will be fixed
use test; use test;
alter view v1 as select * from mysqltest.t1; alter view v1 as select * from mysqltest.t1;
@ -82,7 +85,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1; connection user1;
select c from mysqltest.v1; select c from mysqltest.v1;
# there are no privileges on column 'd' # there are no privileges on column 'd'
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1; select d from mysqltest.v1;
connection root; connection root;
@ -102,7 +105,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1; connection user1;
select c from mysqltest.v1; select c from mysqltest.v1;
# there are no privileges on column 'd' # there are no privileges on column 'd'
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1; select d from mysqltest.v1;
connection root; connection root;
@ -139,21 +142,21 @@ select c from mysqltest.v4;
show columns from mysqltest.v1; show columns from mysqltest.v1;
show columns from mysqltest.v2; show columns from mysqltest.v2;
# but explain/show do not # but explain/show do not
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v1; explain select c from mysqltest.v1;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1; show create view mysqltest.v1;
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v2; explain select c from mysqltest.v2;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2; show create view mysqltest.v2;
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3; explain select c from mysqltest.v3;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3; show create view mysqltest.v3;
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4; explain select c from mysqltest.v4;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4; show create view mysqltest.v4;
# allow to see one of underlying table # allow to see one of underlying table
@ -162,19 +165,19 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
connection user1; connection user1;
# EXPLAIN of view on above table works # EXPLAIN of view on above table works
explain select c from mysqltest.v1; explain select c from mysqltest.v1;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1; show create view mysqltest.v1;
explain select c from mysqltest.v2; explain select c from mysqltest.v2;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2; show create view mysqltest.v2;
# but other EXPLAINs do not # but other EXPLAINs do not
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3; explain select c from mysqltest.v3;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3; show create view mysqltest.v3;
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4; explain select c from mysqltest.v4;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4; show create view mysqltest.v4;
# allow to see any view in mysqltest database # allow to see any view in mysqltest database
@ -228,14 +231,14 @@ select * from t1;
update v2 set a=a+c; update v2 set a=a+c;
select * from t1; select * from t1;
# no rights on column # no rights on column
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c; update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
update v2 set c=a+c; update v2 set c=a+c;
# no rights for view # no rights for view
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c; update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update v3 set a=a+c; update v3 set a=a+c;
use test; use test;
@ -269,9 +272,9 @@ select * from t1;
delete v1 from t2,v1 where t2.x=v1.c; delete v1 from t2,v1 where t2.x=v1.c;
select * from t1; select * from t1;
# no rights for view # no rights for view
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
delete v2 from t2,v2 where t2.x=v2.c; delete v2 from t2,v2 where t2.x=v2.c;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
delete from v2 where c < 4; delete from v2 where c < 4;
use test; use test;
@ -305,9 +308,9 @@ select * from t1;
insert into v1 select x,y from t2; insert into v1 select x,y from t2;
select * from t1; select * from t1;
# no rights for view # no rights for view
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
insert into v2 values (5,6); insert into v2 values (5,6);
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
insert into v2 select x,y from t2; insert into v2 select x,y from t2;
use test; use test;
@ -335,10 +338,10 @@ connection user1;
create view v1 as select * from mysqltest.t1; create view v1 as select * from mysqltest.t1;
create view v2 as select b from mysqltest.t2; create view v2 as select b from mysqltest.t2;
# There are not rights on mysqltest.v1 # There are not rights on mysqltest.v1
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v1 as select * from mysqltest.t1; create view mysqltest.v1 as select * from mysqltest.t1;
# There are not any rights on mysqltest.t2.a # There are not any rights on mysqltest.t2.a
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
create view v3 as select a from mysqltest.t2; create view v3 as select a from mysqltest.t2;
# give CREATE VIEW privileges (without any privileges for result column) # give CREATE VIEW privileges (without any privileges for result column)
@ -358,13 +361,13 @@ create view mysqltest.v3 as select b from mysqltest.t2;
# Expression need select privileges # Expression need select privileges
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2; create view v4 as select b+1 from mysqltest.t2;
connection root; connection root;
grant create view,update,select on test.* to mysqltest_1@localhost; grant create view,update,select on test.* to mysqltest_1@localhost;
connection user1; connection user1;
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2; create view v4 as select b+1 from mysqltest.t2;
connection root; connection root;
@ -426,7 +429,7 @@ drop view v1;
drop database mysqltest; drop database mysqltest;
# #
# rights on execution of view underlying functiond (BUG#9505) # rights on execution of view underlying functiond (Bug#9505)
# #
connection root; connection root;
--disable_warnings --disable_warnings
@ -610,7 +613,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest; drop database mysqltest;
# #
# BUG#14256: definer in view definition is not fully qualified # Bug#14256 definer in view definition is not fully qualified
# #
--disable_warnings --disable_warnings
drop view if exists v1; drop view if exists v1;
@ -647,6 +650,7 @@ drop view v1;
select @v1def1, @v1def2, @v1def1=@v1def2; select @v1def1, @v1def2, @v1def1=@v1def2;
connection root; connection root;
disconnect test14256;
drop user test14256; drop user test14256;
# Restore the anonymous users. # Restore the anonymous users.
@ -656,8 +660,8 @@ flush privileges;
drop table t1; drop table t1;
# #
# BUG#14726: freeing stack variable in case of an error of opening # Bug#14726 freeing stack variable in case of an error of opening a view when
# a view when we have locked tables with LOCK TABLES statement. # we have locked tables with LOCK TABLES statement.
# #
connection root; connection root;
--disable_warnings --disable_warnings
@ -685,7 +689,7 @@ drop user mysqltest_1@localhost;
drop database mysqltest; drop database mysqltest;
# #
# switch to default connaction # switch to default connection
# #
disconnect user1; disconnect user1;
disconnect root; disconnect root;
@ -702,7 +706,7 @@ drop view v1;
drop view v2; drop view v2;
# #
# Bug#18681: View privileges are broken # Bug#18681 View privileges are broken
# #
CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest1;
CREATE USER readonly@localhost; CREATE USER readonly@localhost;
@ -723,54 +727,55 @@ GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
GRANT DELETE ON mysqltest1.v_td TO readonly@localhost; GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost; GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
CONNECT (n1,localhost,readonly,,); connect (n1,localhost,readonly,,);
CONNECTION n1; connection n1;
--error 1356 --error ER_VIEW_INVALID
SELECT * FROM mysqltest1.v_t1; SELECT * FROM mysqltest1.v_t1;
--error 1356 --error ER_VIEW_INVALID
INSERT INTO mysqltest1.v_t1 VALUES(4); INSERT INTO mysqltest1.v_t1 VALUES(4);
--error 1356 --error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1 WHERE x = 1; DELETE FROM mysqltest1.v_t1 WHERE x = 1;
--error 1356 --error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2; UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
--error 1356 --error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3; UPDATE mysqltest1.v_t1 SET x = 3;
--error 1356 --error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1; DELETE FROM mysqltest1.v_t1;
--error 1356 --error ER_VIEW_INVALID
SELECT 1 FROM mysqltest1.v_t1; SELECT 1 FROM mysqltest1.v_t1;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.t1; SELECT * FROM mysqltest1.t1;
SELECT * FROM mysqltest1.v_ts; SELECT * FROM mysqltest1.v_ts;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x; SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ti; SELECT * FROM mysqltest1.v_ti;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
INSERT INTO mysqltest1.v_ts VALUES (100); INSERT INTO mysqltest1.v_ts VALUES (100);
INSERT INTO mysqltest1.v_ti VALUES (100); INSERT INTO mysqltest1.v_ti VALUES (100);
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100; UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200; UPDATE mysqltest1.v_ts SET x= 200;
UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100; UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100; UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tu SET x= 200; UPDATE mysqltest1.v_tu SET x= 200;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts WHERE x= 200; DELETE FROM mysqltest1.v_ts WHERE x= 200;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts; DELETE FROM mysqltest1.v_ts;
--error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_td WHERE x= 200; DELETE FROM mysqltest1.v_td WHERE x= 200;
DELETE FROM mysqltest1.v_tds WHERE x= 200; DELETE FROM mysqltest1.v_tds WHERE x= 200;
DELETE FROM mysqltest1.v_td; DELETE FROM mysqltest1.v_td;
CONNECTION default; connection default;
disconnect n1;
DROP VIEW mysqltest1.v_tds; DROP VIEW mysqltest1.v_tds;
DROP VIEW mysqltest1.v_td; DROP VIEW mysqltest1.v_td;
DROP VIEW mysqltest1.v_tus; DROP VIEW mysqltest1.v_tus;
@ -783,21 +788,21 @@ DROP USER readonly@localhost;
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
# #
# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail # Bug#14875 Bad view DEFINER makes SHOW CREATE VIEW fail
# #
CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1; CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
#--warning 1448 #--warning ER_VIEW_OTHER_USER
SHOW CREATE VIEW v; SHOW CREATE VIEW v;
--error 1449 --error ER_NO_SUCH_USER
SELECT * FROM v; SELECT * FROM v;
DROP VIEW v; DROP VIEW v;
DROP TABLE t1; DROP TABLE t1;
USE test; USE test;
# #
# Bug#20363: Create view on just created view is now denied # Bug#20363 Create view on just created view is now denied
# #
eval CREATE USER mysqltest_db1@localhost identified by 'PWD'; eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION; eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
@ -828,6 +833,7 @@ SELECT * FROM view2;
SELECT * from view3; SELECT * from view3;
connection default; connection default;
disconnect session1;
DROP VIEW mysqltest_db1.view3; DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2; DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1; DROP VIEW mysqltest_db1.view1;
@ -835,7 +841,7 @@ DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1; DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost; DROP USER mysqltest_db1@localhost;
# #
# BUG#20482: failure on Create join view with sources views/tables # Bug#20482 failure on Create join view with sources views/tables
# in different schemas # in different schemas
# #
--disable_warnings --disable_warnings
@ -857,8 +863,8 @@ DROP DATABASE test1;
# #
# BUG#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER # Bug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
# returns invoker name # invoker name
# #
--disable_warnings --disable_warnings
DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1;
@ -917,7 +923,7 @@ DROP USER mysqltest_u1@localhost;
# #
# Bug#17254: Error for DEFINER security on VIEW provides too much info # Bug#17254 Error for DEFINER security on VIEW provides too much info
# #
connect (root,localhost,root,,); connect (root,localhost,root,,);
connection root; connection root;
@ -941,12 +947,12 @@ DROP USER def_17254@localhost;
connect (inv,localhost,inv_17254,,db17254); connect (inv,localhost,inv_17254,,db17254);
connection inv; connection inv;
--echo for a user --echo for a user
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM v1; SELECT * FROM v1;
connection root; connection root;
--echo for a superuser --echo for a superuser
--error 1449 --error ER_NO_SUCH_USER
SELECT * FROM v1; SELECT * FROM v1;
DROP USER inv_17254@localhost; DROP USER inv_17254@localhost;
DROP DATABASE db17254; DROP DATABASE db17254;
@ -955,7 +961,7 @@ disconnect inv;
# #
# BUG#24404: strange bug with view+permission+prepared statement # Bug#24404 strange bug with view+permission+prepared statement
# #
--disable_warnings --disable_warnings
DROP DATABASE IF EXISTS mysqltest_db1; DROP DATABASE IF EXISTS mysqltest_db1;
@ -1023,7 +1029,7 @@ DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost; DROP USER mysqltest_u2@localhost;
# #
# Bug#26813: The SUPER privilege is wrongly required to alter a view created # Bug#26813 The SUPER privilege is wrongly required to alter a view created
# by another user. # by another user.
# #
connection root; connection root;
@ -1056,7 +1062,7 @@ DROP DATABASE db26813;
disconnect u1; disconnect u1;
--echo # --echo #
--echo # Bug#29908: A user can gain additional access through the ALTER VIEW. --echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
--echo # --echo #
connection root; connection root;
CREATE DATABASE mysqltest_29908; CREATE DATABASE mysqltest_29908;
@ -1101,7 +1107,7 @@ disconnect u2;
--echo ####################################################################### --echo #######################################################################
# #
# BUG#24040: Create View don't succed with "all privileges" on a database. # Bug#24040 Create View don't succed with "all privileges" on a database.
# #
# Prepare. # Prepare.
@ -1185,7 +1191,7 @@ SELECT * FROM mysqltest1.t4;
# Cleanup. # Cleanup.
-- disconnect bug24040_con disconnect bug24040_con;
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2; DROP DATABASE mysqltest2;
@ -1193,7 +1199,7 @@ DROP USER mysqltest_u1@localhost;
# #
# Bug #41354: Access control is bypassed when all columns of a view are # Bug#41354 Access control is bypassed when all columns of a view are
# selected by * wildcard # selected by * wildcard
CREATE DATABASE db1; CREATE DATABASE db1;
@ -1208,7 +1214,6 @@ connect (addconfoo, localhost, foo,,);
connection addconfoo; connection addconfoo;
USE db1; USE db1;
SELECT f1 FROM t1; SELECT f1 FROM t1;
--error ER_COLUMNACCESS_DENIED_ERROR --error ER_COLUMNACCESS_DENIED_ERROR
SELECT f2 FROM t1; SELECT f2 FROM t1;
@ -1222,8 +1227,9 @@ SELECT f2 FROM v1;
SELECT * FROM v1; SELECT * FROM v1;
connection default; connection default;
USE test; disconnect root;
disconnect addconfoo; disconnect addconfoo;
USE test;
REVOKE SELECT (f1) ON db1.t1 FROM foo; REVOKE SELECT (f1) ON db1.t1 FROM foo;
REVOKE SELECT (f1) ON db1.v1 FROM foo; REVOKE SELECT (f1) ON db1.v1 FROM foo;
DROP USER foo; DROP USER foo;
@ -1332,7 +1338,7 @@ DROP DATABASE mysqltest1;
DROP USER mysqluser1@localhost; DROP USER mysqluser1@localhost;
# #
# Bug#35600: Security breach via view, I_S table and prepared # Bug#35600 Security breach via view, I_S table and prepared
# statement/stored procedure # statement/stored procedure
# #
CREATE USER mysqluser1@localhost; CREATE USER mysqluser1@localhost;
@ -1374,3 +1380,8 @@ DROP VIEW v1, v2;
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
DROP VIEW test.v3; DROP VIEW test.v3;
DROP USER mysqluser1@localhost; DROP USER mysqluser1@localhost;
USE test;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -10,8 +10,11 @@
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/one_thread_per_connection.inc -- source include/one_thread_per_connection.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# #
# Bug#8731: wait_timeout does not work on Mac OS X # Bug#8731 wait_timeout does not work on Mac OS X
# #
let $start_value= `SELECT @@global.wait_timeout`; let $start_value= `SELECT @@global.wait_timeout`;
@ -113,6 +116,7 @@ while (!`select @aborted_clients`)
# the disconnect has reached client # the disconnect has reached client
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist; let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist;
--source include/wait_condition.inc --source include/wait_condition.inc
disconnect wait_con;
--echo connection con1; --echo connection con1;
connection con1; connection con1;
@ -126,8 +130,13 @@ SELECT 2;
SELECT 3; SELECT 3;
--replace_result $start_value <start_value> --replace_result $start_value <start_value>
eval SET @@global.wait_timeout= $start_value; eval SET @@global.wait_timeout= $start_value;
# ML: The start value might be changed in future ...
--echo disconnection con1; --echo disconnection con1;
disconnect con1; disconnect con1;
# The last connect is to keep tools checking the current test happy.
connect (default,localhost,root,,test,,);
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -2,6 +2,10 @@
# WL#1756 # WL#1756
# #
-- source include/have_innodb.inc -- source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
@ -14,10 +18,10 @@ xa rollback 'test1';
select * from t1; select * from t1;
xa start 'test2'; xa start 'test2';
--error 1399 --error ER_XAER_RMFAIL
xa start 'test-bad'; xa start 'test-bad';
insert t1 values (20); insert t1 values (20);
--error 1399 --error ER_XAER_RMFAIL
xa prepare 'test2'; xa prepare 'test2';
xa end 'test2'; xa end 'test2';
xa prepare 'test2'; xa prepare 'test2';
@ -27,22 +31,22 @@ select * from t1;
xa start 'testa','testb'; xa start 'testa','testb';
insert t1 values (30); insert t1 values (30);
--error 1399 --error ER_XAER_RMFAIL
commit; commit;
xa end 'testa','testb'; xa end 'testa','testb';
--error 1399 --error ER_XAER_RMFAIL
begin; begin;
--error 1399 --error ER_XAER_RMFAIL
create table t2 (a int); create table t2 (a int);
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connection con1; connection con1;
--error 1440 --error ER_XAER_DUPID
xa start 'testa','testb'; xa start 'testa','testb';
--error 1440 --error ER_XAER_DUPID
xa start 'testa','testb', 123; xa start 'testa','testb', 123;
# gtrid [ , bqual [ , formatID ] ] # gtrid [ , bqual [ , formatID ] ]
@ -51,7 +55,7 @@ insert t1 values (40);
xa end 'testb',' 0@P`',11; xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11; xa prepare 'testb',0x2030405060,11;
--error 1399 --error ER_XAER_RMFAIL
start transaction; start transaction;
xa recover; xa recover;
@ -64,11 +68,11 @@ xa prepare 'testa','testb';
xa recover; xa recover;
--error 1397 --error ER_XAER_NOTA
xa commit 'testb',0x2030405060,11; xa commit 'testb',0x2030405060,11;
xa rollback 'testa','testb'; xa rollback 'testa','testb';
--error 1064 --error ER_PARSE_ERROR
xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
select * from t1; select * from t1;
@ -119,3 +123,7 @@ xa start 'a','c';
drop table t1; drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc