Commit 140cc614 authored by Matthias Leich's avatar Matthias Leich

Last slice of fix for Bug#42003 tests missing the disconnect of connections <> default

+ Fix for Bug#43114 wait_until_count_sessions too restrictive, random PB failures
+ Removal of a lot of other weaknesses found
+ modifications according to review
parent e1a197ca
...@@ -2,11 +2,20 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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; ...@@ -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) ...@@ -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;
} }
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;
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;
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
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 98 master-bin.000001 98
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 98 master-bin.000001 98
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
drop table if exists t1; SET @old_concurrent_insert= @@global.concurrent_insert;
create table t1 (kill_id int); SET @@global.concurrent_insert= 0;
insert into t1 values(connection_id()); DROP TABLE IF EXISTS t1;
flush tables with read lock; CREATE TABLE t1 (kill_id INT);
select ((@id := kill_id) - kill_id) from t1; INSERT INTO t1 VALUES(connection_id());
FLUSH TABLES WITH READ LOCK;
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;
...@@ -51,10 +51,10 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock ...@@ -51,10 +51,10 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES; UNLOCK TABLES;
DROP DATABASE mysqltest_1; DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
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 ...@@ -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;
...@@ -93,7 +93,7 @@ create table t1 (a int); ...@@ -93,7 +93,7 @@ create table t1 (a int);
connection: locker connection: locker
lock tables t1 read; lock tables t1 read;
connection: writer connection: writer
create table t2 like t1;; create table t2 like t1;
connection: default connection: default
kill query kill query
ERROR 70100: Query execution was interrupted ERROR 70100: Query execution was interrupted
......
...@@ -349,17 +349,17 @@ DELIMITER ; ...@@ -349,17 +349,17 @@ 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;
# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED # Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
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
End of 5.0 tests End of 5.0 tests
...@@ -47,7 +47,7 @@ Note 1051 Unknown table 'ttt' ...@@ -47,7 +47,7 @@ Note 1051 Unknown table 'ttt'
drop table t1,t2; drop table t1,t2;
drop user test@localhost; drop user test@localhost;
# #
# Bug #27440 read_only allows create and drop database # Bug#27440 read_only allows create and drop database
# #
drop database if exists mysqltest_db1; drop database if exists mysqltest_db1;
drop database if exists mysqltest_db2; drop database if exists mysqltest_db2;
......
...@@ -5,10 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255' ...@@ -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>
...@@ -332,7 +332,7 @@ ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table ...@@ -332,7 +332,7 @@ ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table
drop user user_bug14533@localhost; drop user user_bug14533@localhost;
drop database db_bug14533; drop database db_bug14533;
CREATE DATABASE db_bug7787; CREATE DATABASE db_bug7787;
use db_bug7787; USE db_bug7787;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
SHOW INNODB STATUS; SHOW INNODB STATUS;
Warnings: Warnings:
...@@ -352,12 +352,12 @@ GRANT SUPER ON *.* TO mysqltest_2@localhost; ...@@ -352,12 +352,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;
...@@ -373,7 +373,7 @@ Warnings: ...@@ -373,7 +373,7 @@ Warnings:
Note 1449 There is no 'a @ b @ c'@'localhost' registered Note 1449 There is no 'a @ b @ c'@'localhost' registered
---> connection: con1root ---> connection: con1root
use mysqltest; USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1; SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure Procedure sql_mode Create Procedure
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`() wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
...@@ -403,7 +403,7 @@ CREATE USER mysqltest_2@localhost; ...@@ -403,7 +403,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
...@@ -416,7 +416,7 @@ bug13198_f1() ...@@ -416,7 +416,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
...@@ -428,7 +428,7 @@ bug13198_f1() ...@@ -428,7 +428,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: There is no 'mysqltest_1'@'localhost' registered ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
SELECT bug13198_f1(); SELECT bug13198_f1();
...@@ -445,7 +445,7 @@ Host User Password ...@@ -445,7 +445,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;
......
...@@ -3603,7 +3603,7 @@ DROP VIEW v2; ...@@ -3603,7 +3603,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);
...@@ -3643,7 +3643,7 @@ MAX(a) COUNT(DISTINCT a) ...@@ -3643,7 +3643,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;
...@@ -3660,7 +3660,7 @@ DROP TABLE t1; ...@@ -3660,7 +3660,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
# ----------------------------------------------------------------- # -----------------------------------------------------------------
......
...@@ -788,7 +788,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI ...@@ -788,7 +788,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;
......
# In order to be more or less robust test for bug#25044 has to take # In order to be more or less robust test for Bug#25044 has to take
# significant time (e.g. about 9 seconds on my (Dmitri's) computer) # significant time (e.g. about 9 seconds on my (Dmitri's) computer)
# so we probably want execute it only in --big-test mode. # so we probably want execute it only in --big-test mode.
# Also in 5.1 this test will require statement-based binlog. # Also in 5.1 this test will require statement-based binlog.
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
# #
# 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.
...@@ -57,6 +57,7 @@ show binlog events in 'master-bin.000001' from 98; ...@@ -57,6 +57,7 @@ show binlog events in 'master-bin.000001' from 98;
# 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
...@@ -18,12 +18,16 @@ connect (con2,localhost,root,,test); ...@@ -18,12 +18,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";
...@@ -35,20 +39,23 @@ show tables; ...@@ -35,20 +39,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;
...@@ -57,30 +64,34 @@ connect (con10,localhost,test,gambling2,); ...@@ -57,30 +64,34 @@ 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;
...@@ -98,4 +109,9 @@ disconnect con7; ...@@ -98,4 +109,9 @@ disconnect con7;
connection default; connection default;
drop table t1; drop table t1;
--disconnect con1
--disconnect con2
--disconnect con3
--disconnect con4
# End of 4.1 tests # End of 4.1 tests
-- 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
# 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; ...@@ -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
...@@ -4,74 +4,106 @@ ...@@ -4,74 +4,106 @@
# This is intended to mimick how mysqldump and innobackup work. # This is intended to mimick how mysqldump and innobackup work.
# 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
BEGIN;
SELECT * FROM t1;
SHOW CREATE DATABASE test;
# BUG#7358 SHOW CREATE DATABASE fails if open transaction DROP TABLE t1;
begin;
select * from t1;
show create database test;
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
...@@ -3,32 +3,51 @@ ...@@ -3,32 +3,51 @@
# We verify that we did not introduce a deadlock. # We verify that we did not introduce a deadlock.
# This is intended to mimick how mysqldump and innobackup work. # This is intended to mimick how mysqldump and innobackup work.
-- source include/have_log_bin.inc --source include/have_log_bin.inc
# And it requires InnoDB # And it requires InnoDB
-- 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
...@@ -8,19 +8,27 @@ ...@@ -8,19 +8,27 @@
# won't test anything interesting). # won't test anything interesting).
# This also won't work with the embedded server test # This also won't work with the embedded server test
-- source include/not_embedded.inc --source include/not_embedded.inc
-- 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
# connection id which was inserted into a table by another thread.
SET @old_concurrent_insert= @@global.concurrent_insert;
SET @@global.concurrent_insert= 0;
connect (con1,localhost,root,,); 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
...@@ -28,14 +36,14 @@ insert into t1 values(connection_id()); ...@@ -28,14 +36,14 @@ 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;
--sleep 2 # leave time for FLUSH to block --sleep 2 # leave time for FLUSH to block
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
...@@ -46,4 +54,13 @@ connection con1; ...@@ -46,4 +54,13 @@ connection con1;
reap; reap;
connection con2; connection con2;
drop table t1; DROP TABLE t1;
connection default;
disconnect con2;
# Restore global concurrent_insert value
SET @@global.concurrent_insert= @old_concurrent_insert;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
...@@ -5,6 +5,9 @@ ...@@ -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,,); ...@@ -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'"; ...@@ -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
This diff is collapsed.
...@@ -104,7 +104,7 @@ select "--- --position --" as ""; ...@@ -104,7 +104,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=231 --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=231 --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
...@@ -118,7 +118,7 @@ select "--- reading stdin --" as ""; ...@@ -118,7 +118,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
...@@ -174,7 +174,7 @@ delimiter ;// ...@@ -174,7 +174,7 @@ delimiter ;//
flush logs; flush logs;
call p1(); call p1();
drop procedure p1; drop procedure p1;
--error 1305 --error ER_SP_DOES_NOT_EXIST
call p1(); call p1();
--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 $MYSQLTEST_VARDIR/log/master-bin.000007 --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
...@@ -222,35 +222,36 @@ flush logs; ...@@ -222,35 +222,36 @@ 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;
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g' --exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
# #
# 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 $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql --exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
drop table t1; 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 < $MYSQLTEST_VARDIR/tmp/bug29928.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql --remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
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;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -6,6 +6,9 @@ ...@@ -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
...@@ -1436,7 +1439,7 @@ select "this will be executed"; ...@@ -1436,7 +1439,7 @@ select "this will be executed";
remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result; remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result;
--error 0,1 --error 0,1
remove_file $MYSQLTEST_VARDIR/log/zero_length_file.reject; remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.reject;
--error 0,1 --error 0,1
remove_file $MYSQL_TEST_DIR/r/zero_length_file.reject; remove_file $MYSQL_TEST_DIR/r/zero_length_file.reject;
...@@ -2126,3 +2129,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir; ...@@ -2126,3 +2129,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--echo End of tests --echo End of tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,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
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,t2,t3; DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings --enable_warnings
...@@ -40,24 +43,24 @@ connection con1; ...@@ -40,24 +43,24 @@ connection con1;
select @@global.read_only; select @@global.read_only;
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
create table t3 (a int); create table t3 (a int);
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1); insert into t1 values(1);
# if a statement, after parse stage, looks like it will update a # if a statement, after parse stage, looks like it will update a
# non-temp table, it will be rejected, even if at execution it would # non-temp table, it will be rejected, even if at execution it would
# have turned out that 0 rows would be updated # have turned out that 0 rows would be updated
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
update t1 set a=1 where 1=0; update t1 set a=1 where 1=0;
# multi-update is special (see sql_parse.cc) so we test it # multi-update is special (see sql_parse.cc) so we test it
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a; update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
# check multi-delete to be sure # check multi-delete to be sure
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
delete t1,t2 from t1,t2 where t1.a=t2.a; delete t1,t2 from t1,t2 where t1.a=t2.a;
# With temp tables updates should be accepted: # With temp tables updates should be accepted:
...@@ -71,7 +74,7 @@ insert into t3 values(1); ...@@ -71,7 +74,7 @@ insert into t3 values(1);
insert into t4 select * from t3; insert into t4 select * from t3;
# a non-temp table updated: # a non-temp table updated:
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a; update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
# no non-temp table updated (just swapped): # no non-temp table updated (just swapped):
...@@ -79,7 +82,7 @@ update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a; ...@@ -79,7 +82,7 @@ update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a; update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
delete t1 from t1,t3 where t1.a=t3.a; delete t1 from t1,t3 where t1.a=t3.a;
delete t3 from t1,t3 where t1.a=t3.a; delete t3 from t1,t3 where t1.a=t3.a;
...@@ -98,11 +101,11 @@ delete t1 from t1,t3 where t1.a=t3.a; ...@@ -98,11 +101,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
drop table t1; drop table t1;
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1); insert into t1 values(1);
# #
# 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
...@@ -114,11 +117,12 @@ drop temporary table ttt; ...@@ -114,11 +117,12 @@ drop temporary table ttt;
drop temporary table if exists ttt; drop temporary table if exists ttt;
connection default; connection default;
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 #
--disable_warnings --disable_warnings
drop database if exists mysqltest_db1; drop database if exists mysqltest_db1;
...@@ -151,3 +155,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%'; ...@@ -151,3 +155,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=0; set global read_only=0;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
# Uses GRANT commands that usually disabled in embedded server # Uses GRANT commands that usually disabled in embedded server
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# #
# Test of some show commands # Test of some show commands
# #
...@@ -33,7 +36,7 @@ check table t1 medium; ...@@ -33,7 +36,7 @@ check table t1 medium;
check table t1 extended; check table t1 extended;
show index from t1; show index from t1;
--disable_metadata --disable_metadata
--error 1062 --error ER_DUP_ENTRY
insert into t1 values (5,5,5); insert into t1 values (5,5,5);
--echo -- Here we enable metadata just to check that the collation of the --echo -- Here we enable metadata just to check that the collation of the
...@@ -191,14 +194,14 @@ show columns from t1; ...@@ -191,14 +194,14 @@ 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= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF; SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
######### hook for WL#1324 # ######### hook for WL#1324 #
--error 1103 --error ER_WRONG_TABLE_NAME
CREATE TABLE `a/b` (i INT); CREATE TABLE `a/b` (i INT);
# the above test should WORK when WL#1324 is done, # the above test should WORK when WL#1324 is done,
# it should be removed and # it should be removed and
...@@ -224,7 +227,7 @@ CREATE TABLE `a/b` (i INT); ...@@ -224,7 +227,7 @@ CREATE TABLE `a/b` (i INT);
#SHOW CREATE TABLE """a"; #SHOW CREATE TABLE """a";
#DROP TABLE """a"; #DROP TABLE """a";
# #
#Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection #Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
#set names latin1; #set names latin1;
#create database ``; #create database ``;
#create table ``.`` (a int) engine=heap; #create table ``.`` (a int) engine=heap;
...@@ -252,7 +255,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create; ...@@ -252,7 +255,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;
...@@ -313,7 +316,7 @@ show table status; ...@@ -313,7 +316,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;
...@@ -328,30 +331,33 @@ connect (con1,localhost,mysqltest_1,,mysqltest); ...@@ -328,30 +331,33 @@ 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;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
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;
...@@ -371,7 +377,7 @@ flush privileges; ...@@ -371,7 +377,7 @@ flush privileges;
#drop database ``; #drop database ``;
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was # Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
# specified during table creation, but not otherwise. (Bug #7235) # specified during table creation, but not otherwise. (Bug#7235)
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY; CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -402,7 +408,7 @@ ALTER TABLE t1 ENGINE=MEMORY; ...@@ -402,7 +408,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))
...@@ -412,7 +418,7 @@ show index from t1; ...@@ -412,7 +418,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,
...@@ -422,7 +428,7 @@ create table t1 ( ...@@ -422,7 +428,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;
...@@ -430,7 +436,7 @@ flush tables; ...@@ -430,7 +436,7 @@ flush tables;
system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ; system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/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 t1; drop table t1;
...@@ -438,7 +444,7 @@ drop table t1; ...@@ -438,7 +444,7 @@ drop table t1;
--echo End of 4.1 tests --echo End of 4.1 tests
# #
# 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.
CREATE TABLE txt1(a int); CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int); CREATE TABLE tyt2(a int);
...@@ -456,14 +462,14 @@ DROP TABLE txt1; ...@@ -456,14 +462,14 @@ DROP TABLE txt1;
DROP TABLE tyt2; DROP TABLE tyt2;
DROP TABLE urkunde; DROP TABLE urkunde;
# #
# 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;
# #
# 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
...@@ -543,7 +549,7 @@ SHOW COLUMNS FROM no_such_table; ...@@ -543,7 +549,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';
...@@ -555,7 +561,7 @@ select 1 from information_schema.tables limit 1; ...@@ -555,7 +561,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries'; show status like 'slow_queries';
# #
# 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.
# #
...@@ -821,10 +827,11 @@ SHOW CREATE TABLE mysqltest1.t1; ...@@ -821,10 +827,11 @@ SHOW CREATE TABLE mysqltest1.t1;
# Cleanup. # Cleanup.
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
--remove_file $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
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";
...@@ -840,7 +847,7 @@ select 1 from information_schema.tables limit 1; ...@@ -840,7 +847,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';
...@@ -865,3 +872,7 @@ show create table t1; ...@@ -865,3 +872,7 @@ show create table t1;
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
# 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 # 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 +9,13 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255'; ...@@ -9,12 +9,13 @@ 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;
...@@ -5,6 +5,9 @@ ...@@ -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); ...@@ -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(); ...@@ -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; ...@@ -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; ...@@ -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; ...@@ -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; ...@@ -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 ;| ...@@ -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; ...@@ -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,13 +551,13 @@ drop database db_bug14533; ...@@ -546,13 +551,13 @@ drop database db_bug14533;
# #
# BUG#7787: Stored procedures: improper warning for "grant execute" statement # Bug#7787 Stored procedures: improper warning for "grant execute" statement
# #
# Prepare. # Prepare.
CREATE DATABASE db_bug7787; CREATE DATABASE db_bug7787;
use db_bug7787; USE db_bug7787;
# Test. # Test.
...@@ -569,7 +574,7 @@ use test; ...@@ -569,7 +574,7 @@ use test;
# #
# 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
...@@ -614,7 +619,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost; ...@@ -614,7 +619,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;
...@@ -626,7 +631,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1; ...@@ -626,7 +631,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;
...@@ -652,7 +657,7 @@ CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3; ...@@ -652,7 +657,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;
...@@ -672,7 +677,7 @@ DROP DATABASE mysqltest; ...@@ -672,7 +677,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.
...@@ -702,7 +707,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost; ...@@ -702,7 +707,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;
...@@ -720,7 +725,7 @@ SELECT bug13198_f1(); ...@@ -720,7 +725,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();
...@@ -742,7 +747,7 @@ DROP USER mysqltest_1@localhost; ...@@ -742,7 +747,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();
...@@ -764,7 +769,7 @@ DROP DATABASE mysqltest; ...@@ -764,7 +769,7 @@ 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
# #
...@@ -780,7 +785,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857'; ...@@ -780,7 +785,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
...@@ -814,7 +819,7 @@ DROP USER user19857@localhost; ...@@ -814,7 +819,7 @@ DROP USER user19857@localhost;
# #
# 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
...@@ -886,3 +891,7 @@ DROP FUNCTION f_suid; ...@@ -886,3 +891,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
# Can't test with embedded server # Can't test with embedded server
-- source include/not_embedded.inc -- source include/not_embedded.inc
--sleep 2 # 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
...@@ -47,7 +50,7 @@ drop procedure bug4902_2| ...@@ -47,7 +50,7 @@ drop procedure bug4902_2|
# #
# BUG#5278: Stored procedure packets out of order if SET PASSWORD. # Bug#5278: Stored procedure packets out of order if SET PASSWORD.
# #
--disable_warnings --disable_warnings
drop function if exists bug5278| drop function if exists bug5278|
...@@ -58,13 +61,16 @@ begin ...@@ -58,13 +61,16 @@ begin
return 'okay'; return 'okay';
end| end|
--error 1133 --error ER_PASSWORD_NO_MATCH
select bug5278()| select bug5278()|
--error 1133 --error ER_PASSWORD_NO_MATCH
select bug5278()| select bug5278()|
drop function bug5278| drop function bug5278|
#
# 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
...@@ -72,9 +78,6 @@ create table t1 ( ...@@ -72,9 +78,6 @@ create table t1 (
id char(16) not null default '', id char(16) not null default '',
data int not null data int not null
)| )|
#
# BUG#3583: query cache doesn't work for stored procedures
#
--disable_warnings --disable_warnings
drop procedure if exists bug3583| drop procedure if exists bug3583|
--enable_warnings --enable_warnings
...@@ -110,8 +113,9 @@ delete from t1| ...@@ -110,8 +113,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|
...@@ -125,16 +129,16 @@ begin ...@@ -125,16 +129,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|
...@@ -233,11 +237,11 @@ begin ...@@ -233,11 +237,11 @@ begin
close c; close c;
end| end|
#end of the stack checking # end of the stack checking
set @@max_sp_recursion_depth=255| set @@max_sp_recursion_depth=255|
set @var=1| set @var=1|
#disable log because error about stack overrun contains numbers which # disable log because error about stack overrun contains numbers which
#depend on a system # depend on a system
-- disable_result_log -- disable_result_log
-- error ER_STACK_OVERRUN_NEED_MORE -- error ER_STACK_OVERRUN_NEED_MORE
call bug10100p(255, @var)| call bug10100p(255, @var)|
...@@ -266,6 +270,7 @@ drop table t3| ...@@ -266,6 +270,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
# #
...@@ -282,6 +287,11 @@ call 15298_1(); ...@@ -282,6 +287,11 @@ 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;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
...@@ -4,12 +4,15 @@ ...@@ -4,12 +4,15 @@
-- 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
# #
# Bug #29579 Clients using SSL can hang the server # Bug#29579 Clients using SSL can hang the server
# #
connect (ssl_con,localhost,root,,,,,SSL); connect (ssl_con,localhost,root,,,,,SSL);
...@@ -53,4 +56,9 @@ while ($count) ...@@ -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
...@@ -3,6 +3,9 @@ ...@@ -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'; ...@@ -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
...@@ -4,6 +4,9 @@ ...@@ -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'; ...@@ -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
# embedded server causes different stat # embedded server causes different stat
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# PS causes different statistics # PS causes different statistics
--disable_ps_protocol --disable_ps_protocol
...@@ -208,3 +211,7 @@ DROP PROCEDURE p1; ...@@ -208,3 +211,7 @@ DROP PROCEDURE p1;
DROP FUNCTION f1; DROP FUNCTION f1;
# End of 5.0 tests # End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
# #
# 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
...@@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,); ...@@ -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; ...@@ -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,,); ...@@ -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; ...@@ -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,,); ...@@ -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,,); ...@@ -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; ...@@ -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,,); ...@@ -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,,); ...@@ -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; ...@@ -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
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
-- source include/not_embedded.inc -- source include/not_embedded.inc
# #
# Bug #8731: wait_timeout does not work on Mac OS X # Bug#8731 wait_timeout does not work on Mac OS X
# #
...@@ -87,6 +87,7 @@ while (!`select @aborted_clients`) ...@@ -87,6 +87,7 @@ while (!`select @aborted_clients`)
} }
} }
--enable_query_log --enable_query_log
disconnect wait_con;
connection con1; connection con1;
# When the connection is closed in this way, the error code should # When the connection is closed in this way, the error code should
...@@ -97,3 +98,5 @@ select 2; ...@@ -97,3 +98,5 @@ select 2;
--enable_reconnect --enable_reconnect
select 3; select 3;
disconnect con1; disconnect con1;
# The last connect is to keep tools checking the current test happy.
connect (default,localhost,root,,test,,);
...@@ -2,6 +2,10 @@ ...@@ -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'; ...@@ -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; ...@@ -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); ...@@ -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'; ...@@ -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'; ...@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment