MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:October 29 2008 12:16pm
Subject:bzr commit into mysql-6.0-backup branch (jorgen.loland:2721) Bug#39602
View as plain text  
#At file:///localhome/jl208045/mysql/mysql-6.0-backup-39602/

 2721 Jorgen Loland	2008-10-29
      Bug#39602 - Backup: deadlock between backup and myisam
            
      Backup code sets table locks in MyISAM and default drivers before blocking DMLs in the commit blocker. DML operations do this in reverse order. A deadlock could therefore occur.
            
      The patch moves the commit blocker before the table locks are set, thereby removing the potential for a deadlock. This is a temporary solution. WL#4610 is about implementing a refined commit blocker without this problem.
modified:
  sql/backup/data_backup.cc

per-file messages:
  sql/backup/data_backup.cc
    Acquire commit blocker before prepare phase to avoid possibility of deadlock with DMLs when using MyISAM or default backup driver.
=== modified file 'sql/backup/data_backup.cc'
--- a/sql/backup/data_backup.cc	2008-10-14 12:08:56 +0000
+++ b/sql/backup/data_backup.cc	2008-10-29 12:16:33 +0000
@@ -552,6 +552,25 @@ int write_table_data(THD* thd, Backup_in
     DBUG_PRINT("backup_data",("-- PREPARE PHASE --"));
     DEBUG_SYNC(thd, "before_backup_data_prepare");
 
+    /*
+      Note: block_commits is performed here because of the global read
+      lock/table lock deadlock reported in bug#39602. It should be
+      moved back to right before sch.lock() once a refined commit
+      blocker has been implemented. WL#4610 tracks the work on a
+      refined commit blocker
+    */
+    /*
+      Block commits.
+
+      TODO: Step 2 of the commit blocker has been skipped for this release.
+      When it is included, developer needs to build a list of all of the
+      non-transactional tables and pass that to block_commits().
+    */
+    int error= 0;
+    error= block_commits(thd, NULL);
+    if (error)
+      goto error;
+
     if (sch.prepare())
       goto error;
 
@@ -574,16 +593,8 @@ int write_table_data(THD* thd, Backup_in
     DEBUG_SYNC(thd, "after_backup_validated");
     
     /*
-      Block commits.
-
-      TODO: Step 2 of the commit blocker has been skipped for this release.
-      When it is included, developer needs to build a list of all of the
-      non-transactional tables and pass that to block_commits().
+      Refined commit blocker should be set here; see WL#4610
     */
-    int error= 0;
-    error= block_commits(thd, NULL);
-    if (error)
-      goto error;
 
     DEBUG_SYNC(thd, "before_backup_data_lock");
     if (sch.lock())

Thread
bzr commit into mysql-6.0-backup branch (jorgen.loland:2721) Bug#39602Jorgen Loland29 Oct