List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:September 16 2008 8:12pm
Subject:bzr commit into mysql-6.0-backup branch (cbell:2694) Bug#33352
View as plain text  
#At file:///D:/source/bzr/mysql-6.0-bug-33352/

 2694 Chuck Bell	2008-09-16
      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

per-file messages:
  mysql-test/lib/mtr_report.pl
    Added trap for revised error message.
  mysql-test/r/backup_errors.result
    Result file with error message changes.
  mysql-test/t/backup_errors.test
    Test now produces the correct error message. Previously, the open tables method
produced
    a generic "can't open table" message which is unclear.
  sql/log.cc
    Capture the error handler for the missing or bad backup logs, clear the old
    error, and issue the new error for the user. Previously this error was
    placed in the server log (console) but the user got a generic message which
    was misleading.
  sql/share/errmsg.txt
    Changed error message for clarity.
=== 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-16 18:12:28 +0000
@@ -331,6 +331,12 @@ 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 logs as tables/
+		) or
+
+		# 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/
 		) or
 

=== 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-16 18:12:28 +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-16 18:12:28 +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-11 18:21:54 +0000
+++ b/sql/log.cc	2008-09-16 18:12:28 +0000
@@ -3473,8 +3473,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);
@@ -3486,8 +3495,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-16 18:12:28 +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 commit into mysql-6.0-backup branch (cbell:2694) Bug#33352Chuck Bell16 Sep
  • Re: bzr commit into mysql-6.0-backup branch (cbell:2694) Bug#33352Øystein Grøvlen21 Sep