Bug #35444 Incorrect warning handling with SET GLOBAL
Submitted: 19 Mar 2008 20:26 Modified: 2 Apr 2008 15:59
Reporter: Philip Stoev Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:6.0.4 OS:Any
Assigned to: Sergei Glukhov CPU Architecture:Any

[19 Mar 2008 20:26] Philip Stoev
Description:
It appears that if a SET GLOBAL statement produces a warning, this warning is not cleared by subsequent queries. SHOW WARNINGS continues to display it.

How to repeat:
mysql> show warnings;
Empty set (0.00 sec)

mysql> SET GLOBAL query_cache_size = 1024;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------------------------------+
| Level   | Code | Message                                                        |
+---------+------+----------------------------------------------------------------+
| Warning | 1282 | Query cache failed to set size 1024; new query cache size is 0 |
+---------+------+----------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SET GLOBAL query_cache_size = 1024 * 1024;
Query OK, 0 rows affected (0.01 sec)

mysql> show warnings;
+---------+------+----------------------------------------------------------------+
| Level   | Code | Message                                                        |
+---------+------+----------------------------------------------------------------+
| Warning | 1282 | Query cache failed to set size 1024; new query cache size is 0 |
+---------+------+----------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show variables like 'query_cache_size';
+------------------+---------+
| Variable_name    | Value   |
+------------------+---------+
| query_cache_size | 1048576 |
+------------------+---------+
1 row in set (0.03 sec)

Suggested fix:
Make sure the warnings are properly cleared before each statement.
[19 Mar 2008 20:32] Valeriy Kravchuk
Thank you for a bug report.
[2 Apr 2008 12:34] Sergei Glukhov
checked on latest 6.0 tree, can't repeat
[2 Apr 2008 13:37] Philip Stoev
The bug is still present for me using a debug build on the latest 6.0 free.

Server version: 6.0.5-alpha-debug-log Source distribution

[philips@philips mysql-test]$ uname -a
Linux philips 2.6.23.1-42.fc8 #1 SMP Tue Oct 30 13:55:12 EDT 2007 i686 i686 i386 GNU/Linux

[philips@philips mysql-test]$ gcc --version
gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)

Can you please try again, or on another platform?
[2 Apr 2008 15:59] Sergei Glukhov
Hi Philip, you are right, your test case is repeatable in 5.0, 5.1, 6.0 versions.
Manual says:
The list of messages is reset for each new statement that uses a table.
(see http://dev.mysql.com/doc/refman/5.0/en/show-warnings.html)

'SET GLOBAL ...' does not use tables, the list of messages is not reset.
So It's not a bug.