Bug #40282 --log-backup-output w/o argument sets logging to wrong value
Submitted: 23 Oct 2008 15:42 Modified: 1 Dec 2008 16:11
Reporter: Paul Dubois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0 bzr OS:Any
Assigned to: Jørgen Løland CPU Architecture:Any
Triage: Triaged: D3 (Medium)

[23 Oct 2008 15:42] Paul Dubois
Description:
The --log-backup-output option has been recently implemented to 
enable control over backup logging destinations. The option works
similarly to --log-output, but there is a discrepancy.

For the --log-output option, the default value is FILE if you don't 
give the option. And if you give the option as --log-output without
an argument, logging is also set to the default of FILE.

For --log-backup-output, the default value is TABLE if you don't
give the option. (That's okay; it's compatible with the previous 
backup logging behavior, which was to log to tables). But if you give the option as --log-backup-output without an argument, backup
logging is set to FILE, not to the default of TABLE.

How to repeat:
Start server like this:

[mysqld]
log-backup-output

Then execute this statement:

mysql> show variables like 'log_backup_output';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| log_backup_output | FILE  | 
+-------------------+-------+

The value should be TABLE.

Suggested fix:
--log-backup-output with no argument should set backup logging to
the default of TABLE, not FILE.

My guess is that the offending code in mysqld.cc is this, where LOG_TABLE should be used instead of LOG_FILE:

  case  OPT_LOG_BACKUP_OUTPUT:
  {
    if (!argument || !argument[0])
    {
      log_backup_output_options= LOG_FILE;
      log_backup_output_str= log_output_typelib.type_names[1];
    }
    else
    {
      log_backup_output_str= argument;
      log_backup_output_options=
        find_bit_type_or_exit(argument, &log_output_typelib, opt->name);
  }
[23 Oct 2008 16:10] Miguel Solorzano
Thank you for the bug report. Verified as described:

Server version: 6.0.8-alpha-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show variables like 'log_backup_output';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| log_backup_output | FILE  | 
+-------------------+-------+
1 row in set (0.04 sec)

mysql>
[13 Nov 2008 11:49] 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/58620

2732 Jorgen Loland	2008-11-13
      Bug#40282: --log-backup-output w/o argument sets logging to wrong value
      
      Default value for --log-backup-output is TABLE. Before, the option defaulted to FILE if specified without argument. Now, it defaults to TABLE.
[13 Nov 2008 15:23] Rafal Somla
Good to push.
[13 Nov 2008 16:40] Chuck Bell
Patch approved pending acceptance of request to remove extra test. Patch should instead use existing backup_logs_output test.

=== modified file mysql-test/suite/backup/r/backup_logs_output.result
--- mysql-test/suite/backup/r/backup_logs_output.result 2008-11-10 16:49:10 +0000
+++ mysql-test/suite/backup/r/backup_logs_output.result 2008-11-13 16:32:20 +0000
@@ -13,7 +13,7 @@
 backup_progress_log_file	MYSQLTEST_VARDIR/master-data/progress.txt
 SHOW VARIABLES LIKE 'log_backup_output';
 Variable_name	Value
-log_backup_output	FILE
+log_backup_output	TABLE
 Set the backup log file names to default values.
 SET @@global.backup_history_log_file = DEFAULT;
 SET @@global.backup_progress_log_file = DEFAULT;

=== modified file mysql-test/suite/backup/t/backup_logs_output-master.opt
--- mysql-test/suite/backup/t/backup_logs_output-master.opt 2008-11-11 08:37:27 +0000
+++ mysql-test/suite/backup/t/backup_logs_output-master.opt 2008-11-13 16:29:08 +0000
@@ -1,1 +1,1 @@
---backup_history_log_file=$MYSQLTEST_VARDIR/master-data/history.txt --backup_progress_log_file=$MYSQLTEST_VARDIR/master-data/progress.txt --log-backup-output=FILE
+--backup_history_log_file=$MYSQLTEST_VARDIR/master-data/history.txt --backup_progress_log_file=$MYSQLTEST_VARDIR/master-data/progress.txt --log-backup-output
[17 Nov 2008 11:27] Jørgen Løland
Pushed to mysql-6.0-backup with revision 2734
[20 Nov 2008 13:41] 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/59378

2740 Jorgen Loland	2008-11-20
      Bug#40282: --log-backup-output w/o argument sets logging to wrong value
      
      Follow-up patch: Fix compile warning and cleanup iterator object in case of DBUG_RETURN
[27 Nov 2008 9:09] Jørgen Løland
Pushed to main, v6.0.9, on Nov 26
[1 Dec 2008 16:11] Paul Dubois
Note in 6.0.9 changelog.

Specifying the --log-backup-output option without an argument set the
destination for the backup logs to FILE rather than to the default of
TABLE.