#At file:///C:/source/bzr/mysql-6.0-bug-39924/ based on revid:charles.bell@stripped
2807 Chuck Bell 2009-05-06
BUG#39924 : Not possible to use backup logs after BACKUP has been interrupted
When a backup or restore was cancelled or interrupted and the thread
was killed, the backup logs were left in an undefined state. This was
because they were opened using a method that detects a killed thread
and fails if the thread is in a killed state.
This patch includes an override in the table open method that allows
the backup logs to be written if the thread is in a killed state.
Before the patch the logs were incomplete with the error condition
missing from the progress log and the history log entry either
incomplete or not written at all.
This patch ensures the log entries will be written in the event the
thread is killed (backup or restore is cancelled in some unusual
manner).
modified:
mysql-test/suite/backup/r/backup_intr_errors.result
mysql-test/suite/backup/r/backup_logs.result
mysql-test/suite/backup/t/backup_logs.test
mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc
mysql-test/suite/backup_engines/r/backup_interruption.result
mysql-test/suite/backup_engines/t/backup_interruption.test
sql/backup/kernel.cc
sql/log.cc
per-file messages:
mysql-test/suite/backup/r/backup_intr_errors.result
Corrected result file with backup log data.
mysql-test/suite/backup/r/backup_logs.result
New result file.
mysql-test/suite/backup/t/backup_logs.test
New test case to show that backup logs complete writing
of error condition after operation is killed.
mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc
Changed test to show the backup history log information which
was not seen before this patch because the log write was not
completing due the thread being killed when the command was
interrupted.
mysql-test/suite/backup_engines/r/backup_interruption.result
Corrected result file with backup log data.
mysql-test/suite/backup_engines/t/backup_interruption.test
Removed note -- not needed now that bug is fixed.
sql/backup/kernel.cc
Added debug insertion to simulate killing a backup
or restore operation.
sql/log.cc
Added override code to allow backup log to continue writing
if the backup or restore operation is killed.
=== modified file 'mysql-test/suite/backup/r/backup_intr_errors.result'
--- a/mysql-test/suite/backup/r/backup_intr_errors.result 2009-04-09 12:10:27 +0000
+++ b/mysql-test/suite/backup/r/backup_intr_errors.result 2009-05-07 01:44:37 +0000
@@ -57,17 +57,17 @@ Error <error-code> Error on delete of <b
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-backup kernel 0 validity point
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### validity point
+backup kernel #### cancel
+ #### Snapshot backup driver can't cancel its backup operation
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
# Reset debug variable to its original value.
#
# Prepare bup_intr.bkp for RESTORE testing. Note that above BACKUP
@@ -115,16 +115,16 @@ Error <error-code> Backup/Restore: Error
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+ #### Can't shut down Snapshot restore driver(s)
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
# Reset debug variable to its original value.
#
# Restore original database - the interrupted RESTORE statement could
@@ -180,17 +180,17 @@ Error <error-code> Error on delete of <b
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-backup kernel 0 validity point
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### validity point
+backup kernel #### cancel
+ #### Default backup driver can't cancel its backup operation
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
# Reset debug variable to its original value.
#
# Prepare bup_intr.bkp for RESTORE testing. Note that above BACKUP
@@ -238,16 +238,16 @@ Error <error-code> Backup/Restore: Error
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+ #### Can't shut down Default restore driver(s)
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
# Reset debug variable to its original value.
#
# Restore original database - the interrupted RESTORE statement could
=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result 2009-02-26 22:19:09 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result 2009-05-07 01:44:37 +0000
@@ -397,6 +397,53 @@ SET @@global.backup_history_log_file = r
ERROR HY000: The path specified for backup_history_log_file is too long.
SET @@global.backup_history_log_file = DEFAULT;
SET global max_allowed_packet=DEFAULT;
+#
+# Test to see if logs successfully written after command is
+# killed.
+#
+SET SESSION debug="+d,kill_backup";
+The backup id for this command should be 506.
+BACKUP DATABASE backup_logs to 'backup_logs_orig_intr.bak';
+ERROR 70100: Query execution was interrupted
+FLUSH BACKUP LOGS;
+Turn off debugging session.
+# Reset debug variable to its original value.
+Show error state.
+SELECT backup_id, backup_state FROM mysql.backup_history WHERE backup_id = 506;
+backup_id 506
+backup_state error
+Show error state.
+SELECT backup_id, notes FROM mysql.backup_progress WHERE backup_id = 506;
+backup_id 506
+notes starting
+backup_id 506
+notes running
+backup_id 506
+notes cancel
+backup_id 506
+notes error
+# Now try restore.
+SET SESSION debug="+d,kill_restore";
+The backup id for this command should be 507.
+RESTORE FROM 'backup_logs_orig.bak' OVERWRITE;
+ERROR 70100: Query execution was interrupted
+FLUSH BACKUP LOGS;
+Turn off debugging session.
+# Reset debug variable to its original value.
+Show error state.
+SELECT backup_id, backup_state FROM mysql.backup_history WHERE backup_id = 507;
+backup_id 507
+backup_state error
+Show error state.
+SELECT backup_id, notes FROM mysql.backup_progress WHERE backup_id = 507;
+backup_id 507
+notes starting
+backup_id 507
+notes running
+backup_id 507
+notes cancel
+backup_id 507
+notes error
SET @@global.log_backup_output = 'TABLE';
DROP USER 'tom'@'localhost';
SET DEBUG_SYNC= 'reset';
=== modified file 'mysql-test/suite/backup/t/backup_logs.test'
--- a/mysql-test/suite/backup/t/backup_logs.test 2009-03-09 14:00:03 +0000
+++ b/mysql-test/suite/backup/t/backup_logs.test 2009-05-07 01:44:37 +0000
@@ -516,6 +516,54 @@ SET @@global.backup_history_log_file = D
SET global max_allowed_packet=DEFAULT;
+--echo #
+--echo # Test to see if logs successfully written after command is
+--echo # killed.
+--echo #
+let $debug= `SELECT @@debug`;
+SET SESSION debug="+d,kill_backup";
+
+--echo The backup id for this command should be 506.
+--error ER_QUERY_INTERRUPTED
+BACKUP DATABASE backup_logs to 'backup_logs_orig_intr.bak';
+
+FLUSH BACKUP LOGS;
+
+--echo Turn off debugging session.
+--echo # Reset debug variable to its original value.
+--disable_query_log
+eval SET debug= '$debug';
+--enable_query_log
+
+--echo Show error state.
+--query_vertical SELECT backup_id, backup_state FROM mysql.backup_history WHERE backup_id = 506
+
+--echo Show error state.
+--query_vertical SELECT backup_id, notes FROM mysql.backup_progress WHERE backup_id = 506
+
+--echo # Now try restore.
+
+let $debug= `SELECT @@debug`;
+SET SESSION debug="+d,kill_restore";
+
+--echo The backup id for this command should be 507.
+--error ER_QUERY_INTERRUPTED
+RESTORE FROM 'backup_logs_orig.bak' OVERWRITE;
+
+FLUSH BACKUP LOGS;
+
+--echo Turn off debugging session.
+--echo # Reset debug variable to its original value.
+--disable_query_log
+eval SET debug= '$debug';
+--enable_query_log
+
+--echo Show error state.
+--query_vertical SELECT backup_id, backup_state FROM mysql.backup_history WHERE backup_id = 507
+
+--echo Show error state.
+--query_vertical SELECT backup_id, notes FROM mysql.backup_progress WHERE backup_id = 507
+
#
# Cleanup.
#
=== modified file 'mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc'
--- a/mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc 2009-04-09 12:10:27 +0000
+++ b/mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc 2009-05-07 01:44:37 +0000
@@ -98,13 +98,10 @@ SHOW WARNINGS;
--echo #
--echo # Examine backup logs.
--echo #
---echo # FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
---echo # seen in backup_progress table and backup_history table will be empty.
---echo # When the bug is fixed the output below will change and the result file
---echo # should be modifed accordingly.
---echo #
+--replace_regex /[0000-9999]+/####/
SELECT object, error_num, notes FROM mysql.backup_progress;
-query_vertical SELECT * FROM mysql.backup_history;
+--replace_regex /[0000-9999]+/####/
+SELECT backup_state, operation FROM mysql.backup_history;
# check that backup image file was removed
if (!$do_restore)
=== modified file 'mysql-test/suite/backup_engines/r/backup_interruption.result'
--- a/mysql-test/suite/backup_engines/r/backup_interruption.result 2009-03-23 18:46:10 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_interruption.result 2009-05-07 01:44:37 +0000
@@ -40,14 +40,10 @@ Error <error-code> Query execution was i
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-SELECT * FROM mysql.backup_history;
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
######################################################################
#
@@ -81,14 +77,12 @@ Error <error-code> Query execution was i
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
######################################################################
#
@@ -122,14 +116,12 @@ Error <error-code> Query execution was i
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
######################################################################
#
@@ -164,16 +156,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -208,16 +199,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -252,16 +242,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -296,16 +285,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -340,16 +328,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -384,16 +371,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -428,16 +414,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -472,16 +457,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -516,16 +500,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -560,16 +543,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -604,16 +586,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -648,16 +629,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -692,16 +672,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -736,17 +715,16 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-backup kernel 0 validity point
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### validity point
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -781,17 +759,16 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-backup kernel 0 validity point
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### validity point
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -826,19 +803,18 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-backup kernel 0 validity point
-backup kernel 0 vp time
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### validity point
+backup kernel #### vp time
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -873,19 +849,18 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-backup kernel 0 validity point
-backup kernel 0 vp time
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### validity point
+backup kernel #### vp time
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
######################################################################
#
@@ -920,19 +895,18 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-backup kernel 0 validity point
-backup kernel 0 vp time
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### validity point
+backup kernel #### vp time
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error backup
BACKUP DATABASE bup_intr TO 'bup_intr.bkp';
backup_id
#
@@ -970,14 +944,12 @@ Error <error-code> Query execution was i
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
######################################################################
#
@@ -1011,14 +983,12 @@ Error <error-code> Query execution was i
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
######################################################################
#
@@ -1053,16 +1023,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1097,16 +1066,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1141,16 +1109,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1185,16 +1152,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1229,16 +1195,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1273,16 +1238,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1317,16 +1281,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1361,16 +1324,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1405,16 +1367,15 @@ Warning <error-code> Operation aborted
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
######################################################################
#
@@ -1449,16 +1410,15 @@ Warning <error-code> Operation aborted -
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
DROP DATABASE bup_intr;
######################################################################
@@ -1494,16 +1454,15 @@ Warning <error-code> Operation aborted -
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
DROP DATABASE bup_intr;
######################################################################
@@ -1539,16 +1498,15 @@ Warning <error-code> Operation aborted -
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
DROP DATABASE bup_intr;
######################################################################
@@ -1584,16 +1542,15 @@ Warning <error-code> Operation aborted -
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
DROP DATABASE bup_intr;
######################################################################
@@ -1629,16 +1586,15 @@ Warning <error-code> Operation aborted -
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
DROP DATABASE bup_intr;
######################################################################
@@ -1674,16 +1630,15 @@ Warning <error-code> Operation aborted -
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
DROP DATABASE bup_intr;
######################################################################
@@ -1719,16 +1674,15 @@ Warning <error-code> Operation aborted -
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
DROP DATABASE bup_intr;
######################################################################
@@ -1764,16 +1718,15 @@ Warning <error-code> Operation aborted -
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+error restore
DROP DATABASE bup_intr;
######################################################################
@@ -1808,15 +1761,15 @@ Error <error-code> Query execution was i
#
# Examine backup logs.
#
-# FIXME: Until BUG#39924 is fixed, change to BUP_CANCEL state will not be
-# seen in backup_progress table and backup_history table will be empty.
-# When the bug is fixed the output below will change and the result file
-# should be modifed accordingly.
-#
SELECT object, error_num, notes FROM mysql.backup_progress;
object error_num notes
-backup kernel 0 starting
-backup kernel 0 running
-SELECT * FROM mysql.backup_history;
+backup kernel #### starting
+backup kernel #### running
+backup kernel #### cancel
+backup kernel #### error
+backup kernel #### complete
+SELECT backup_state, operation FROM mysql.backup_history;
+backup_state operation
+complete restore
SET DEBUG_SYNC='reset';
DROP DATABASE IF EXISTS bup_intr;
=== modified file 'mysql-test/suite/backup_engines/t/backup_interruption.test'
--- a/mysql-test/suite/backup_engines/t/backup_interruption.test 2009-03-16 14:38:05 +0000
+++ b/mysql-test/suite/backup_engines/t/backup_interruption.test 2009-05-07 01:44:37 +0000
@@ -15,11 +15,6 @@
# which is executed from this script for various synchronization points inside
# BACKUP and RESTORE commands.
#
-# Note: Because of BUG#39924, an interruption is not traced within
-# backup_progress log and backup_history log entry for an interrupted statement
-# is not written. When the bug is fixed, the output of this test will change
-# and the result file should be updated after careful inspection.
-#
--source include/not_embedded.inc
--source suite/backup_engines/include/backup_engine.inc
--source include/have_debug.inc
=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc 2009-04-30 09:24:45 +0000
+++ b/sql/backup/kernel.cc 2009-05-07 01:44:37 +0000
@@ -185,6 +185,8 @@ execute_backup_command(THD *thd,
info->close(); // close catalogue after filling it with objects to backup
+ DBUG_EXECUTE_IF("kill_backup", thd->killed= THD::KILL_QUERY;);
+
if (res || !info->is_valid())
DBUG_RETURN(send_error(context, ER_BACKUP_BACKUP_PREPARE));
@@ -218,6 +220,8 @@ execute_backup_command(THD *thd,
DEBUG_SYNC(thd, "after_backup_start_restore");
+ DBUG_EXECUTE_IF("kill_restore", thd->killed= THD::KILL_QUERY;);
+
res= context.do_restore(overwrite);
DEBUG_SYNC(thd, "restore_before_end");
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2009-04-22 22:12:25 +0000
+++ b/sql/log.cc 2009-05-07 01:44:37 +0000
@@ -794,6 +794,7 @@ bool Log_to_csv_event_handler::
bool save_time_zone_used;
char *host= current_thd->security_ctx->host; // host name
char *user= current_thd->security_ctx->user; // user name
+ THD::killed_state saved_killed_state= THD::NOT_KILLED;
/*
Turn the binlog off and don't replicate the
@@ -812,10 +813,23 @@ bool Log_to_csv_event_handler::
table_list.db= MYSQL_SCHEMA_NAME.str;
table_list.db_length= MYSQL_SCHEMA_NAME.length;
+ /*
+ We need to override checking for a killed thread in the
+ open_performance_schema_table() to allow the backup log
+ to be written even if backup is killed in the middle of
+ execution.
+ */
+ saved_killed_state= thd->killed;
+ if (thd->killed)
+ thd->killed= THD::NOT_KILLED;
+
if (!(table= open_performance_schema_table(thd, & table_list,
& open_tables_backup)))
goto err;
+ if (!thd->killed)
+ thd->killed= saved_killed_state;
+
need_close= TRUE;
if (table->file->extra(HA_EXTRA_MARK_AS_LOG_TABLE) ||
@@ -1025,6 +1039,7 @@ bool Log_to_csv_event_handler::
bool need_rnd_end= FALSE;
Open_tables_state open_tables_backup;
bool save_time_zone_used;
+ THD::killed_state saved_killed_state= THD::NOT_KILLED;
save_time_zone_used= thd->time_zone_used;
@@ -1037,10 +1052,23 @@ bool Log_to_csv_event_handler::
table_list.db= MYSQL_SCHEMA_NAME.str;
table_list.db_length= MYSQL_SCHEMA_NAME.length;
+ /*
+ We need to override checking for a killed thread in the
+ open_performance_schema_table() to allow the backup log
+ to be written even if backup is killed in the middle of
+ execution.
+ */
+ saved_killed_state= thd->killed;
+ if (thd->killed)
+ thd->killed= THD::NOT_KILLED;
+
if (!(table= open_performance_schema_table(thd, & table_list,
& open_tables_backup)))
goto err;
+ if (!thd->killed)
+ thd->killed= saved_killed_state;
+
need_close= TRUE;
if (table->file->extra(HA_EXTRA_MARK_AS_LOG_TABLE) ||
| Thread |
|---|
| • bzr commit into mysql-6.0-backup branch (charles.bell:2807) Bug#39924 | Chuck Bell | 7 May |