Bug #46415 Invalid backup log file error suppressed
Submitted: 27 Jul 2009 20:09 Modified: 29 Aug 2009 23:20
Reporter: Chuck Bell Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:5.4.4 OS:Windows
Assigned to: Chuck Bell CPU Architecture:Any

[27 Jul 2009 20:09] Chuck Bell
Description:
When using the backup logs and the command-line options of:

--log-backup-output=file --backup-progress-log=1 --log

And attempting to set the backup progress or history log to:

SET @@global.backup_progress_log_file = repeat('a',255);

Will result in an assertion thrown on Windows if the file name cannot be used.

In this case, the error from the open() call is suppressed and when my_ok() is called, an assertion on !is_set() fails because the error set m_state= DA_ERROR for the diagnostic area class.

The backup_logs test should catch this error but the above SET command succeeds. 

Note: Once this bug is fixed, the test may need to be changed to allow the use of a log file name that is 255 characters long and still valid on all platforms.

How to repeat:
1) start a debug compiled server with: 

c:\mysql\bin>mysqld_slave  --log-output=table,file --gdb --core-file --loose-deb
ug-sync-timeout=300 --console --log-backup-output=file --new --backup-progress-l
og=1 --log

2) start a client and enter the following command:

mysql> SET @@global.backup_progress_log_file = repeat('a',255);

3) observe the error in the console:

090727 16:00:18 [ERROR] Could not use aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa for backup logging (error
2).
Assertion failed: ! is_set(), file .\sql_error.cc, line 358

Note: 'error 2' == The system cannot find the file specified.

Suggested fix:
Capture the error on the open() in set_var.cc. This code is executed when the SET command is used. It attempts to open the log file with the new name. The following is a diff that repairs the problem.

=== modified file 'sql/set_var.cc'
--- sql/set_var.cc      2009-07-10 12:31:32 +0000
+++ sql/set_var.cc      2009-07-27 20:02:38 +0000
@@ -2795,10 +2795,10 @@ bool update_sys_var_str_path(THD *thd, s
       Open the backup logs if specified.
     */
     case BACKUP_HISTORY_LOG:
-      backup_log->open_backup_history_log(res);
+      result= backup_log->open_backup_history_log(res);
       break;
     case BACKUP_PROGRESS_LOG:
-      backup_log->open_backup_progress_log(res);
+      result= backup_log->open_backup_progress_log(res);
       break;
     default:
       DBUG_ASSERT(0);

Note: Changes to the backup_logs test may be needed.

This will allow the error to be handled:

mysql> SET @@global.backup_progress_log_file = repeat('a',255);
ERROR 29 (HY000): File '.\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' not found (Errcode: 2)
[3 Aug 2009 16:28] Chuck Bell
Reviewers changed due to vacation schedules.
[4 Aug 2009 20:13] 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/80084

2853 Chuck Bell	2009-08-04
      BUG#46415 : Invalid backup log file error suppressed
      
      A problem occurred on systems where a filename of 256 characters was
      too long for some operating environments (i.e. Windows with Cygwin. 
      This error was being suppressed because it originated in the 
      set_var.cc @ line#2795, 2798 on the open_backup_*_log() call. 
      
      This patch allows that method's return code to be returned to the 
      caller thus if the open() fails, the error will be reported. This 
      error does not occur on all platforms hence the error capture in 
      the test file.
     @ mysql-test/suite/backup/r/backup_logs.result
        Corrected result file.
     @ mysql-test/suite/backup/t/backup_logs.test
        Added test for 127 characters (ok for all platforms).
        Added error capture for failure on Windows when running under Cygwin.
[5 Aug 2009 13:49] Jørgen Løland
Good to push.
[6 Aug 2009 6:52] Rafal Somla
Good to push.
[28 Aug 2009 10:02] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090828100112-r73xkx8dhekz5bbb) (version source revid:jorgen.loland@sun.com-20090818084812-rlq2mh37241doswu) (merge vers: 5.4.4-alpha) (pib:11)
[29 Aug 2009 23:20] Paul DuBois
Not in any released version. No changelog entry needed.