List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:December 15 2008 10:23am
Subject:bzr push into mysql-6.0 branch (jorgen.loland:2736 to 2737) Bug#40970
View as plain text  
 2737 Jorgen Loland	2008-12-15
      Bug#40970 - Errors from commit blocker are not logged.
                  
      If block_commits fails, an error is now logged. unblock_commits cannot fail.
modified:
  mysql-test/suite/backup/r/backup_errors.result
  mysql-test/suite/backup/t/backup_errors.test
  sql/backup/data_backup.cc
  sql/share/errmsg.txt

 2736 Ingo Struewing	2008-12-11 [merge]
      auto-merge
modified:
  CMakeLists.txt
  client/CMakeLists.txt
  dbug/CMakeLists.txt
  extra/CMakeLists.txt
  include/config-win.h
  include/my_pthread.h
  libmysql/CMakeLists.txt
  libmysqld/CMakeLists.txt
  libmysqld/examples/CMakeLists.txt
  mysql-test/suite/ndb/t/disabled.def
  mysys/CMakeLists.txt
  mysys/my_init.c
  mysys/my_thr_init.c
  mysys/my_wincond.c
  mysys/my_winthread.c
  regex/CMakeLists.txt
  scripts/CMakeLists.txt
  scripts/make_win_bin_dist
  sql/CMakeLists.txt
  sql/backup/CMakeLists.txt
  sql/backup/be_thread.cc
  sql/mysqld.cc
  sql/sql_connect.cc
  sql/sql_insert.cc
  sql/udf_example.c
  storage/blackhole/CMakeLists.txt
  storage/csv/CMakeLists.txt
  storage/example/CMakeLists.txt
  storage/heap/CMakeLists.txt
  storage/innobase/CMakeLists.txt
  storage/maria/CMakeLists.txt
  storage/maria/unittest/CMakeLists.txt
  storage/myisam/CMakeLists.txt
  storage/myisammrg/CMakeLists.txt
  strings/CMakeLists.txt
  tests/CMakeLists.txt
  unittest/examples/CMakeLists.txt
  unittest/mysys/CMakeLists.txt
  unittest/mytap/CMakeLists.txt
  vio/CMakeLists.txt
  zlib/CMakeLists.txt

=== modified file 'mysql-test/suite/backup/r/backup_errors.result'
--- a/mysql-test/suite/backup/r/backup_errors.result	2008-12-10 15:53:06 +0000
+++ b/mysql-test/suite/backup/r/backup_errors.result	2008-12-15 09:22:24 +0000
@@ -218,4 +218,17 @@ Show that inserted value 2 is not there
 SELECT * FROM table1;
 text
 Inserted before
+#
+# Test error handling by backup code when injecting commit blocker error.
+#
+SET SESSION DEBUG='+d,backup_grl_fail';
+BACKUP DATABASE db1 TO 'overwrite1.bak';
+ERROR HY000: Backup failed to synchronize table images.
+SET SESSION DEBUG='-d';
+
+SET SESSION DEBUG='+d,backup_grl_block_commit_fail';
+BACKUP DATABASE db1 TO 'overwrite1.bak';
+ERROR HY000: Backup failed to synchronize table images.
+SET SESSION DEBUG='-d';
+
 DROP DATABASE db1;

=== modified file 'mysql-test/suite/backup/t/backup_errors.test'
--- a/mysql-test/suite/backup/t/backup_errors.test	2008-12-10 15:53:06 +0000
+++ b/mysql-test/suite/backup/t/backup_errors.test	2008-12-15 09:22:24 +0000
@@ -377,4 +377,22 @@ RESTORE FROM 'overwrite.bak';
 --echo Show that inserted value 2 is not there
 SELECT * FROM table1;
 
+--echo #
+--echo # Test error handling by backup code when injecting commit blocker error.
+--echo #
+
+SET SESSION DEBUG='+d,backup_grl_fail';
+--error ER_BACKUP_SYNCHRONIZE
+BACKUP DATABASE db1 TO 'overwrite1.bak';
+SET SESSION DEBUG='-d';
+
+--echo
+
+SET SESSION DEBUG='+d,backup_grl_block_commit_fail';
+--error ER_BACKUP_SYNCHRONIZE
+BACKUP DATABASE db1 TO 'overwrite1.bak';
+SET SESSION DEBUG='-d';
+
+--echo
+
 DROP DATABASE db1;

=== modified file 'sql/backup/data_backup.cc'
--- a/sql/backup/data_backup.cc	2008-11-26 10:05:19 +0000
+++ b/sql/backup/data_backup.cc	2008-12-15 09:22:24 +0000
@@ -360,6 +360,10 @@ int block_commits(THD *thd, TABLE_LIST *
 {
   DBUG_ENTER("block_commits()");
 
+  DBUG_EXECUTE_IF("backup_grl_fail", 
+    /* Mimic behavior of a failing lock_global_read_lock */
+    DBUG_RETURN(1););
+
   /*
     Step 1 - global read lock.
   */
@@ -382,6 +386,12 @@ int block_commits(THD *thd, TABLE_LIST *
     result= close_cached_tables(thd, 0, tables);
   */
 
+  DBUG_EXECUTE_IF("backup_grl_block_commit_fail",
+    /* Mimic behavior of a failing make_global_read_lock_block_commit */
+    unlock_global_read_lock(thd);
+    DBUG_RETURN(1);
+  );
+  
   /*
     Step 3 - make the global read lock to block commits.
   */
@@ -402,13 +412,13 @@ int block_commits(THD *thd, TABLE_LIST *
 
    @param  thd    (in) the current thread structure.
 
-   @returns 0
+   This method cannot fail.
   */
-int unblock_commits(THD *thd)
+void unblock_commits(THD *thd)
 {
   DBUG_ENTER("unblock_commits()");
   unlock_global_read_lock(thd);
-  DBUG_RETURN(0);
+  DBUG_VOID_RETURN;
 }
 
 /**
@@ -652,7 +662,10 @@ int write_table_data(THD* thd, Backup_in
     int error= 0;
     error= block_commits(thd, NULL);
     if (error)
+    {
+      log.report_error(ER_BACKUP_SYNCHRONIZE);
       goto error;
+    }
 
     if (sch.prepare())    // logs errors
       goto error;
@@ -691,9 +704,7 @@ int write_table_data(THD* thd, Backup_in
       Unblock commits.
     */
     DEBUG_SYNC(thd, "before_backup_unblock_commit");
-    error= unblock_commits(thd);
-    if (error)
-      goto error;
+    unblock_commits(thd);
 
     report_vp_info(info);
 

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-12-10 15:53:06 +0000
+++ b/sql/share/errmsg.txt	2008-12-15 09:22:24 +0000
@@ -6445,3 +6445,6 @@ ER_BACKUP_BACKUP_DBS
   eng "Backing up %u database(s) %.220s"
 ER_BACKUP_RESTORE_DBS
   eng "Restoring %u database(s) %.220s"
+ER_BACKUP_SYNCHRONIZE
+  eng "Backup failed to synchronize table images."
+

Thread
bzr push into mysql-6.0 branch (jorgen.loland:2736 to 2737) Bug#40970Jorgen Loland15 Dec