--disable_abort_on_error # Bad effect happens on 2 - 1 'th SELECT = exact one too early GRANT USAGE ON *.* TO testuser17@localhost WITH MAX_QUERIES_PER_HOUR 3; FLUSH USER_RESOURCES; --echo # Establish connection testuser17 (user=testuser17) --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser17,localhost,testuser17,,); --echo # Switch to connection testuser17 connection testuser17; SELECT 'First', USER(); SELECT 'Second', USER(); SELECT 'Third', USER(); --echo # ---- Expect here 'max_questions' limit exceeded ----------- SELECT 'Forth', USER(); --echo # Switch to connection default connection default; # Bad effect does not happen for a second session of an already connected user # The first session has already executed our subtest FLUSH USER_RESOURCES; --echo # Establish connection testuser17_1 (user=testuser17) --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser17_1,localhost,testuser17,,); --echo # Switch to connection testuser17_1 connection testuser17_1; SELECT 'First', USER(); SELECT 'Second', USER(); SELECT 'Third', USER(); --echo # ---- Expect here 'max_questions' limit exceeded ----------- SELECT 'Forth', USER(); --echo # Switch to connection default connection default; disconnect testuser17; disconnect testuser17_1; DROP USER testuser17@localhost; # Bad effect happens on 2 - 1 'th SELECT = exact one too early # + happens for a new session with a different user # + even if we already had another user suffering from the problem GRANT USAGE ON *.* TO testuser18@localhost WITH MAX_QUERIES_PER_HOUR 3; FLUSH USER_RESOURCES; --echo # Establish connection testuser18 (user=testuser18) --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser18,localhost,testuser18,,); --echo # Switch to connection testuser18 connection testuser18; SELECT 'First', USER(); SELECT 'Second', USER(); SELECT 'Third', USER(); --echo # ---- Expect here 'max_questions' limit exceeded ----------- SELECT 'Forth', USER(); --echo # Switch to connection default connection default; # Bad effect does not happen for a second session of a user where the first # session is now disconnected and executed the same subtest # disconnect testuser18; # Wait a bit till the disconnect is finished sleep 3; FLUSH USER_RESOURCES; --echo # With additional connection for testuser18 --echo # Establish connection testuser18_1 (user=testuser18) --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser18_1,localhost,testuser18,,); --echo # Switch to connection testuser18_1 connection testuser18_1; SELECT 'First', USER(); SELECT 'Second', USER(); SELECT 'Third', USER(); --echo # ---- Expect here 'max_questions' limit exceeded ----------- SELECT 'Forth', USER(); --echo # Switch to connection default connection default; disconnect testuser18_1; DROP USER testuser18@localhost; # Deleted subtest # Just a connect/disconnect/connect ist not enough to prevent the bad effect # A FLUSH TABLES executed by root after establishing the connection does not prevent the bad effect GRANT USAGE ON *.* TO testuser19@localhost WITH MAX_QUERIES_PER_HOUR 3; FLUSH USER_RESOURCES; --echo # Establish connection testuser19 (user=testuser19) --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser19,localhost,testuser19,,); --echo # Switch to connection default connection default; FLUSH USER_RESOURCES; --echo # Switch to connection testuser19 connection testuser19; SELECT 'First', USER(); SELECT 'Second', USER(); SELECT 'Third', USER(); --echo # ---- Expect here 'max_questions' limit exceeded ----------- SELECT 'Forth', USER(); --echo # Switch to connection default connection default; disconnect testuser19; DROP USER testuser19@localhost; # A FLUSH TABLES executed by root after the first SELECT of the user which was never # connected prevents the bad effect GRANT USAGE ON *.* TO testuser21@localhost WITH MAX_QUERIES_PER_HOUR 3; FLUSH USER_RESOURCES; --echo # Establish connection testuser21 (user=testuser21) --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser21,localhost,testuser21,,); SELECT 'Zero', USER(); --echo # Switch to connection default connection default; FLUSH USER_RESOURCES; --echo # Switch to connection testuser21 connection testuser21; SELECT 'First', USER(); SELECT 'Second', USER(); SELECT 'Third', USER(); --echo # ---- Expect here 'max_questions' limit exceeded ----------- SELECT 'Forth', USER(); --echo # Switch to connection default connection default; disconnect testuser21; DROP USER testuser21@localhost; # Even a connect/Use /disconnect/connect ist not enough to prevent the bad effect FLUSH USER_RESOURCES; GRANT USAGE ON *.* TO testuser20@localhost WITH MAX_QUERIES_PER_HOUR 3; --echo # Establish connection testuser20 (user=testuser20) --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser20,localhost,testuser20,,); --echo # Switch to connection testuser20 connection testuser20; USE information_schema; disconnect testuser20; # Wait a bit till the disconnect is finished sleep 3; --echo # Establish connection testuser20 (user=testuser20) --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser20,localhost,testuser20,,); --echo # Switch to connection testuser20 SELECT 'First', USER(); SELECT 'Second', USER(); SELECT 'Third', USER(); --echo # ---- Expect here 'max_questions' limit exceeded ----------- SELECT 'Forth', USER(); --echo # Switch to connection default connection default; disconnect testuser20; DROP USER testuser20@localhost;