diff options
author | unknown <anozdrin/alik@quad.> | 2008-02-12 20:59:09 +0300 |
---|---|---|
committer | unknown <anozdrin/alik@quad.> | 2008-02-12 20:59:09 +0300 |
commit | 215625b14300c50c99682c47af25a10eab1bce7e (patch) | |
tree | 2a8abb195f027f14a11bed04fc39b521f2d2aab5 /mysql-test | |
parent | a0d88ebb0b5f77b30c65152f87aa73363ce93d71 (diff) | |
download | mariadb-git-215625b14300c50c99682c47af25a10eab1bce7e.tar.gz |
Fix for Bug#31222: com_% global status counters
behave randomly with mysql_change_user.
The problem was that global status variables were not updated
in THD::check_user(), so thread statistics were lost after
COM_CHANGE_USER.
The fix is to update global status variables with the thread ones
before preparing the thread for new user.
mysql-test/r/change_user.result:
Update result file.
mysql-test/t/change_user.test:
Add a test case for Bug#31222: com_% global status counters
behave randomly with mysql_change_user.
sql/sql_class.cc:
Update global status variables when we're handling
COM_CHANGE_USER for a thread.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/change_user.result | 7 | ||||
-rw-r--r-- | mysql-test/t/change_user.test | 28 |
2 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/r/change_user.result b/mysql-test/r/change_user.result index 28b55dfd5e5..4cfaf0e90ea 100644 --- a/mysql-test/r/change_user.result +++ b/mysql-test/r/change_user.result @@ -44,3 +44,10 @@ IS_FREE_LOCK('bug31418') SELECT IS_USED_LOCK('bug31418'); IS_USED_LOCK('bug31418') NULL +FLUSH STATUS; +SHOW GLOBAL STATUS LIKE 'com_select'; +Variable_name Value +Com_select 112 +SHOW GLOBAL STATUS LIKE 'com_select'; +Variable_name Value +Com_select 112 diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test index d0cdfc8a741..eec2a6f39d3 100644 --- a/mysql-test/t/change_user.test +++ b/mysql-test/t/change_user.test @@ -33,3 +33,31 @@ SELECT IS_USED_LOCK('bug31418') = CONNECTION_ID(); --change_user SELECT IS_FREE_LOCK('bug31418'); SELECT IS_USED_LOCK('bug31418'); + +# +# Bug#31222: com_% global status counters behave randomly with +# mysql_change_user. +# + +FLUSH STATUS; + +--disable_result_log +--disable_query_log + +let $i = 100; + +while ($i) +{ + dec $i; + + SELECT 1; +} + +--enable_query_log +--enable_result_log + +SHOW GLOBAL STATUS LIKE 'com_select'; + +--change_user + +SHOW GLOBAL STATUS LIKE 'com_select'; |