Commit ece678c5 authored by Matthias Leich's avatar Matthias Leich

Fix for Bug#38270 Test "processlist_priv_ps" fails on varying "processlist" output

Details of the fix:
- wrong command and state in processlist -> insert poll routine
- unexpected additional session -> abort if unexpected session found
parent dd47146d
......@@ -16,7 +16,7 @@
# That means our SHOW PROCESSLIST can come too early. #
# Solution: #
# Close the connections at the end of the test. #
# Example2: #
# Example2 (2008-08-14 again observed): #
# 1. connection X: SHOW PROCESSLIST/GRANT ... etc. #
# 2. Switch to connection Y #
# 3. SHOW PROCESSLIST might present a record like #
......@@ -53,9 +53,11 @@
# WL#3982 Test information_schema.processlist #
# #
# Last update: #
# 2008-04-14 pcrews replace HOST to account for Windows' use of #
# localhost (host:<port> causing diffs on Windows #
# test runs #
# 2008-08-14 mleich Bug#38270 Test "processlist_priv_ps" fails on #
# varying "processlist" output #
# - Replace one sleep by a poll routines #
# - Remove or disable superfluous sleeps #
# #
########################################################################
# The following variables are used in "datadict_priv.inc" and here.
......@@ -87,15 +89,28 @@ USE information_schema;
--echo 1 Prepare test.
--echo connection default (user=root)
--echo ####################################################################################
if (`SELECT COUNT(*) <> 1 FROM processlist`)
{
--echo This test expects one connection to the server.
--echo Expectation: USER HOST DB COMMAND STATE INFO
--echo Expectation: root localhost information_schema Query executing SELECT USER,HOST,DB,COMMAND,STATE,INFO FROM processlist ORDER BY ID
--echo But we found in the moment:
SELECT USER,HOST,DB,COMMAND,STATE,INFO FROM processlist ORDER BY ID;
--echo Maybe
--echo - the base configuration (no of parallel auxiliary sessions) of the server has changed
--echo - a parallel test intended for another server accidently connected to our current one
--echo We cannot proceed in this situation. Abort
exit;
}
--echo ####################################################################################
--echo 1.1 Create two user
--echo ####################################################################################
# access to info tables as normal user
--disable_abort_on_error
--error 0, ER_CANNOT_USER
DROP USER ddicttestuser1@'localhost';
--error 0, ER_CANNOT_USER
DROP USER ddicttestuser2@'localhost';
--enable_abort_on_error
CREATE USER ddicttestuser1@'localhost';
CREATE USER ddicttestuser2@'localhost';
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
......@@ -112,6 +127,14 @@ connect (con100,localhost,ddicttestuser1,ddictpass,information_schema);
--echo SHOW/SELECT shows all processes/threads.
--echo ####################################################################################
connection default;
# Avoid Bug#38270 Test "processlist_priv_ps" fails on varying "processlist" output
# This subtest expects that the connection con100 is in state 'Sleep'.
# Poll till the connection con100 is in state COMMAND = 'Sleep'.
let $wait_timeout= 10;
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1';
--source include/wait_condition.inc
eval SHOW CREATE TABLE $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME
eval SHOW $table;
......@@ -120,7 +143,6 @@ eval SELECT * FROM $table $select_where ORDER BY id;
--replace_column 1 ID 3 HOST_NAME 6 TIME
eval SELECT $columns FROM $table $select_where ORDER BY id;
--source suite/funcs_1/datadict/datadict_priv.inc
--real_sleep 0.3
--echo ####################################################################################
......@@ -128,6 +150,9 @@ eval SELECT $columns FROM $table $select_where ORDER BY id;
connection con100;
--echo SHOW/SELECT shows only the processes (1) of the user.
--echo ####################################################################################
# No need for poll routine here.
# The current state of the default session might depend on load of testing box
# but "ddicttestuser1" must not see anything of the root session.
eval SHOW CREATE TABLE $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME
eval SHOW $table;
......@@ -219,7 +244,7 @@ SELECT * FROM information_schema.processlist;
--echo ####################################################################################
--echo 7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
--echo 7 Revoke PROCESS privilege from anonymous user
--echo connection default (user=root)
--echo ####################################################################################
connection default;
......
......@@ -7,9 +7,7 @@ connection default (user=root)
1.1 Create two user
####################################################################################
DROP USER ddicttestuser1@'localhost';
ERROR HY000: Operation DROP USER failed for 'ddicttestuser1'@'localhost'
DROP USER ddicttestuser2@'localhost';
ERROR HY000: Operation DROP USER failed for 'ddicttestuser2'@'localhost'
CREATE USER ddicttestuser1@'localhost';
CREATE USER ddicttestuser2@'localhost';
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
......@@ -240,7 +238,7 @@ ID ddicttestuser1 HOST_NAME information_schema Query TIME executing SELECT * FRO
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL
####################################################################################
7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
7 Revoke PROCESS privilege from anonymous user
connection default (user=root)
####################################################################################
REVOKE PROCESS ON *.* FROM ''@'localhost';
......
......@@ -7,9 +7,7 @@ connection default (user=root)
1.1 Create two user
####################################################################################
DROP USER ddicttestuser1@'localhost';
ERROR HY000: Operation DROP USER failed for 'ddicttestuser1'@'localhost'
DROP USER ddicttestuser2@'localhost';
ERROR HY000: Operation DROP USER failed for 'ddicttestuser2'@'localhost'
CREATE USER ddicttestuser1@'localhost';
CREATE USER ddicttestuser2@'localhost';
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
......@@ -240,7 +238,7 @@ ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * F
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL
ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL
####################################################################################
7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
7 Revoke PROCESS privilege from anonymous user
connection default (user=root)
####################################################################################
REVOKE PROCESS ON *.* FROM ''@'localhost';
......
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