MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Rafal Somla Date:November 25 2008 7:36pm
Subject:bzr commit into mysql-6.0-backup branch (Rafal.Somla:2747) Bug#40307
View as plain text  
#At file:///ext/mysql/bzr/backup/bug40307/

 2747 Rafal Somla	2008-11-25
      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 NN database(s) <list of databases>
       [Note] Backup: Backup completed
      
       [Note] Restore: Starting restore process
       [Note] Restore: Restoring NN 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-25 17:44:19 +0000
+++ b/sql/backup/kernel.cc	2008-11-25 19:36:04 +0000
@@ -177,15 +177,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-11-25 17:44:19 +0000
+++ b/sql/backup/logger.cc	2008-11-25 19:36:04 +0000
@@ -155,6 +155,43 @@ 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(",");
+    const size_t len= strnlen(db->describe(name_buf), sizeof(name_buf));
+    /*
+      If appending next database name would create too long string, append
+      elipsis instead and break the loop.
+      
+      The length limit 220-4 is computed as follows. The placeholder for 
+      database list in ER_BACKUP_BACKUP/RESTORE_DBS has maximum width 220 from
+      which we subtract 4 for ",...", which should fit if the loop iterates 
+      once more.
+
+      The width 220 for database list placaholder is chosen so that a complete 
+      message fits into 256 characters.
+    */
+    if (dbs.length() + len > 220-4)
+    {
+      dbs.append("...");
+      break;
+    }
+    dbs.append(name_buf);
+  }
+
+  // Log the databases.
+
+  report_error(log_level::INFO, m_type == BACKUP ? ER_BACKUP_BACKUP_DBS
+                                                 : ER_BACKUP_RESTORE_DBS, 
+                                info.db_count(), dbs.c_ptr());
 }
 
 /**

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-11-19 22:08:05 +0000
+++ b/sql/share/errmsg.txt	2008-11-25 19:36:04 +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 %u database(s) %.220s"
+ER_BACKUP_RESTORE_DBS
+  eng "Restoring %u database(s) %.220s"

Thread
bzr commit into mysql-6.0-backup branch (Rafal.Somla:2747) Bug#40307Rafal Somla25 Nov
  • Re: bzr commit into mysql-6.0-backup branch (Rafal.Somla:2747)Bug#40307Jørgen Løland26 Nov
    • Re: bzr commit into mysql-6.0-backup branch (Rafal.Somla:2747)Bug#40307Rafal Somla26 Nov
  • Re: bzr commit into mysql-6.0-backup branch (Rafal.Somla:2747)Bug#40307Øystein Grøvlen26 Nov