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
2720 Rafal Somla 2008-10-29
Fixing compiler warnings.
modified:
sql/log.cc
sql/si_objects.cc
=== 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 push into mysql-6.0-backup branch (jorgen.loland:2720 to 2721) Bug#39602 | Jorgen Loland | 29 Oct |