List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:September 29 2008 6:45pm
Subject:bzr push into mysql-6.0-backup branch (cbell:2696) Bug#33352
View as plain text  
 2696 Chuck Bell	2008-09-29
      BUG#33352 Backup:crash if I use old set of mysql files. 
      
      The error message produced when the backup logs are missing or damaged is
      misleading. This patch changes the error to a more appropriate, instructional
      error message.
modified:
  mysql-test/lib/mtr_report.pl
  mysql-test/r/backup_errors.result
  mysql-test/t/backup_errors.test
  sql/log.cc
  sql/share/errmsg.txt

=== modified file 'mysql-test/lib/mtr_report.pl'
--- a/mysql-test/lib/mtr_report.pl	2008-09-08 11:05:26 +0000
+++ b/mysql-test/lib/mtr_report.pl	2008-09-29 18:41:59 +0000
@@ -331,7 +331,7 @@ sub mtr_report_stats ($) {
 		# backup_errors test is supposed to trigger lots of backup related errors
 		($testname eq 'main.backup_errors') and
 		(
-		  /Backup:/ or /Restore:/ or /Can't open the backup log tables/
+		  /Backup:/ or /Restore:/ or /Can't open the backup logs as tables/
 		) or
 
 		# backup_backupdir test is supposed to trigger backup related errors

=== modified file 'mysql-test/r/backup_errors.result'
--- a/mysql-test/r/backup_errors.result	2008-08-27 17:35:10 +0000
+++ b/mysql-test/r/backup_errors.result	2008-09-29 18:41:59 +0000
@@ -75,7 +75,7 @@ backup_id
 DROP TABLE mysql.backup_history;
 Backup the database;
 BACKUP DATABASE test_ob_error TO 'ob_err.bak';
-ERROR 42S02: Table 'mysql.backup_history' doesn't exist
+ERROR HY000: Can't open the backup logs as tables. Check 'mysql.backup_history' and 'mysql.backup_progress' or run mysql_upgrade to repair.
 SHOW ERRORS;
 Level	Code	Message
 Error	#	Table 'mysql.backup_history' doesn't exist
@@ -86,7 +86,7 @@ DROP TABLE test.ob_copy;
 DROP TABLE mysql.backup_progress;
 Backup the database;
 BACKUP DATABASE test_ob_error TO 'ob_err.bak';
-ERROR 42S02: Table 'mysql.backup_progress' doesn't exist
+ERROR HY000: Can't open the backup logs as tables. Check 'mysql.backup_history' and 'mysql.backup_progress' or run mysql_upgrade to repair.
 SHOW ERRORS;
 Level	Code	Message
 Error	#	Table 'mysql.backup_progress' doesn't exist

=== modified file 'mysql-test/t/backup_errors.test'
--- a/mysql-test/t/backup_errors.test	2008-08-27 17:35:10 +0000
+++ b/mysql-test/t/backup_errors.test	2008-09-29 18:41:59 +0000
@@ -181,7 +181,7 @@ DROP TABLE mysql.backup_history;
 
 # Try to backup the database (should be error).
 --echo Backup the database;
---error ER_NO_SUCH_TABLE
+--error ER_BACKUP_PROGRESS_TABLES
 BACKUP DATABASE test_ob_error TO 'ob_err.bak';
 --error 0,1
 --remove_file $MYSQLTEST_VARDIR/master-data/ob_err.bak
@@ -198,7 +198,7 @@ DROP TABLE mysql.backup_progress;
 
 # Try to backup the database (should be error).
 --echo Backup the database;
---error ER_NO_SUCH_TABLE
+--error ER_BACKUP_PROGRESS_TABLES
 BACKUP DATABASE test_ob_error TO 'ob_err.bak';
 --error 0,1
 --remove_file $MYSQLTEST_VARDIR/master-data/ob_err.bak

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2008-09-18 17:55:53 +0000
+++ b/sql/log.cc	2008-09-29 18:41:59 +0000
@@ -3475,8 +3475,17 @@ my_bool MYSQL_BACKUP_LOG::check_backup_l
   alloc_mdl_locks(&tables, thd->mem_root);
   if (simple_open_n_lock_tables(thd, &tables))
   {
+    /*
+      Here we wish to change the error that is generated by the open method,
+      "table does not exist" to a specific error message for missing
+      backup logs. In this case, we reset the old error and issue the new one.
+    */
     ret= TRUE;
     sql_print_error(ER(ER_BACKUP_PROGRESS_TABLES));
+    thd->main_da.reset_diagnostics_area();
+    thd->main_da.set_error_status(thd, 
+                                  ER_BACKUP_PROGRESS_TABLES, 
+                                  ER(ER_BACKUP_PROGRESS_TABLES));
     DBUG_RETURN(ret);
   }
   close_thread_tables(thd);
@@ -3488,8 +3497,17 @@ my_bool MYSQL_BACKUP_LOG::check_backup_l
   alloc_mdl_locks(&tables, thd->mem_root);
   if (simple_open_n_lock_tables(thd, &tables))
   {
+    /*
+      Here we wish to change the error that is generated by the open method,
+      "table does not exist" to a specific error message for missing
+      backup logs. In this case, we reset the old error and issue the new one.
+    */
     ret= TRUE;
     sql_print_error(ER(ER_BACKUP_PROGRESS_TABLES));
+    thd->main_da.reset_diagnostics_area();
+    thd->main_da.set_error_status(thd, 
+                                  ER_BACKUP_PROGRESS_TABLES, 
+                                  ER(ER_BACKUP_PROGRESS_TABLES));
     DBUG_RETURN(ret);
   }
   close_thread_tables(thd);

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-09-03 12:39:48 +0000
+++ b/sql/share/errmsg.txt	2008-09-29 18:41:59 +0000
@@ -6251,7 +6251,7 @@ ER_BACKUP_THREAD_INIT
         eng "Backup driver's table locking thread can not be initialized."
 
 ER_BACKUP_PROGRESS_TABLES
-        eng "Can't open the backup log tables. Check 'mysql.backup_history' and 'mysql.backup_progress'."
+        eng "Can't open the backup logs as tables. Check 'mysql.backup_history' and 'mysql.backup_progress' or run mysql_upgrade to repair."
 
 ER_TABLESPACE_EXIST
   eng "Tablespace '%-.192s' already exists"

Thread
bzr push into mysql-6.0-backup branch (cbell:2696) Bug#33352Chuck Bell29 Sep