Description:
The code in logger.cc is designed to return an error if backup operation is interrupted. See @line 254# in logger.cc.
If you use debug insertion (see below), the server will crash. The problem appears in kernel.cc @ line#1164. Note that this is after the error has been handled by the debug insertion test (see below) and appears to be during closing of the stream object.
Note: May be related to BUG#46588.
How to repeat:
You can reproduce the problem using this patch:
=== modified file 'sql/backup/logger.cc'
--- sql/backup/logger.cc 2009-03-16 14:38:05 +0000
+++ sql/backup/logger.cc 2009-08-06 20:50:13 +0000
@@ -239,6 +239,8 @@ bool Logger::push_errors(bool flag)
*/
bool Logger::report_killed()
{
+ // Error code insertion for ER_BACKUP_INTERRUPTED.
+ DBUG_EXECUTE_IF("ER_BACKUP_INTERRUPTED", goto debug_error;);
if (!m_thd->killed)
return FALSE;
@@ -252,6 +254,8 @@ bool Logger::report_killed()
if (m_state == CREATED || m_state == READY)
return TRUE;
+debug_error:
+
// log_error() does not push messages on the server's error stack.
log_error(backup::log_level::INFO, ER_BACKUP_INTERRUPTED);
And this test:
--echo #
--echo # Create database and data to test.
--echo #
CREATE DATABASE backup_test;
CREATE TABLE backup_test.t1 (a char(30)) ENGINE=MEMORY;
INSERT INTO backup_test.t1 VALUES ("01 Test Basic database example");
INSERT INTO backup_test.t1 VALUES ("02 Test Basic database example");
INSERT INTO backup_test.t1 VALUES ("03 Test Basic database example");
INSERT INTO backup_test.t1 VALUES ("04 Test Basic database example");
INSERT INTO backup_test.t1 VALUES ("05 Test Basic database example");
INSERT INTO backup_test.t1 VALUES ("06 Test Basic database example");
INSERT INTO backup_test.t1 VALUES ("07 Test Basic database example");
CREATE TABLE backup_test.t2 (a char(30)) ENGINE=MYISAM;
INSERT INTO backup_test.t2 VALUES ("11 Test Basic database example");
INSERT INTO backup_test.t2 VALUES ("12 Test Basic database example");
INSERT INTO backup_test.t2 VALUES ("13 Test Basic database example");
--echo #
--echo # Now create more database objects for test.
--echo #
CREATE PROCEDURE backup_test.p1(p1 CHAR(20))
INSERT INTO backup_test.t1 VALUES ("50");
CREATE TRIGGER backup_test.trg AFTER INSERT ON backup_test.t1 FOR EACH ROW
INSERT INTO backup_test.t1 VALUES('Test objects count');
CREATE FUNCTION backup_test.f1() RETURNS INT RETURN (SELECT 1);
CREATE VIEW backup_test.v1 as SELECT * FROM backup_test.t1;
CREATE EVENT backup_test.e1 ON SCHEDULE EVERY 1 YEAR DO
DELETE FROM backup_test.t1 WHERE a = "not there";
--echo #
--echo # Now we need some privileges
--echo #
GRANT ALL ON backup_test.* TO 'joe'@'user';
--replace_column 1 #
BACKUP DATABASE backup_test TO 'orig.bak';
SET SESSION debug="+d,ER_BACKUP_INTERRUPTED";
--replace_column 1 #
--error ER_BACKUP_INTERRUPTED
BACKUP DATABASE backup_test TO '1.bak';
Suggested fix:
Unknown.
Once fixed, the test case can be enabled in backup_errors_debug_2.test using the following:
# Test for error ER_BACKUP_INTERRUPTED.
LET $caseno = 37;
LET $errno = $ER_BACKUP_INTERRUPTED;
LET $errname = ER_BACKUP_INTERRUPTED;
LET $operation = BACKUP;
--source suite/backup/include/test_for_error.inc