Bug #41468 Backup: backup/restore commands do not reset warning
Submitted: 15 Dec 2008 12:00 Modified: 11 Feb 2009 3:14
Reporter: Jorgen Loland Email Updates:
Status: Closed
Category:Server: Backup Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Jorgen Loland Target Version:6.0-rc
Triage: Triaged: D2 (Serious)

[15 Dec 2008 12:00] Jorgen Loland
Description:
The reference manual says:

"SHOW WARNINGS shows the error, warning, and note messages that resulted from the last
statement that generated messages"
(http://dev.mysql.com/doc/refman/6.0/en/show-warnings.html)

However, the backup/restore commands do not reset the warning stack. Hence, old warnings
are shown when backup/restore completes without error/warning.

How to repeat:
mysql> create database db;
Query OK, 1 row affected (0.00 sec)

mysql> backup database db to '/tmp/my.bak';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it
cannot execute this statement

mysql> backup database db to 'my.bak';
+-----------+
| backup_id |
+-----------+
| 271       | 
+-----------+
1 row in set (0.11 sec)

mysql> show warnings;
+-------+------+----------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                 
                          |
+-------+------+----------------------------------------------------------------------------------------------------+
| Error | 1290 | The MySQL server is running with the --secure-file-priv option so it
cannot execute this statement | 
| Error | 1290 | The MySQL server is running with the --secure-file-priv option so it
cannot execute this statement | 
+-------+------+----------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Suggested fix:
Make backup and restore reset warning stack.
[15 Dec 2008 12:03] Jorgen Loland
Mats says:

"You can call "thd->warn_list.empty()" for the thread to empty the list of warnings.
Maybe you need to set the total_warn_count as well."
[15 Dec 2008 15:45] Jorgen Loland
backup_errors has a commented-out 'show warnings' that must be fixed as part of this bug
[5 Jan 2009 13:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/62484

2746 Jorgen Loland	2009-01-05
      Bug#41468 - Backup: backup/restore commands do not reset warning
      
      The patch clears warnings before executing BACKUP and RESTORE commands.
[6 Jan 2009 9:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/62511

2746 Jorgen Loland	2009-01-06
      Bug#41468 - Backup: backup/restore commands do not reset warning
            
      The patch clears warnings before executing BACKUP and RESTORE commands.
[6 Jan 2009 14:31] Chuck Bell
Patch approved.
[2 Feb 2009 16:07] Bugs System
Pushed into 6.0.10-alpha (revid:sergefp@mysql.com-20090202090240-dlkxhmc1asrar5rl)
(version source revid:sergefp@mysql.com-20090129100938-qvke7a9krg24l8pl) (merge vers:
6.0.10-alpha) (pib:6)
[11 Feb 2009 3:14] Paul DuBois
Noted in 6.0.10 changelog.

BACKUP DATABASE and RESTORE did not reset the message list displayed
by SHOW WARNINGS.