Description:
The test backup_db_grants is failing in the mysql-6.0-backup tree on machines
'sol10-sparc-a' -max, 'win2003-x86' -max-nt, and 'vm-win2003-64-b' Win64 VS2005 -max-nt.
The 'sol10-sparc-a' -max, and 'vm-win2003-64-b' Win64 VS2005 -max-nt machines generate an
error because the output of the expected error message is garbage:
-ERROR HY000: The grant 'GRANT SELECT ON boo_db_grants.* TO 'bup_user1'@'%' failed.
Database not included in the backup image.
+ERROR HY000: The grant '^�' failed. Database not included in the backup image.
This problem has been traced to a bug in the error reporting mechanism in backup for
64-bit machines. While it is possible to overcome this by restructuring the code, it is
apparent the backup error reporting is not working correctly on all platforms.
The 'win2003-x86' -max-nt machine fails because the RESTORE command for the modified
backup file fails with a different error message:
mysqltest: At line 111: query 'RESTORE FROM 'bup_db_grants.bak'' failed with wrong errno
1677: 'Could not restore table `bup_db_grants`.`s1`', instead of 1732...
This is likely due to the fact that the perl command in the test is not working
correctly. It appears that the modified SQL statement in the backup image is not being
modified correctly.
How to repeat:
Run backup_db_grants test on the machines described above or see the mysql-6.0-backup
tree for details.
Suggested fix:
Correct the error reporting bug for 64-bit machines and change the perl command to
something that works on all platforms. Note: sed will not work because it does not work
on Solaris.
Another possible solution is to change the test to use debug insertion. The changes
needed for this method are:
=== modified file 'mysql-test/t/backup_db_grants.test'
--- mysql-test/t/backup_db_grants.test 2008-08-21 19:28:49 +0000
+++ mysql-test/t/backup_db_grants.test 2008-08-25 16:57:26 +0000
@@ -4,6 +4,7 @@
--source include/not_embedded.inc
--source include/have_sjis.inc
+--source include/have_debug.inc
--disable_warnings
DROP DATABASE IF EXISTS bup_db_grants;
@@ -105,11 +106,15 @@ SHOW GRANTS FOR 'no_user'@'%';
--echo Now demonstrate what happens when grants are altered in backup image.
---exec perl -pi.bak -e "s/ON bup/ON boo/" $MYSQLTEST_VARDIR/master-data/bup_db_
grants.bak
+SET GLOBAL debug="d,backup_test_wrong_db";
+SELECT @@global.debug;
+
--echo Run Restore
--error ER_BACKUP_GRANT_WRONG_DB
RESTORE FROM 'bup_db_grants.bak';
+SET GLOBAL debug="d,";
+
FLUSH PRIVILEGES;
--echo Cleanup
@@ -126,8 +131,6 @@ DROP USER 'no_user'@'%';
FLUSH PRIVILEGES;
--remove_file $MYSQLTEST_VARDIR/master-data/bup_db_grants.bak
-
---remove_file $MYSQLTEST_VARDIR/master-data/bup_db_grants.bak.bak
--echo Now test for encoded user names with an x40 in the middle.
=== modified file 'mysql-test/t/backup_default.test'
--- mysql-test/t/backup_default.test 2008-08-18 08:25:56 +0000
+++ mysql-test/t/backup_default.test 2008-08-22 21:33:23 +0000
@@ -4,6 +4,7 @@
--source include/have_falcon.inc
--source include/have_partition.inc
--source include/not_embedded.inc
+--source include/query_cache.inc
--echo
--echo Server should not crash for backup using default driver - CSV
@@ -99,12 +100,15 @@ ENGINE=myisam;
INSERT INTO myisam_table VALUES(1,'v1'),(2,'v2'),(3,'v3');
+flush_query_cache;
+
--echo backup on mixed table database
--replace_column 1 #
BACKUP DATABASE db1 to 'bup_mixed.bak';
DROP DATABASE db1;
+flush_query_cache;
--echo restore on mixed table database
--replace_column 1 #
RESTORE FROM 'bup_mixed.bak';
=== modified file 'sql/backup/kernel.cc'
--- sql/backup/kernel.cc 2008-08-21 11:36:09 +0000
+++ sql/backup/kernel.cc 2008-08-25 17:10:56 +0000
@@ -1816,6 +1816,14 @@ int bcat_create_item(st_bstream_image_he
db_name.alloc(size);
db_name.length(0);
db_name.append(start, size);
+ DBUG_EXECUTE_IF("backup_test_wrong_db",
+ {
+ db_name.length(0);
+ db_name.append("boo_db_grants");
+ start= strstr((char *)create_stmt.begin, "bup_db_grants");
+ strcpy(start, "boo_db_grants");
+ start[13]= '.';
+ });
if (!info->has_db(db_name))
{
info->m_ctx.fatal_error(ER_BACKUP_GRANT_WRONG_DB, create_stmt);
Description: The test backup_db_grants is failing in the mysql-6.0-backup tree on machines 'sol10-sparc-a' -max, 'win2003-x86' -max-nt, and 'vm-win2003-64-b' Win64 VS2005 -max-nt. The 'sol10-sparc-a' -max, and 'vm-win2003-64-b' Win64 VS2005 -max-nt machines generate an error because the output of the expected error message is garbage: -ERROR HY000: The grant 'GRANT SELECT ON boo_db_grants.* TO 'bup_user1'@'%' failed. Database not included in the backup image. +ERROR HY000: The grant '^�' failed. Database not included in the backup image. This problem has been traced to a bug in the error reporting mechanism in backup for 64-bit machines. While it is possible to overcome this by restructuring the code, it is apparent the backup error reporting is not working correctly on all platforms. The 'win2003-x86' -max-nt machine fails because the RESTORE command for the modified backup file fails with a different error message: mysqltest: At line 111: query 'RESTORE FROM 'bup_db_grants.bak'' failed with wrong errno 1677: 'Could not restore table `bup_db_grants`.`s1`', instead of 1732... This is likely due to the fact that the perl command in the test is not working correctly. It appears that the modified SQL statement in the backup image is not being modified correctly. How to repeat: Run backup_db_grants test on the machines described above or see the mysql-6.0-backup tree for details. Suggested fix: Correct the error reporting bug for 64-bit machines and change the perl command to something that works on all platforms. Note: sed will not work because it does not work on Solaris. Another possible solution is to change the test to use debug insertion. The changes needed for this method are: === modified file 'mysql-test/t/backup_db_grants.test' --- mysql-test/t/backup_db_grants.test 2008-08-21 19:28:49 +0000 +++ mysql-test/t/backup_db_grants.test 2008-08-25 16:57:26 +0000 @@ -4,6 +4,7 @@ --source include/not_embedded.inc --source include/have_sjis.inc +--source include/have_debug.inc --disable_warnings DROP DATABASE IF EXISTS bup_db_grants; @@ -105,11 +106,15 @@ SHOW GRANTS FOR 'no_user'@'%'; --echo Now demonstrate what happens when grants are altered in backup image. ---exec perl -pi.bak -e "s/ON bup/ON boo/" $MYSQLTEST_VARDIR/master-data/bup_db_ grants.bak +SET GLOBAL debug="d,backup_test_wrong_db"; +SELECT @@global.debug; + --echo Run Restore --error ER_BACKUP_GRANT_WRONG_DB RESTORE FROM 'bup_db_grants.bak'; +SET GLOBAL debug="d,"; + FLUSH PRIVILEGES; --echo Cleanup @@ -126,8 +131,6 @@ DROP USER 'no_user'@'%'; FLUSH PRIVILEGES; --remove_file $MYSQLTEST_VARDIR/master-data/bup_db_grants.bak - ---remove_file $MYSQLTEST_VARDIR/master-data/bup_db_grants.bak.bak --echo Now test for encoded user names with an x40 in the middle. === modified file 'mysql-test/t/backup_default.test' --- mysql-test/t/backup_default.test 2008-08-18 08:25:56 +0000 +++ mysql-test/t/backup_default.test 2008-08-22 21:33:23 +0000 @@ -4,6 +4,7 @@ --source include/have_falcon.inc --source include/have_partition.inc --source include/not_embedded.inc +--source include/query_cache.inc --echo --echo Server should not crash for backup using default driver - CSV @@ -99,12 +100,15 @@ ENGINE=myisam; INSERT INTO myisam_table VALUES(1,'v1'),(2,'v2'),(3,'v3'); +flush_query_cache; + --echo backup on mixed table database --replace_column 1 # BACKUP DATABASE db1 to 'bup_mixed.bak'; DROP DATABASE db1; +flush_query_cache; --echo restore on mixed table database --replace_column 1 # RESTORE FROM 'bup_mixed.bak'; === modified file 'sql/backup/kernel.cc' --- sql/backup/kernel.cc 2008-08-21 11:36:09 +0000 +++ sql/backup/kernel.cc 2008-08-25 17:10:56 +0000 @@ -1816,6 +1816,14 @@ int bcat_create_item(st_bstream_image_he db_name.alloc(size); db_name.length(0); db_name.append(start, size); + DBUG_EXECUTE_IF("backup_test_wrong_db", + { + db_name.length(0); + db_name.append("boo_db_grants"); + start= strstr((char *)create_stmt.begin, "bup_db_grants"); + strcpy(start, "boo_db_grants"); + start[13]= '.'; + }); if (!info->has_db(db_name)) { info->m_ctx.fatal_error(ER_BACKUP_GRANT_WRONG_DB, create_stmt);