List:Commits« Previous MessageNext Message »
From:Rafal Somla Date:September 24 2009 4:40pm
Subject:bzr commit into mysql-6.0-backup branch (Rafal.Somla:2873) Bug#46588
View as plain text  
#At file:///ext/mysql/bzr/backup/bug46588/ based on
revid:rafal.somla@stripped

 2873 Rafal Somla	2009-09-24
      Bug#46588 - Backup fails to return ER_BACKUP_CONTEXT_CREATE
      
      The problem was that a call to Logger::report_state(BUP_ERRORS)
      inside Backup_restore_ctx::close() could happen before BACKUP or
      RESTORE operation has started and the logger has been initialized.
      
      This patch adds a guard to the report_state() call so that it is
      done only when the logger has been initialized.
     @ mysql-test/suite/backup/t/backup_errors_debug_2.test
        - Re-enable test cases which previously lead to crash.
     @ sql/backup/backup_kernel.h
        - Call report_state() in Backup_restore_ctx::close()
          only when logger is initialized.

    modified:
      mysql-test/suite/backup/r/backup_errors_debug_2.result
      mysql-test/suite/backup/t/backup_errors_debug_2.test
      sql/backup/backup_kernel.h
=== modified file 'mysql-test/suite/backup/r/backup_errors_debug_2.result'
--- a/mysql-test/suite/backup/r/backup_errors_debug_2.result	2009-09-10 13:31:31 +0000
+++ b/mysql-test/suite/backup/r/backup_errors_debug_2.result	2009-09-24 14:40:08 +0000
@@ -386,6 +386,80 @@ backup_id
 # Done.
 #
 #
+# Test case 31a - testing error ER_BACKUP_CONTEXT_CREATE
+#
+# Set debug SESSION variable for ER_BACKUP_CONTEXT_CREATE
+#
+SET SESSION debug="+d,ER_BACKUP_CONTEXT_CREATE";
+#
+# Execute backup
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+ERROR HY000: Cannot create backup/restore execution context
+#
+# Test case for error ER_BACKUP_CONTEXT_CREATE 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
+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 31b - testing error ER_BACKUP_CONTEXT_CREATE
+#
+# Set debug SESSION variable for ER_BACKUP_CONTEXT_CREATE
+#
+SET SESSION debug="+d,ER_BACKUP_CONTEXT_CREATE";
+#
+# Execute restore
+#
+RESTORE FROM 'backup_test_orig.bak' OVERWRITE;
+ERROR HY000: Cannot create backup/restore execution context
+#
+# Test case for error ER_BACKUP_CONTEXT_CREATE 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
+PURGE BACKUP LOGS;
+#
+# Turn off debug SESSION.
+#
+SET SESSION debug="-d";
+#
+# Now demonstrate that the command will work without the
+# debug session tag.
+#
+# Running restore - should not fail.
+#
+RESTORE FROM 'backup_test_orig.bak' OVERWRITE;
+backup_id
+#
+#
+# Done.
+#
+#
 # Test case 32a - testing error ER_BACKUP_CONTEXT_REMOVE
 #
 # Set debug SESSION variable for ER_BACKUP_CONTEXT_REMOVE

=== modified file 'mysql-test/suite/backup/t/backup_errors_debug_2.test'
--- a/mysql-test/suite/backup/t/backup_errors_debug_2.test	2009-09-10 13:31:31 +0000
+++ b/mysql-test/suite/backup/t/backup_errors_debug_2.test	2009-09-24 14:40:08 +0000
@@ -37,7 +37,6 @@
 # -------------------------
 # 30. ER_BACKUP_CLOSE
 # 31. ER_BACKUP_CONTEXT_CREATE
-#     Test case disabled -- see BUG#46588 
 # 32. ER_BACKUP_CONTEXT_REMOVE
 # 33. ER_BACKUP_CREATE_BACKUP_DRIVER
 # 34. ER_BACKUP_CREATE_BE
@@ -174,21 +173,19 @@ LET $operation = RESTORE;
 #
 # Test case 31 must be run once for backup and once for restore.
 #
-# Test case disabled due to BUG#46588
-#
 # Test for error ER_BACKUP_CONTEXT_CREATE.
 LET $caseno = 31a;
 LET $errno = $ER_BACKUP_CONTEXT_CREATE;
 LET $errname = ER_BACKUP_CONTEXT_CREATE;
 LET $operation = BACKUP;
-#--source suite/backup/include/test_for_error.inc
+--source suite/backup/include/test_for_error.inc
 
 # Test for error ER_BACKUP_CONTEXT_CREATE.
 LET $caseno = 31b;
 LET $errno = $ER_BACKUP_CONTEXT_CREATE;
 LET $errname = ER_BACKUP_CONTEXT_CREATE;
 LET $operation = RESTORE;
-#--source suite/backup/include/test_for_error.inc
+--source suite/backup/include/test_for_error.inc
 
 #
 # Test case 32 must be run once for backup and once for restore.

=== modified file 'sql/backup/backup_kernel.h'
--- a/sql/backup/backup_kernel.h	2009-03-16 14:38:05 +0000
+++ b/sql/backup/backup_kernel.h	2009-09-24 14:40:08 +0000
@@ -254,7 +254,9 @@ int Backup_restore_ctx::fatal_error(int 
     return m_error;
 
   m_error= error_code;
-  report_state(BUP_ERRORS);
+
+  if (Logger::m_state == RUNNING || Logger::m_state == READY)
+    report_state(BUP_ERRORS);
 
   return error_code;
 }


Attachment: [text/bzr-bundle] bzr/rafal.somla@sun.com-20090924144008-vor3rdlbwfmfnhg7.bundle
Thread
bzr commit into mysql-6.0-backup branch (Rafal.Somla:2873) Bug#46588Rafal Somla24 Sep 2009
  • Re: bzr commit into mysql-6.0-backup branch (Rafal.Somla:2873)Bug#46588Charles Bell24 Sep 2009