List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:September 10 2009 4:04pm
Subject:bzr commit into mysql-6.0-backup branch (charles.bell:2867) Bug#46574
View as plain text  
#At file:///Users/cbell/source/bzr/mysql-6.0-bug-46574/ based on revid:charles.bell@stripped

 2867 Chuck Bell	2009-09-10
      BUG#46574 : Backup fails to return error ER_BACKUP_BINLOG
      
      The ER_BACKUP_BINLOG error is not detected in the current
      code. The WL#4722 patch provided a debug insertion test
      that revealed the error was not being handled correctly.
      
      This patch corrects the problem by detecting the error
      returned by the save_vp_info() method.
     @ mysql-test/suite/backup/r/backup_errors_debug_1.result
        Corrected result file that includes enabled test case.
     @ mysql-test/suite/backup/t/backup_errors_debug_1-master.opt
        Added option file to turn on binlog for test case.
     @ mysql-test/suite/backup/t/backup_errors_debug_1.test
        Enabled test case.
     @ sql/backup/data_backup.cc
        Add error detection for return of save_vp_info().
        Corrected debug insertion code for ER_BACKUP_BINLOG.

    added:
      mysql-test/suite/backup/t/backup_errors_debug_1-master.opt
    modified:
      mysql-test/suite/backup/r/backup_errors_debug_1.result
      mysql-test/suite/backup/t/backup_errors_debug_1.test
      sql/backup/data_backup.cc
=== modified file 'mysql-test/suite/backup/r/backup_errors_debug_1.result'
--- a/mysql-test/suite/backup/r/backup_errors_debug_1.result	2009-09-10 13:31:31 +0000
+++ b/mysql-test/suite/backup/r/backup_errors_debug_1.result	2009-09-10 16:04:27 +0000
@@ -44,6 +44,44 @@ PURGE BACKUP LOGS;
 # Begin test cases.
 #
 #
+# Test case 1 - testing error ER_BACKUP_BINLOG
+#
+# Set debug SESSION variable for ER_BACKUP_BINLOG
+#
+SET SESSION debug="+d,ER_BACKUP_BINLOG";
+#
+# Execute backup
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+ERROR HY000: Error on accessing binlog during BACKUP
+#
+# Test case for error ER_BACKUP_BINLOG PASSED.
+#
+#
+# Show warning/error from progress and history log
+# if they exist.
+#
+SELECT * FROM mysql.backup_progress WHERE error_num <> 0;
+backup_id	object	error_num	notes
+#		####	Error on accessing binlog during BACKUP
+PURGE BACKUP LOGS;
+#
+# Turn off debug SESSION.
+#
+SET SESSION debug="-d";
+#
+# Now demonstrate that the command will work without the
+# debug session tag.
+#
+# Running backup - should not fail.
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+backup_id
+#
+#
+# Done.
+#
+#
 # Test case 2 - testing error ER_BACKUP_CANT_RESTORE_DB
 #
 # Set debug SESSION variable for ER_BACKUP_CANT_RESTORE_DB

=== added file 'mysql-test/suite/backup/t/backup_errors_debug_1-master.opt'
--- a/mysql-test/suite/backup/t/backup_errors_debug_1-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_errors_debug_1-master.opt	2009-09-10 16:04:27 +0000
@@ -0,0 +1 @@
+--log-bin

=== modified file 'mysql-test/suite/backup/t/backup_errors_debug_1.test'
--- a/mysql-test/suite/backup/t/backup_errors_debug_1.test	2009-09-08 18:48:16 +0000
+++ b/mysql-test/suite/backup/t/backup_errors_debug_1.test	2009-09-10 16:04:27 +0000
@@ -27,8 +27,6 @@
 # Debug Insertion
 # ---------------
 #  1. ER_BACKUP_BINLOG
-#     Note: Test cannot be run due to flaw in error handling. 
-#     See BUG#46574. Test case must be added when bug is fixed.
 #  2. ER_BACKUP_CANT_RESTORE_DB
 #  3. ER_BACKUP_CANT_RESTORE_EVENT
 #  4. ER_BACKUP_CANT_RESTORE_PRIV
@@ -105,7 +103,7 @@ LET $caseno = 1;
 LET $errno = $ER_BACKUP_BINLOG;
 LET $errname = ER_BACKUP_BINLOG;
 LET $operation = BACKUP;
-#--source suite/backup/include/test_for_error.inc
+--source suite/backup/include/test_for_error.inc
 
 # Test for error ER_BACKUP_CANT_RESTORE_DB.
 LET $caseno = 2;

=== modified file 'sql/backup/data_backup.cc'
--- a/sql/backup/data_backup.cc	2009-09-10 13:31:31 +0000
+++ b/sql/backup/data_backup.cc	2009-09-10 16:04:27 +0000
@@ -470,12 +470,11 @@ int save_vp_info(Backup_info &info)
   */
   if (mysql_bin_log.is_open())
   {
-
-    DBUG_EXECUTE_IF("ER_BACKUP_BINLOG",
-      info.m_log.report_error(ER_BACKUP_BINLOG);
-      return TRUE;);
-
-    if (mysql_bin_log.get_current_log(&binlog_start_pos))
+    ret= mysql_bin_log.get_current_log(&binlog_start_pos);
+    
+    DBUG_EXECUTE_IF("ER_BACKUP_BINLOG", ret= TRUE;);
+    
+    if (ret)
     {
       info.m_log.report_error(ER_BACKUP_BINLOG);
       ret= TRUE;
@@ -745,7 +744,8 @@ int write_table_data(THD* thd, Backup_in
     if (sch.lock())    // logs errors
       goto error;
 
-    save_vp_info(info);
+    if (save_vp_info(info))
+      goto error;
 
     DEBUG_SYNC(thd, "before_backup_data_unlock");
     if (sch.unlock() || log.report_killed())    // logs errors


Attachment: [text/bzr-bundle] bzr/charles.bell@sun.com-20090910160427-9tamapgz19yg006a.bundle
Thread
bzr commit into mysql-6.0-backup branch (charles.bell:2867) Bug#46574Chuck Bell10 Sep