Commit facf6305 authored by unknown's avatar unknown

Fix for

   Bug#32153 Status output differs - scheduling ?
Modifications:
1. Introduce additional poll routines + adjust queries 
   as fixes for Bug#32153 and another non reported bug
   found during stability testing
2. Replace builtin poll routines by wait_condition.inc.
3. Update the comments


mysql-test/suite/funcs_1/datadict/processlist_val.inc:
  Fixes, details are in changeset comment
mysql-test/suite/funcs_1/r/a_processlist_val_no_prot.result:
  Updated results
mysql-test/suite/funcs_1/r/b_processlist_val_ps.result:
  Updated results
parent 8a9d7052
...@@ -94,14 +94,25 @@ connect (ddicttestuser1,localhost,ddicttestuser1,ddictpass,information_schema); ...@@ -94,14 +94,25 @@ connect (ddicttestuser1,localhost,ddicttestuser1,ddictpass,information_schema);
--echo ----- switch to connection default (user = root) ----- --echo ----- switch to connection default (user = root) -----
connection default; connection default;
# - We have now a second connection. # - We have now a second connection.
# - important values in second connection # First working phase for this connection is "Connect".
# This is a very short phase and the likelihood to meet it is
# - nearly zero on average boxes with low parallel load
# - around some percent on weak or overloaded boxes
# (Bug#32153 Status output differs - scheduling ?)
# Therefore we poll till we reach the long lasting phase with:
# - USER = ddicttestuser1 # - USER = ddicttestuser1
# - HOST = 'localhost' # - HOST = 'localhost'
# - DB = 'information_schema' # - DB = 'information_schema'
# - Command = 'Sleep' # - Command = 'Sleep'
# - TIME = 0, I hope the testing machines are all time fast enough # - TIME >= 0 Overloaded boxes can cause that we do not hit TIME = 0.
# - State IS NULL # - State IS NULL
# - INFO must be empty # - INFO must be empty
#
let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE COMMAND = 'Sleep' AND TIME > 0;
--source include/wait_condition.inc
#
# Expect to hit TIME = 1.
--replace_column 1 <ID> --replace_column 1 <ID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
# Change the SQL command (affects content of INFO) # Change the SQL command (affects content of INFO)
...@@ -109,25 +120,19 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; ...@@ -109,25 +120,19 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
# #
--echo # Sleep some time --echo # Sleep some time
# The value of TIME must increase after some sleeps. # The value of TIME must increase and reach 2 after some sleeps.
# So poll till TIME changes. let $wait_timeout= 2;
let $run= 10; let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
while ($run) WHERE TIME > 1;
{ --source include/wait_condition.inc
dec $run; #
if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST # Expect to hit TIME = 2.
WHERE ID = @my_proclist_id + 1 AND TIME > 0`)
{
let $run= 0;
}
--real_sleep 0.2
}
# Either we have now reached TIME = 1 or we fail with unexpected result.
# Expect to see now TIME = 1
--replace_column 1 <ID> --replace_column 1 <ID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> --replace_column 1 <ID>
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
#
#
# The second connection must have an ID = my ID + 1; # The second connection must have an ID = my ID + 1;
SELECT ID = @my_proclist_id + 1 FROM INFORMATION_SCHEMA.PROCESSLIST SELECT ID = @my_proclist_id + 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'ddicttestuser1'; WHERE USER = 'ddicttestuser1';
...@@ -150,6 +155,12 @@ SHOW FULL PROCESSLIST; ...@@ -150,6 +155,12 @@ SHOW FULL PROCESSLIST;
--echo --echo
--echo ----- establish connection con2 (user = ddicttestuser1) ------ --echo ----- establish connection con2 (user = ddicttestuser1) ------
connect (con2,localhost,ddicttestuser1,ddictpass,information_schema); connect (con2,localhost,ddicttestuser1,ddictpass,information_schema);
#
# If the testing box is under heavy load we might see connection ddicttestuser1
# within the short phase INFO = 'SHOW FULL PROCESSLIST' and STATE = 'Writing to net'.
let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE COMMAND = 'Sleep';
--source include/wait_condition.inc
--replace_column 1 <ID> 6 <TIME> --replace_column 1 <ID> 6 <TIME>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 6 <TIME> --replace_column 1 <ID> 6 <TIME>
...@@ -183,24 +194,17 @@ connection default; ...@@ -183,24 +194,17 @@ connection default;
# - USER = ddicttestuser1 # - USER = ddicttestuser1
# - HOST = 'localhost' # - HOST = 'localhost'
# - DB = 'information_schema' # - DB = 'information_schema'
# - Command = 'Query' # - Command = 'Query'(run without --ps-protocol)/'Execute' (run --ps-protocol)
# - TIME = 1, Attention: check with TIME = 0 is not stable # - TIME = 1, Attention: check with TIME = 0 is not stable
# - State IS NULL # - State IS NULL
# - INFO = "SELECT sleep(2.5),'Command time'" # - INFO = "SELECT sleep(2.5),'Command time'"
--echo # Sleep some time --echo # Sleep some time
# The command must be at some time in work by the server. # The command must be after some time in work by the server.
# So poll till INFO is no more NULL and TIME > 0. # So poll till INFO is no more NULL and TIME > 0.
let $run= 10; let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
while ($run) WHERE INFO IS NOT NULL AND TIME > 0;
{ --source include/wait_condition.inc
dec $run; #
if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO IS NOT NULL AND TIME > 0`)
{
let $run= 0;
}
--real_sleep 0.2
}
# Expect to see TIME = 1 # Expect to see TIME = 1
--replace_column 1 <ID> --replace_column 1 <ID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
...@@ -208,20 +212,13 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; ...@@ -208,20 +212,13 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
# #
--echo # Sleep some time --echo # Sleep some time
# The value of TIME must increase after some sleeps therefore # The value of TIME must increase and reach 2 after some sleeps.
# poll till TIME changes let $wait_timeout= 2;
let $run= 10; let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
while ($run) WHERE TIME > 1;
{ --source include/wait_condition.inc
dec $run; #
if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST # Expect to see TIME = 2
WHERE ID = @my_proclist_id + 1 AND TIME > 1`)
{
let $run= 0;
}
--real_sleep 0.2
}
# Either we have now reached TIME = 2 or we fail with unexpected result.
--replace_column 1 <ID> --replace_column 1 <ID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> --replace_column 1 <ID>
...@@ -248,19 +245,14 @@ send SELECT sleep(2),'BEGIN this is the representative of a very long statement. ...@@ -248,19 +245,14 @@ send SELECT sleep(2),'BEGIN this is the representative of a very long statement.
--echo ----- switch to connection default (user = root) ----- --echo ----- switch to connection default (user = root) -----
connection default; connection default;
--echo # Sleep some time --echo # Sleep some time
# The command must be at some time in work by the server. # The command must be after some time in work by the server.
# So poll till INFO is no more NULL. # There is a short phase with STATE IS NULL followed by a longer phase
let $run= 10; # with STATE = 'init'.
while ($run) # So poll till INFO is no more NULL AND STATE = 'init'.
{ let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
dec $run; WHERE INFO IS NOT NULL AND STATE = 'init';
if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST --source include/wait_condition.inc
WHERE INFO IS NOT NULL`) #
{
let $run= 0;
}
--real_sleep 0.2
}
# Expect to see that SELECT/SHOW PROCESSLIST can handle my statement monster. # Expect to see that SELECT/SHOW PROCESSLIST can handle my statement monster.
--replace_column 1 <ID> 6 <TIME> --replace_column 1 <ID> 6 <TIME>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
...@@ -295,19 +287,12 @@ send SELECT COUNT(*) FROM test.t1; ...@@ -295,19 +287,12 @@ send SELECT COUNT(*) FROM test.t1;
--echo ----- switch to connection default (user = root) ----- --echo ----- switch to connection default (user = root) -----
connection default; connection default;
--echo # Sleep some time --echo # Sleep some time
# The command must be at some time in work by the server. # The command must be after some time in work by the server.
# So poll till INFO is no more NULL. # So poll till INFO is no more NULL.
let $run= 10; let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
while ($run) WHERE INFO IS NOT NULL AND STATE = 'Locked';
{ --source include/wait_condition.inc
dec $run; #
if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO IS NOT NULL`)
{
let $run= 0;
}
--real_sleep 0.2
}
# Expect to see the state 'Locked' for the second connection because the SELECT # Expect to see the state 'Locked' for the second connection because the SELECT
# collides with the WRITE TABLE LOCK. # collides with the WRITE TABLE LOCK.
--replace_column 1 <ID> 6 <TIME> --replace_column 1 <ID> 6 <TIME>
......
...@@ -45,21 +45,21 @@ SELECT ID INTO @my_proclist_id FROM INFORMATION_SCHEMA.PROCESSLIST; ...@@ -45,21 +45,21 @@ SELECT ID INTO @my_proclist_id FROM INFORMATION_SCHEMA.PROCESSLIST;
----- switch to connection default (user = root) ----- ----- switch to connection default (user = root) -----
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO ID USER HOST DB COMMAND TIME STATE INFO
<ID> ddicttestuser1 localhost information_schema Sleep 0 NULL <ID> ddicttestuser1 localhost information_schema Sleep 1 NULL
<ID> root localhost information_schema Query 0 preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <ID> root localhost information_schema Query 0 preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Id User Host db Command Time State Info
<ID> root localhost information_schema Query 0 NULL SHOW FULL PROCESSLIST <ID> root localhost information_schema Query 0 NULL SHOW FULL PROCESSLIST
<ID> ddicttestuser1 localhost information_schema Sleep 0 NULL <ID> ddicttestuser1 localhost information_schema Sleep 1 NULL
# Sleep some time # Sleep some time
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO ID USER HOST DB COMMAND TIME STATE INFO
<ID> ddicttestuser1 localhost information_schema Sleep 1 NULL <ID> ddicttestuser1 localhost information_schema Sleep 2 NULL
<ID> root localhost information_schema Query 0 preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <ID> root localhost information_schema Query 0 preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Id User Host db Command Time State Info
<ID> root localhost information_schema Query 0 NULL SHOW FULL PROCESSLIST <ID> root localhost information_schema Query 0 NULL SHOW FULL PROCESSLIST
<ID> ddicttestuser1 localhost information_schema Sleep 1 NULL <ID> ddicttestuser1 localhost information_schema Sleep 2 NULL
SELECT ID = @my_proclist_id + 1 FROM INFORMATION_SCHEMA.PROCESSLIST SELECT ID = @my_proclist_id + 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'ddicttestuser1'; WHERE USER = 'ddicttestuser1';
ID = @my_proclist_id + 1 ID = @my_proclist_id + 1
......
...@@ -45,21 +45,21 @@ SELECT ID INTO @my_proclist_id FROM INFORMATION_SCHEMA.PROCESSLIST; ...@@ -45,21 +45,21 @@ SELECT ID INTO @my_proclist_id FROM INFORMATION_SCHEMA.PROCESSLIST;
----- switch to connection default (user = root) ----- ----- switch to connection default (user = root) -----
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO ID USER HOST DB COMMAND TIME STATE INFO
<ID> ddicttestuser1 localhost information_schema Sleep 0 NULL <ID> ddicttestuser1 localhost information_schema Sleep 1 NULL
<ID> root localhost information_schema Execute 0 preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <ID> root localhost information_schema Execute 0 preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Id User Host db Command Time State Info
<ID> root localhost information_schema Query 0 NULL SHOW FULL PROCESSLIST <ID> root localhost information_schema Query 0 NULL SHOW FULL PROCESSLIST
<ID> ddicttestuser1 localhost information_schema Sleep 0 NULL <ID> ddicttestuser1 localhost information_schema Sleep 1 NULL
# Sleep some time # Sleep some time
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO ID USER HOST DB COMMAND TIME STATE INFO
<ID> ddicttestuser1 localhost information_schema Sleep 1 NULL <ID> ddicttestuser1 localhost information_schema Sleep 2 NULL
<ID> root localhost information_schema Execute 0 preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <ID> root localhost information_schema Execute 0 preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Id User Host db Command Time State Info
<ID> root localhost information_schema Query 0 NULL SHOW FULL PROCESSLIST <ID> root localhost information_schema Query 0 NULL SHOW FULL PROCESSLIST
<ID> ddicttestuser1 localhost information_schema Sleep 1 NULL <ID> ddicttestuser1 localhost information_schema Sleep 2 NULL
SELECT ID = @my_proclist_id + 1 FROM INFORMATION_SCHEMA.PROCESSLIST SELECT ID = @my_proclist_id + 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'ddicttestuser1'; WHERE USER = 'ddicttestuser1';
ID = @my_proclist_id + 1 ID = @my_proclist_id + 1
......
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