#At file:///home/rith/Work/MySQl/bug47493/ based on revid:rafal.somla@stripped
2880 Ritheesh Vedire 2009-10-21
BUG#47493: add 'flush-backup-logs' feature to mysqladmin
@ client/mysqladmin.cc
Used the existing SQL command 'flush backup logs'.
@ mysql-test/suite/backup/t/backup_logs_output.test
Irrespective of log_backup_output options log files are created.
So I have tested only for TABLE,FILE option.
The command doesn't return anything when it succeeds.
modified:
client/mysqladmin.cc
mysql-test/suite/backup/r/backup_logs_output.result
mysql-test/suite/backup/t/backup_logs_output.test
=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc 2009-10-12 09:08:34 +0000
+++ b/client/mysqladmin.cc 2009-10-21 14:16:30 +0000
@@ -97,7 +97,7 @@ enum commands {
ADMIN_FLUSH_HOSTS, ADMIN_FLUSH_TABLES, ADMIN_PASSWORD,
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
- ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD
+ ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD, ADMIN_FLUSH_BACKUP_LOGS
};
static const char *command_names[]= {
"create", "drop", "shutdown",
@@ -107,7 +107,7 @@ static const char *command_names[]= {
"flush-hosts", "flush-tables", "password",
"ping", "extended-status", "flush-status",
"flush-privileges", "start-slave", "stop-slave",
- "flush-threads","old-password",
+ "flush-threads", "old-password", "flush-backup-logs",
NullS
};
@@ -885,6 +885,16 @@ static int execute_commands(MYSQL *mysql
}
break;
}
+ case ADMIN_FLUSH_BACKUP_LOGS:
+ {
+ if (mysql_query(mysql,"flush backup logs"))
+ {
+ my_printf_error(0,"refresh failed; error: '%s'", error_flags,
+ mysql_error(mysql));
+ return -1;
+ }
+ break;
+ }
case ADMIN_FLUSH_STATUS:
{
if (mysql_query(mysql,"flush status"))
@@ -1096,6 +1106,7 @@ static void usage(void)
extended-status Gives an extended status message from the server\n\
flush-hosts Flush all cached hosts\n\
flush-logs Flush all logs\n\
+ flush-backup-logs Flush backup logs\n\
flush-status Clear status variables\n\
flush-tables Flush all tables\n\
flush-threads Flush the thread cache\n\
=== modified file 'mysql-test/suite/backup/r/backup_logs_output.result'
--- a/mysql-test/suite/backup/r/backup_logs_output.result 2009-02-06 08:28:24 +0000
+++ b/mysql-test/suite/backup/r/backup_logs_output.result 2009-10-21 14:16:30 +0000
@@ -237,6 +237,7 @@ SELECT count(*) FROM mysql.backup_progre
count(*)
6
FLUSH BACKUP LOGS;
+Test flush-backup-logs from mysqladmin
SET GLOBAL backup_history_log=0;
SET GLOBAL backup_progress_log=0;
Should show 'OFF'
=== modified file 'mysql-test/suite/backup/t/backup_logs_output.test'
--- a/mysql-test/suite/backup/t/backup_logs_output.test 2009-02-24 20:57:21 +0000
+++ b/mysql-test/suite/backup/t/backup_logs_output.test 2009-10-21 14:16:30 +0000
@@ -252,6 +252,18 @@ SELECT count(*) FROM mysql.backup_histor
SELECT count(*) FROM mysql.backup_progress;
FLUSH BACKUP LOGS;
+
+# BUG#47493 - add 'flush backup logs' to mysqladmin.
+#
+# 'flush backup logs' reopens log files.
+# Log files are created irrespective of log_backup_output options.
+# Test 'flush-backup-logs' from mysqladmin for log_backup_ouput=TABLE,FILE.
+#
+--echo Test flush-backup-logs from mysqladmin
+
+--exec $MYSQLADMIN --no-defaults --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= flush-backup-logs 2>&1
+
+
--file_exists $MYSQLD_DATADIR/backup_history.log
--file_exists $MYSQLD_DATADIR/backup_progress.log
Attachment: [text/bzr-bundle]