#At file:///home/oysteing/mysql/mysql-6.0-backup/ based on revid:ingo.struewing@stripped
2843 oystein.grovlen@stripped 2009-07-08
Bug#39379 Restore of online backup ignoring NO_ENGINE_SUBSTITUTION sql_mode
Do not allow engine substitution during RESTORE.
@ mysql-test/suite/backup/r/backup_nodata_driver.result
Updated result file with output of new test case.
@ mysql-test/suite/backup/t/backup_nodata_driver.test
Test that restore fails for a backcup image that contains a table in a storage engine that is not available.
@ sql/si_objects.cc
Add MODE_NO_ENGINE_SUBSTITUTION to default sql_mode so that engine
subsititution is not performed during restore.
modified:
mysql-test/suite/backup/r/backup_nodata_driver.result
mysql-test/suite/backup/t/backup_nodata_driver.test
sql/si_objects.cc
=== modified file 'mysql-test/suite/backup/r/backup_nodata_driver.result'
--- a/mysql-test/suite/backup/r/backup_nodata_driver.result 2008-11-21 15:02:34 +0000
+++ b/mysql-test/suite/backup/r/backup_nodata_driver.result 2009-07-08 07:04:26 +0000
@@ -308,7 +308,22 @@ a b c
SELECT * FROM bup_nodata.e1;
Period Vapor_period
#
+# Check that restore fails if the backup image contains
+# a table in a storage engine that is not available (BUG#39379).
+#
+# Uninstall EXAMPLE plugin. Restore should now fail.
+# (To be able to uninstall plugin, database needs to be dropped first)
+#
+DROP DATABASE bup_nodata;
+UNINSTALL plugin EXAMPLE;
+RESTORE FROM 'bup_nodata.bak';
+ERROR HY000: Could not restore table `bup_nodata`.`e1`
+SHOW WARNINGS;
+Level Code Message
+Error # Unknown storage engine 'EXAMPLE'
+Error # Could not restore table `bup_nodata`.`e1`
+Warning # Operation aborted - data might be corrupted
+#
# Cleanup.
#
DROP DATABASE bup_nodata;
-UNINSTALL PLUGIN example;
=== modified file 'mysql-test/suite/backup/t/backup_nodata_driver.test'
--- a/mysql-test/suite/backup/t/backup_nodata_driver.test 2009-02-24 20:57:21 +0000
+++ b/mysql-test/suite/backup/t/backup_nodata_driver.test 2009-07-08 07:04:26 +0000
@@ -240,6 +240,21 @@ SELECT * FROM bup_nodata.b1;
SELECT * FROM bup_nodata.e1;
--echo #
+--echo # Check that restore fails if the backup image contains
+--echo # a table in a storage engine that is not available (BUG#39379).
+--echo #
+--echo # Uninstall EXAMPLE plugin. Restore should now fail.
+--echo # (To be able to uninstall plugin, database needs to be dropped first)
+--echo #
+DROP DATABASE bup_nodata;
+UNINSTALL plugin EXAMPLE;
+--error ER_BACKUP_CANT_RESTORE_TABLE
+RESTORE FROM 'bup_nodata.bak';
+--replace_column 2 #
+SHOW WARNINGS;
+
+
+--echo #
--echo # Cleanup.
--echo #
DROP DATABASE bup_nodata;
@@ -247,5 +262,4 @@ DROP DATABASE bup_nodata;
remove_file $MYSQLD_BACKUPDIR/bup_data.bak;
remove_file $MYSQLD_BACKUPDIR/bup_nodata.bak;
-UNINSTALL PLUGIN example;
=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc 2009-06-24 08:05:34 +0000
+++ b/sql/si_objects.cc 2009-07-08 07:04:26 +0000
@@ -111,7 +111,7 @@ void Si_session_context::save_si_ctx(THD
/**
Reset session state to the following:
- - sql_mode: 0
+ - sql_mode: MODE_NO_AUTO_CREATE_USER | MODE_NO_ENGINE_SUBSTITUTION
- character_set_client: utf8
- character_set_results: binary (to fetch results w/o conversion)
- collation_connection: utf8
@@ -124,7 +124,8 @@ void Si_session_context::reset_si_ctx(TH
{
DBUG_ENTER("Si_session_context::reset_si_ctx");
- thd->variables.sql_mode= MODE_NO_AUTO_CREATE_USER;
+ thd->variables.sql_mode=
+ MODE_NO_AUTO_CREATE_USER | MODE_NO_ENGINE_SUBSTITUTION;
thd->variables.character_set_client= system_charset_info;
thd->variables.character_set_results= &my_charset_bin;
Attachment: [text/bzr-bundle]