diff --git a/mysql-test/include/wait_until_count_sessions.inc b/mysql-test/include/wait_until_count_sessions.inc index 41348bee129..de4f0eeb652 100644 --- a/mysql-test/include/wait_until_count_sessions.inc +++ b/mysql-test/include/wait_until_count_sessions.inc @@ -2,14 +2,23 @@ # # SUMMARY # -# Waits until the passed number ($count_sessions) of concurrent sessions was -# observed via +# Waits until the passed number ($count_sessions) of concurrent sessions or +# a smaller number was observed via # SHOW STATUS LIKE 'Threads_connected' # or the operation times out. -# Note: Starting with 5.1 we could also use -# SELECT COUNT(*) FROM information_schema.processlist -# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this -# runs in all versions 5.0+ +# 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 +# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this +# runs in all versions 5.0+ # # # USAGE @@ -19,20 +28,20 @@ # # 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 -# and start between.cw +# and start between. # # If the testing box is slow than the disconnect of sessions belonging to # the current test might happen when the successing test gets executed. # This means the successing test might see activities like unexpected # rows within the general log or the PROCESSLIST. # Example from bug http://bugs.mysql.com/bug.php?id=40377 -# --- bzr_mysql-6.0-rpl/.../r/log_state.result +# --- bzr_mysql-6.0-rpl/.../r/log_state.result # +++ bzr_mysql-6.0-rpl/.../r/log_state.reject # @@ -25,6 +25,7 @@ -# event_time user_host ... command_type argument -# TIMESTAMP USER_HOST ... Query create table t1(f1 int) -# TIMESTAMP USER_HOST ... Query select * from mysql.general_log -# +TIMESTAMP USER_HOST ... Quit +# event_time user_host ... command_type argument +# TIMESTAMP USER_HOST ... Query create table t1(f1 int) +# TIMESTAMP USER_HOST ... Query select * from mysql.general_log +# +TIMESTAMP USER_HOST ... Quit # .... # # What to do? @@ -79,7 +88,11 @@ # 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; @@ -93,7 +106,7 @@ let $wait_timeout= 0; while ($wait_counter) { 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) { let $wait_counter= 0; @@ -107,7 +120,7 @@ while ($wait_counter) if (!$success) { --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; } diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index 727433d3032..5e6c013bb38 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -188,7 +188,7 @@ DROP USER mysqltest_u1@localhost; # -- End of Bug#33507. -# -- Bug#35074: max_used_connections is not correct. +# -- Bug#35074: max_used_connections is not correct. FLUSH STATUS; diff --git a/mysql-test/r/consistent_snapshot.result b/mysql-test/r/consistent_snapshot.result index 90606abbe4e..694c996a58e 100644 --- a/mysql-test/r/consistent_snapshot.result +++ b/mysql-test/r/consistent_snapshot.result @@ -1,15 +1,23 @@ -drop table if exists t1; -create table t1 (a int) engine=innodb; -start transaction with consistent snapshot; -insert into t1 values(1); -select * from t1; +DROP TABLE IF EXISTS t1; +# Establish connection con1 (user=root) +# Establish connection con2 (user=root) +# Switch to connection con1 +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 -commit; -delete from t1; -start transaction; -insert into t1 values(1); -select * from t1; +COMMIT; +DELETE FROM t1; +START TRANSACTION; +# Switch to connection con2 +INSERT INTO t1 VALUES(1); +# Switch to connection con1 +SELECT * FROM t1; a 1 -commit; -drop table t1; +COMMIT; +# Switch to connection default + close connections con1 and con2 +DROP TABLE t1; diff --git a/mysql-test/r/dirty_close.result b/mysql-test/r/dirty_close.result index c4fc19a35f8..b49b72f1b95 100644 --- a/mysql-test/r/dirty_close.result +++ b/mysql-test/r/dirty_close.result @@ -1,9 +1,9 @@ -drop table if exists t1; -create table t1 (n int); -insert into t1 values (1),(2),(3); -select * from t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (n INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; n 1 2 3 -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result index d5b10868358..d2197beaaab 100644 --- a/mysql-test/r/flush_block_commit.result +++ b/mysql-test/r/flush_block_commit.result @@ -1,39 +1,57 @@ -drop table if exists t1; -create table t1 (a int) engine=innodb; -begin; -insert into t1 values(1); -flush tables with read lock; -select * from t1; +# Establish connection con1 (user=root) +# Establish connection con2 (user=root) +# Establish connection con3 (user=root) +# Switch to connection con1 +DROP TABLE IF EXISTS 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 -commit; -select * from t1; +# Switch to connection con1 +COMMIT; +# Switch to connection con2 +SELECT * FROM t1; a -unlock tables; -begin; -select * from t1 for update; +UNLOCK TABLES; +# Switch to connection con1 +# Switch to connection con1 +BEGIN; +SELECT * FROM t1 FOR UPDATE; a 1 -begin; -select * from t1 for update; -flush tables with read lock; -commit; +# Switch to connection con2 +BEGIN; +SELECT * FROM t1 FOR UPDATE; +# Switch to connection con3 +FLUSH TABLES WITH READ LOCK; +# Switch to connection con1 +COMMIT; +# Switch to connection con2 a 1 -unlock tables; -commit; -begin; -insert into t1 values(10); -flush tables with read lock; -commit; -unlock tables; -flush tables with read lock; -unlock tables; -begin; -select * from t1; +# Switch to connection con3 +UNLOCK TABLES; +# Switch to connection con2 +COMMIT; +# Switch to connection con1 +BEGIN; +INSERT INTO t1 VALUES(10); +FLUSH TABLES WITH READ LOCK; +COMMIT; +UNLOCK TABLES; +# Switch to connection con2 +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +BEGIN; +SELECT * FROM t1; a 1 10 -show create database test; +SHOW CREATE DATABASE test; Database Create Database 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 diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result index 16fb143ee4c..c7fd7a11877 100644 --- a/mysql-test/r/flush_block_commit_notembedded.result +++ b/mysql-test/r/flush_block_commit_notembedded.result @@ -1,15 +1,23 @@ -create table t1 (a int) engine=innodb; -reset master; -set autocommit=0; -insert t1 values (1); -flush tables with read lock; -show master status; +# Establish connection con1 (user=root) +# Establish connection con2 (user=root) +# Switch to connection con1 +CREATE TABLE t1 (a INT) ENGINE=innodb; +RESET MASTER; +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 master-bin.000001 106 -commit; -show master status; +# Switch to connection con1 +COMMIT; +# Switch to connection con2 +SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 -unlock tables; -drop table t1; -set autocommit=1; +UNLOCK TABLES; +# Switch to connection con1 +DROP TABLE t1; +SET AUTOCOMMIT=1; +# Switch to connection default and close connections con1 and con2 diff --git a/mysql-test/r/flush_read_lock_kill.result b/mysql-test/r/flush_read_lock_kill.result index 0b599f343f7..b16a8b114b3 100644 --- a/mysql-test/r/flush_read_lock_kill.result +++ b/mysql-test/r/flush_read_lock_kill.result @@ -1,12 +1,12 @@ -set @old_concurrent_insert= @@global.concurrent_insert; -set @@global.concurrent_insert= 0; -drop table if exists t1; -create table t1 (kill_id int); -insert into t1 values(connection_id()); -flush tables with read lock; -select ((@id := kill_id) - kill_id) from t1; +SET @old_concurrent_insert= @@global.concurrent_insert; +SET @@global.concurrent_insert= 0; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (kill_id INT); +INSERT INTO t1 VALUES(connection_id()); +FLUSH TABLES WITH READ LOCK; +SELECT ((@id := kill_id) - kill_id) FROM t1; ((@id := kill_id) - kill_id) 0 -kill connection @id; -drop table t1; -set @@global.concurrent_insert= @old_concurrent_insert; +KILL CONNECTION @id; +DROP TABLE t1; +SET @@global.concurrent_insert= @old_concurrent_insert; diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result index a0e3d9fad06..50e37d28dd6 100644 --- a/mysql-test/r/lock_multi.result +++ b/mysql-test/r/lock_multi.result @@ -51,10 +51,10 @@ Field Type Null Key Default Extra a int(11) YES NULL unlock tables; drop table t1; -use mysql; +USE mysql; LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE; FLUSH TABLES; -use mysql; +USE mysql; SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; OPTIMIZE TABLES columns_priv, db, host, user; Table Op Msg_type Msg_text @@ -65,7 +65,7 @@ mysql.user optimize status OK UNLOCK TABLES; Select_priv N -use test; +USE test; use test; CREATE TABLE t1 (c1 int); LOCK TABLE t1 WRITE; @@ -133,8 +133,8 @@ DROP TABLE t1; End of 5.0 tests create table t1 (i int); lock table t1 read; -update t1 set i= 10;; -select * from t1;; +update t1 set i= 10; +select * from t1; kill query ID; i ERROR 70100: Query execution was interrupted diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 1efa944bf9b..34d695a0272 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -391,9 +391,9 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; CREATE TABLE t1 (c1 CHAR(10)); -flush logs; +FLUSH LOGS; INSERT INTO t1 VALUES ('0123456789'); -flush logs; +FLUSH LOGS; DROP TABLE t1; We expect this value to be 1 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 1 DROP TABLE patch; -flush logs; -create table t1(a int); -insert into t1 values(connection_id()); -flush logs; -drop table t1; +FLUSH LOGS; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(connection_id()); +FLUSH LOGS; +DROP TABLE t1; 1 -drop table t1; +DROP TABLE t1; shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql -flush logs; -BUG#31611: Security risk with BINLOG statement +FLUSH LOGS; +Bug#31611 Security risk with BINLOG statement SET BINLOG_FORMAT=ROW; CREATE DATABASE mysqltest1; CREATE USER untrusted@localhost; @@ -435,7 +435,7 @@ a b 1 root@localhost DROP DATABASE mysqltest1; 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; SET BINLOG_FORMAT = STATEMENT; FLUSH LOGS; @@ -460,15 +460,15 @@ an_int 1000 a_decimal 907.79 a_string Just a test DROP TABLE t1; -set @@global.server_id= 4294967295; -reset master; -flush logs; -select -(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) -is not null; -(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) -is not null +SET @@global.server_id= 4294967295; +RESET MASTER; +FLUSH LOGS; +SELECT +(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) +IS NOT NULL; +(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) +IS NOT NULL 1 *** Unsigned server_id 4294967295 is found: 1 *** -set @@global.server_id= 1; +SET @@global.server_id= 1; End of 5.1 tests diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index a61f25058d9..a9c20e34517 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -743,10 +743,12 @@ select 1; -- 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 con1 +con2 default con1 -default -con1 +con2 con1 +con2 +con2 -closed_connection- End of tests diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index 558e0356c5a..7b28da5a577 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -128,7 +128,7 @@ set global read_only=0; drop table t1,t2; drop user test@localhost; # -# Bug #27440 read_only allows create and drop database +# Bug#27440 read_only allows create and drop database # set global read_only= 1; drop database if exists mysqltest_db1; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index d707ebaeba5..e6550bee954 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -545,9 +545,9 @@ mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ drop table mysqltest.t1; drop database mysqltest; set names binary; -delete from mysql.user +delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; -delete from mysql.db +delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; flush privileges; CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY; @@ -664,7 +664,7 @@ show create table t1; ERROR HY000: Incorrect information in file: './test/t1.frm' 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; CREATE DATABASE mysqltest1; @@ -784,7 +784,7 @@ show status like 'slow_queries'; Variable_name Value Slow_queries 1 create table t1 (a int); -create trigger tr1 before insert on t1 for each row +create trigger tr1 before insert on t1 for each row begin end; create view v1 as select a from t1; @@ -1010,7 +1010,7 @@ def TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 1 0 33 Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation t1_bi INSERT t1 SET @a = 1 BEFORE NULL root@localhost binary binary latin1_swedish_ci ---------------------------------------------------------------- -SELECT +SELECT TRIGGER_CATALOG, TRIGGER_SCHEMA, TRIGGER_NAME, diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result index 8ef52e75238..47741fed250 100644 --- a/mysql-test/r/skip_name_resolve.result +++ b/mysql-test/r/skip_name_resolve.result @@ -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' 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'; -select user(); -user() +SELECT USER(); +USER() # -show processlist; +SHOW PROCESSLIST; Id User Host db Command Time State Info root test