Rafal,
Code changes looks good to me, but when doing some manual testing, I
noticed the following output when backing up 76 databases:
Backup: Backing up database(s)
`test`,`test1`,`test10`,`test11`,`test12`,`test13`,`test14`,`test15`,`test16`,`test17`,`test18`,`test19`,`test2`,`test20`,`test21`,`test22`,`test23`,`test24`,`test25`,`test26`,`test27`,`test28`,`test29`,`test3`,`test30`,`test31`,`test32`,`test33`,`test
The list is chopped off at about 250 characters.
--
Øystein
Rafal Somla wrote:
> #At file:///ext/mysql/bzr/backup/bug40307/
>
> 2736 Rafal Somla 2008-11-20
> BUG#40307 - Backup: The list of databases processed by BACKUP/RESTORE not
> logged.
>
> After this patch, the trace from BACKUP/RESTOE commands left in server's error
>
> log (master.err) will look as follows:
>
> [Note] Backup: Starting backup process
> [Note] Backup: Backing up database(s) <list of databases>
> [Note] Backup: Backup completed
>
> [Note] Restore: Starting restore process
> [Note] Restore: Restoring database(s) <list of databases>
> [Note] Restore: Restore completed
>
> This way DBA can find out which databases are affected by the operation.
>
> Database list is reported in Logger::report_stats_pre() which is called after
> initializing backup/restore catalogue and before performing backup of table
> data.
> modified:
> sql/backup/kernel.cc
> sql/backup/logger.cc
> sql/share/errmsg.txt
>
> per-file messages:
> sql/backup/kernel.cc
> Remove messages which are replaced by the ones written in
> Logger::report_stats_pre().
> sql/backup/logger.cc
> Compose list of databases in the backup/restore catalogue and report it.
> sql/share/errmsg.txt
> Added messages for reporting database list in error log, so that they can be
> internationalized.
> === modified file 'sql/backup/kernel.cc'
> --- a/sql/backup/kernel.cc 2008-11-17 09:57:51 +0000
> +++ b/sql/backup/kernel.cc 2008-11-20 09:35:26 +0000
> @@ -180,15 +180,9 @@ execute_backup_command(THD *thd, LEX *le
> // select objects to backup
>
> if (lex->db_list.is_empty())
> - {
> - context.write_message(log_level::INFO, "Backing up all databases");
> res= info->add_all_dbs(); // backup all databases
> - }
> else
> - {
> - context.write_message(log_level::INFO, "Backing up selected databases");
> res= info->add_dbs(lex->db_list); // backup databases specified by user
> - }
>
> info->close(); // close catalogue after filling it with objects to backup
>
>
> === modified file 'sql/backup/logger.cc'
> --- a/sql/backup/logger.cc 2008-10-27 13:06:21 +0000
> +++ b/sql/backup/logger.cc 2008-11-20 09:35:26 +0000
> @@ -125,6 +125,25 @@ void Logger::report_stats_pre(const Imag
> {
> DBUG_ASSERT(m_state == RUNNING);
> backup_log->num_objects(info.table_count());
> + // Compose list of databases.
> +
> + Image_info::Db_iterator *it= info.get_dbs();
> + Image_info::Obj *db;
> + Image_info::Obj::describe_buf name_buf;
> + String dbs;
> +
> + while((db= (*it)++))
> + {
> + if (!dbs.is_empty())
> + dbs.append(",");
> + dbs.append(db->describe(name_buf));
> + }
> +
> + // Log the databases.
> +
> + report_error(log_level::INFO, m_type == BACKUP ? ER_BACKUP_BACKUP_DBS
> + : ER_BACKUP_RESTORE_DBS,
> + dbs.c_ptr());
> }
>
> /**
>
> === modified file 'sql/share/errmsg.txt'
> --- a/sql/share/errmsg.txt 2008-11-17 09:57:51 +0000
> +++ b/sql/share/errmsg.txt 2008-11-20 09:35:26 +0000
> @@ -6436,3 +6436,7 @@ ER_RESTORE_DB_EXISTS
> eng "Database \'%-.64s\' already exists. Use OVERWRITE flag to overwrite."
> ER_QUERY_CACHE_DISABLED
> eng "Query cache is disabled; restart the server with query_cache_type=1 to enable
> it"
> +ER_BACKUP_BACKUP_DBS
> + eng "Backing up database(s) %.256s"
> +ER_BACKUP_RESTORE_DBS
> + eng "Restoring database(s) %.256s"
>
>
--
Øystein Grøvlen, Senior Staff Engineer
Sun Microsystems, Database Group
Trondheim, Norway