From: Date: November 10 2008 5:49pm Subject: bzr commit into mysql-6.0-backup branch (cbell:2729) Bug#40219 List-Archive: http://lists.mysql.com/commits/58350 X-Bug: 40219 Message-Id: <200811101649.mAAGnGhY021304@mail.mysql.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///C:/source/bzr/mysql-6.0-bug-40219/ 2729 Chuck Bell 2008-11-10 BUG#40219 : backup_{history,progress}_log_file not settable at server startup The backup_history_log_file and backup_progress_log_file options are not exposed for server startup. This patch exposes those options for setting values on the command line at server startup. modified: mysql-test/suite/backup/r/backup_logs_output.result mysql-test/suite/backup/t/backup_logs_output.test sql/mysqld.cc sql/set_var.cc per-file messages: mysql-test/suite/backup/r/backup_logs_output.result Corrected result file. mysql-test/suite/backup/t/backup_logs_output.test Added test to ensure the command line startup options for backup_*_log_file work as expected. sql/mysqld.cc Added startup options for backup_*_log_file variables. sql/set_var.cc Corrected error in setting default value for backup_*_log_file variables. === modified file 'mysql-test/suite/backup/r/backup_logs_output.result' --- a/mysql-test/suite/backup/r/backup_logs_output.result 2008-11-04 19:59:47 +0000 +++ b/mysql-test/suite/backup/r/backup_logs_output.result 2008-11-10 16:49:10 +0000 @@ -2,9 +2,33 @@ con1 Clear the logs. SET @@global.backup_history_log = 'ON'; SET @@global.backup_progress_log = 'ON'; +Display backup variable values from startup options file. +SHOW VARIABLES LIKE 'backup_history%'; +Variable_name Value +backup_history_log ON +backup_history_log_file MYSQLTEST_VARDIR/master-data/history.txt +SHOW VARIABLES LIKE 'backup_progress%'; +Variable_name Value +backup_progress_log ON +backup_progress_log_file MYSQLTEST_VARDIR/master-data/progress.txt +SHOW VARIABLES LIKE 'log_backup_output'; +Variable_name Value +log_backup_output FILE +Set the backup log file names to default values. +SET @@global.backup_history_log_file = DEFAULT; +SET @@global.backup_progress_log_file = DEFAULT; +SET @@global.log_backup_output = 'TABLE'; FLUSH BACKUP LOGS; PURGE BACKUP LOGS; -Display backup variables +See that the log names have been reset. +SHOW VARIABLES LIKE 'backup_history%'; +Variable_name Value +backup_history_log ON +backup_history_log_file MYSQLTEST_VARDIR/master-data/backup_history.log +SHOW VARIABLES LIKE 'backup_progress%'; +Variable_name Value +backup_progress_log ON +backup_progress_log_file MYSQLTEST_VARDIR/master-data/backup_progress.log SHOW VARIABLES LIKE 'backup_history_log'; Variable_name Value backup_history_log ON === modified file 'mysql-test/suite/backup/t/backup_logs_output.test' --- a/mysql-test/suite/backup/t/backup_logs_output.test 2008-11-04 19:59:47 +0000 +++ b/mysql-test/suite/backup/t/backup_logs_output.test 2008-11-10 16:49:10 +0000 @@ -14,10 +14,31 @@ connection con1; --echo Clear the logs. SET @@global.backup_history_log = 'ON'; SET @@global.backup_progress_log = 'ON'; + +# +# BUG#40219 No startup options for backup_*_logname. +# +--echo Display backup variable values from startup options file. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW VARIABLES LIKE 'backup_history%'; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW VARIABLES LIKE 'backup_progress%'; +SHOW VARIABLES LIKE 'log_backup_output'; + +--echo Set the backup log file names to default values. +SET @@global.backup_history_log_file = DEFAULT; +SET @@global.backup_progress_log_file = DEFAULT; +SET @@global.log_backup_output = 'TABLE'; + FLUSH BACKUP LOGS; PURGE BACKUP LOGS; ---echo Display backup variables +--echo See that the log names have been reset. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW VARIABLES LIKE 'backup_history%'; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +SHOW VARIABLES LIKE 'backup_progress%'; + SHOW VARIABLES LIKE 'backup_history_log'; SHOW VARIABLES LIKE 'backup_progress_log'; SHOW VARIABLES LIKE 'log_backup_output'; @@ -237,30 +258,30 @@ FLUSH BACKUP LOGS; # # BUG#40218 Default setting incorrect # - -SET GLOBAL backup_history_log=0; -SET GLOBAL backup_progress_log=0; + +SET GLOBAL backup_history_log=0; +SET GLOBAL backup_progress_log=0; --echo Should show 'OFF' -SHOW VARIABLES LIKE 'backup%log'; - -SET GLOBAL backup_history_log=1; -SET GLOBAL backup_progress_log=1; +SHOW VARIABLES LIKE 'backup%log'; + +SET GLOBAL backup_history_log=1; +SET GLOBAL backup_progress_log=1; --echo Should show 'ON' -SHOW VARIABLES LIKE 'backup%log'; - -SET GLOBAL backup_history_log=OFF; -SET GLOBAL backup_progress_log=OFF; +SHOW VARIABLES LIKE 'backup%log'; + +SET GLOBAL backup_history_log=OFF; +SET GLOBAL backup_progress_log=OFF; --echo Should show 'OFF' -SHOW VARIABLES LIKE 'backup%log'; - -SET GLOBAL backup_history_log=DEFAULT; -SET GLOBAL backup_progress_log=DEFAULT; - +SHOW VARIABLES LIKE 'backup%log'; + +SET GLOBAL backup_history_log=DEFAULT; +SET GLOBAL backup_progress_log=DEFAULT; + --echo After set default still should show 'ON' -SHOW VARIABLES LIKE 'backup%log'; +SHOW VARIABLES LIKE 'backup%log'; --echo Cleanup DROP DATABASE bup_log; === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2008-11-05 15:07:40 +0000 +++ b/sql/mysqld.cc 2008-11-10 16:49:10 +0000 @@ -5855,7 +5855,9 @@ enum options_mysqld OPT_DEADLOCK_SEARCH_DEPTH_SHORT, OPT_DEADLOCK_SEARCH_DEPTH_LONG, OPT_DEADLOCK_TIMEOUT_SHORT, - OPT_DEADLOCK_TIMEOUT_LONG + OPT_DEADLOCK_TIMEOUT_LONG, + OPT_BACKUP_HISTORY_LOG_FILE, + OPT_BACKUP_PROGRESS_LOG_FILE }; @@ -6123,6 +6125,16 @@ Disable with --skip-large-pages.", {"general_log_file", OPT_GENERAL_LOG_FILE, "Log connections and queries to given file.", (uchar**) &opt_logname, (uchar**) &opt_logname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"backup_history_log_file", OPT_BACKUP_HISTORY_LOG_FILE, + "Log backup history to a given file.", + (uchar**) &opt_backup_history_logname, + (uchar**) &opt_backup_history_logname, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"backup_progress_log_file", OPT_BACKUP_PROGRESS_LOG_FILE, + "Log backup progress to a given file.", + (uchar**) &opt_backup_progress_logname, + (uchar**) &opt_backup_progress_logname, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, "Log update queries in binary format. Optional (but strongly recommended " "to avoid replication problems if server's hostname changes) argument " === modified file 'sql/set_var.cc' --- a/sql/set_var.cc 2008-11-10 16:00:28 +0000 +++ b/sql/set_var.cc 2008-11-10 16:49:10 +0000 @@ -2660,7 +2660,8 @@ bool update_sys_var_str_path(THD *thd, s var_str->value= res; var_str->value_length= str_length; my_free(old_value, MYF(MY_ALLOW_ZERO_PTR)); - if (file_log && log_state) + if ((file_log && log_state) || + (backup_log && log_state)) { /* Added support for backup log types.