List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:March 6 2009 8:38pm
Subject:bzr commit into mysql-6.0-backup branch (ingo.struewing:2791) Bug#42756
View as plain text  
#At file:///home2/mydev/bzrroot/mysql-6.0-bug42756-1/ based on revid:jorgen.loland@stripped

 2791 Ingo Struewing	2009-03-06
      Bug#42756 - Backup: "backup database *" then restore does not preserve mtr state
      
      The problem was that BACKUP included the default privileges for the
      test database, which RESTORE could not re-create.
      
      The default privileges are created during database install.
      They refer to the non-existent special user ''@'%'.
      They cannot be influenced by GRANT or REVOKE statements,
      neither by DROP DATABASE 'test'.
      So BACKUP/RESTORE don't need to deal with them.
      
      Changed BACKUP so that it does not include these privileges in the backup image.
      
      Split backup_sync.test from backup.test.
     @ mysql-test/suite/backup/r/backup.result
        Bug#42756 - Backup: "backup database *" then restore does not preserve mtr state
        Updated test result.
     @ mysql-test/suite/backup/r/backup_sync.result
        Bug#42756 - Backup: "backup database *" then restore does not preserve mtr state
        New test result.
     @ mysql-test/suite/backup/t/backup.test
        Bug#42756 - Backup: "backup database *" then restore does not preserve mtr state
        Moved the test that uses DEBUG_SYNC to backup_sync.test.
        Restructured cleanup sequences.
        Added new test.
     @ mysql-test/suite/backup/t/backup_sync.test
        Bug#42756 - Backup: "backup database *" then restore does not preserve mtr state
        New test case for tests that need DEBUG_SYNC. Contents comes from backup.test.
     @ sql/si_objects.cc
        Bug#42756 - Backup: "backup database *" then restore does not preserve mtr state
        Fixed a compiler warning.
        Excluded default privileges for the test database (user ''@'%').

    added:
      mysql-test/suite/backup/r/backup_sync.result
      mysql-test/suite/backup/t/backup_sync.test
    modified:
      mysql-test/suite/backup/r/backup.result
      mysql-test/suite/backup/t/backup.test
      sql/si_objects.cc
=== modified file 'mysql-test/suite/backup/r/backup.result'
--- a/mysql-test/suite/backup/r/backup.result	2009-02-20 09:31:52 +0000
+++ b/mysql-test/suite/backup/r/backup.result	2009-03-06 20:38:17 +0000
@@ -1,137 +1,4 @@
-SET DEBUG_SYNC= 'RESET';
 DROP DATABASE IF EXISTS db1;
-DROP DATABASE IF EXISTS db2;
-DROP DATABASE IF EXISTS db3;
-CREATE DATABASE db1;
-CREATE DATABASE db2 CHARACTER SET=utf8;
-CREATE DATABASE db3 COLLATE latin1_bin;
-USE db1;
-CREATE TABLE `building` (
-`dir_code` char(4),
-`building` char(6)
-) DEFAULT CHARSET=latin1;
-INSERT INTO `building` VALUES ('N41','1300'),('N01','1453'),('M00','1000'),('N41','1301'),('N41','1305');
-CREATE TABLE `directorate` (
-`dir_code` char(4),
-`dir_name` char(30),
-`dir_head_id` char(9)
-) DEFAULT CHARSET=latin1;
-INSERT INTO `directorate` VALUES ('N41','Development','333445555'),('N01','Human Resources','123654321'),('M00','Management','333444444');
-USE db2;
-CREATE TABLE `staff` (
-`id` char(9),
-`first_name` char(20),
-`mid_name` char(20),
-`last_name` char(30),
-`sex` char(1),
-`salary` int(11),
-`mgr_id` char(9)
-) DEFAULT CHARSET=latin1;
-INSERT INTO `staff` VALUES ('333445555','John','Q','Smith','M',30000,'333444444'),('123763153','William','E','Walters','M',25000,'123654321'),('333444444','Alicia','F','St.Cruz','F',25000,NULL),('921312388','Goy','X','Hong','F',40000,'123654321'),('800122337','Rajesh','G','Kardakarna','M',38000,'333445555'),('820123637','Monty','C','Smythe','M',38000,'333445555'),('830132335','Richard','E','Jones','M',38000,'333445555'),('333445665','Edward','E','Engles','M',25000,'333445555'),('123654321','Beware','D','Borg','F',55000,'333444444'),('123456789','Wilma','N','Maxima','F',43000,'333445555');
-CREATE TABLE `tasking` (
-`id` char(9),
-`project_number` char(9),
-`hours_worked` double(10,2)
-) ENGINE=blackhole DEFAULT CHARSET=latin1;
-INSERT INTO `tasking` VALUES ('333445555','405',23),('123763153','405',33.5),('921312388','601',44),('800122337','300',13),('820123637','300',9.5),('830132335','401',8.5),('333445555','300',11),('921312388','500',13),('800122337','300',44),('820123637','401',500.5),('830132335','400',12),('333445665','600',300.25),('123654321','607',444.75),('123456789','300',1000);
-backup: Activate synchronization points for BACKUP.
-Depending on the driver used, one of the sync points is used,
-and the result differs in PROCESSLIST state and info.
-SET DEBUG_SYNC= 'default_locking_thread_added SIGNAL bup_thread_added
-                 WAIT_FOR finish';
-SET DEBUG_SYNC= concat(lower(@@storage_engine), '_locking_thread_added SIGNAL bup_thread_added WAIT_FOR finish');
-backup: Send the backup command.
-BACKUP DATABASE db1,db2 TO 'test.ba';
-breakpoints: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_thread_added';
-breakpoints: Sending finish signal to wake BACKUP.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-backup_id
-#
-SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
-SELECT validity_point_time FROM mysql.backup_history
-WHERE backup_id = @bid INTO @vp_time;
-SELECT binlog_file FROM mysql.backup_history
-WHERE backup_id = @bid INTO @vp_file;
-SELECT binlog_pos FROM mysql.backup_history
-WHERE backup_id = @bid INTO @vp_pos;
-DROP DATABASE db1;
-DROP DATABASE db2;
-USE mysql;
-RESTORE FROM 'test.ba';
-backup_id
-#
-SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
-SHOW CREATE DATABASE db1;
-Database	Create Database
-db1	CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */
-SHOW CREATE DATABASE db2;
-Database	Create Database
-db2	CREATE DATABASE `db2` /*!40100 DEFAULT CHARACTER SET utf8 */
-SHOW CREATE DATABASE db3;
-Database	Create Database
-db3	CREATE DATABASE `db3` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */
-USE db1;
-SHOW TABLES;
-Tables_in_db1
-building
-directorate
-CHECK TABLE building EXTENDED;
-Table	Op	Msg_type	Msg_text
-db1.building	check	status	OK
-CHECK TABLE directorate EXTENDED;
-Table	Op	Msg_type	Msg_text
-db1.directorate	check	status	OK
-SELECT * FROM building;
-dir_code	building
-N41	1300
-N01	1453
-M00	1000
-N41	1301
-N41	1305
-SELECT * FROM directorate;
-dir_code	dir_name	dir_head_id
-N41	Development	333445555
-N01	Human Resources	123654321
-M00	Management	333444444
-USE db2;
-SHOW TABLES;
-Tables_in_db2
-staff
-tasking
-CHECK TABLE staff EXTENDED;
-Table	Op	Msg_type	Msg_text
-db2.staff	check	status	OK
-SELECT * FROM staff;
-id	first_name	mid_name	last_name	sex	salary	mgr_id
-333445555	John	Q	Smith	M	30000	333444444
-123763153	William	E	Walters	M	25000	123654321
-333444444	Alicia	F	St.Cruz	F	25000	NULL
-921312388	Goy	X	Hong	F	40000	123654321
-800122337	Rajesh	G	Kardakarna	M	38000	333445555
-820123637	Monty	C	Smythe	M	38000	333445555
-830132335	Richard	E	Jones	M	38000	333445555
-333445665	Edward	E	Engles	M	25000	333445555
-123654321	Beware	D	Borg	F	55000	333444444
-123456789	Wilma	N	Maxima	F	43000	333445555
-SHOW CREATE TABLE tasking;
-Table	Create Table
-tasking	CREATE TABLE `tasking` (
-  `id` char(9) DEFAULT NULL,
-  `project_number` char(9) DEFAULT NULL,
-  `hours_worked` double(10,2) DEFAULT NULL
-) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
-SELECT validity_point_time = @vp_time, 
-binlog_file = @vp_file, 
-binlog_pos = @vp_pos
-FROM mysql.backup_history
-WHERE backup_id = @bid;
-validity_point_time = @vp_time	binlog_file = @vp_file	binlog_pos = @vp_pos
-1	1	1
-DROP DATABASE db1;
-DROP DATABASE db2;
-DROP DATABASE db3;
-SET DEBUG_SYNC= 'RESET';
 CREATE DATABASE db1;
 BACKUP DATABASE db1 TO 'db1.bkp';
 backup_id
@@ -545,6 +412,7 @@ COUNT(*)
 SELECT COUNT(*) FROM bup_default.wide;
 COUNT(*)
 1
+DROP DATABASE IF EXISTS bup_delete;
 create the database
 CREATE DATABASE bup_delete;
 create a table and populate it
@@ -633,6 +501,7 @@ DROP DATABASE IF EXISTS bup_default;
 # 
 # Bug#38294 - Backup fails if no database selected.
 #
+DROP DATABASE IF EXISTS bup_usedb;
 CREATE DATABASE bup_usedb;
 CREATE FUNCTION bup_usedb.f1() RETURNS INT RETURN (SELECT 1);
 SHOW TABLES;
@@ -642,5 +511,12 @@ backup_id
 #
 DROP DATABASE bup_usedb;
 #
-# Cleanup
+# Bug#42756 - Backup: "backup database *" then restore
+#             does not preserve mtr state
+#
+BACKUP DATABASE test TO 'bup_test.bak';
+backup_id
+#
+RESTORE FROM 'bup_test.bak' OVERWRITE;
+backup_id
 #

=== added file 'mysql-test/suite/backup/r/backup_sync.result'
--- a/mysql-test/suite/backup/r/backup_sync.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_sync.result	2009-03-06 20:38:17 +0000
@@ -0,0 +1,134 @@
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS db1;
+DROP DATABASE IF EXISTS db2;
+DROP DATABASE IF EXISTS db3;
+CREATE DATABASE db1;
+CREATE DATABASE db2 CHARACTER SET=utf8;
+CREATE DATABASE db3 COLLATE latin1_bin;
+USE db1;
+CREATE TABLE `building` (
+`dir_code` char(4),
+`building` char(6)
+) DEFAULT CHARSET=latin1;
+INSERT INTO `building` VALUES ('N41','1300'),('N01','1453'),('M00','1000'),('N41','1301'),('N41','1305');
+CREATE TABLE `directorate` (
+`dir_code` char(4),
+`dir_name` char(30),
+`dir_head_id` char(9)
+) DEFAULT CHARSET=latin1;
+INSERT INTO `directorate` VALUES ('N41','Development','333445555'),('N01','Human Resources','123654321'),('M00','Management','333444444');
+USE db2;
+CREATE TABLE `staff` (
+`id` char(9),
+`first_name` char(20),
+`mid_name` char(20),
+`last_name` char(30),
+`sex` char(1),
+`salary` int(11),
+`mgr_id` char(9)
+) DEFAULT CHARSET=latin1;
+INSERT INTO `staff` VALUES ('333445555','John','Q','Smith','M',30000,'333444444'),('123763153','William','E','Walters','M',25000,'123654321'),('333444444','Alicia','F','St.Cruz','F',25000,NULL),('921312388','Goy','X','Hong','F',40000,'123654321'),('800122337','Rajesh','G','Kardakarna','M',38000,'333445555'),('820123637','Monty','C','Smythe','M',38000,'333445555'),('830132335','Richard','E','Jones','M',38000,'333445555'),('333445665','Edward','E','Engles','M',25000,'333445555'),('123654321','Beware','D','Borg','F',55000,'333444444'),('123456789','Wilma','N','Maxima','F',43000,'333445555');
+CREATE TABLE `tasking` (
+`id` char(9),
+`project_number` char(9),
+`hours_worked` double(10,2)
+) ENGINE=blackhole DEFAULT CHARSET=latin1;
+INSERT INTO `tasking` VALUES ('333445555','405',23),('123763153','405',33.5),('921312388','601',44),('800122337','300',13),('820123637','300',9.5),('830132335','401',8.5),('333445555','300',11),('921312388','500',13),('800122337','300',44),('820123637','401',500.5),('830132335','400',12),('333445665','600',300.25),('123654321','607',444.75),('123456789','300',1000);
+backup: Activate synchronization points for BACKUP.
+Depending on the driver used, one of the sync points is used,
+and the result differs in PROCESSLIST state and info.
+SET DEBUG_SYNC= 'default_locking_thread_added SIGNAL bup_thread_added
+                 WAIT_FOR finish';
+SET DEBUG_SYNC= concat(lower(@@storage_engine), '_locking_thread_added SIGNAL bup_thread_added WAIT_FOR finish');
+backup: Send the backup command.
+BACKUP DATABASE db1,db2 TO 'test.ba';
+breakpoints: Wait for BACKUP to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_thread_added';
+breakpoints: Sending finish signal to wake BACKUP.
+SET DEBUG_SYNC= 'now SIGNAL finish';
+backup_id
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+SELECT validity_point_time FROM mysql.backup_history
+WHERE backup_id = @bid INTO @vp_time;
+SELECT binlog_file FROM mysql.backup_history
+WHERE backup_id = @bid INTO @vp_file;
+SELECT binlog_pos FROM mysql.backup_history
+WHERE backup_id = @bid INTO @vp_pos;
+DROP DATABASE db1;
+DROP DATABASE db2;
+USE mysql;
+RESTORE FROM 'test.ba';
+backup_id
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+SHOW CREATE DATABASE db1;
+Database	Create Database
+db1	CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+SHOW CREATE DATABASE db2;
+Database	Create Database
+db2	CREATE DATABASE `db2` /*!40100 DEFAULT CHARACTER SET utf8 */
+SHOW CREATE DATABASE db3;
+Database	Create Database
+db3	CREATE DATABASE `db3` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */
+USE db1;
+SHOW TABLES;
+Tables_in_db1
+building
+directorate
+CHECK TABLE building EXTENDED;
+Table	Op	Msg_type	Msg_text
+db1.building	check	status	OK
+CHECK TABLE directorate EXTENDED;
+Table	Op	Msg_type	Msg_text
+db1.directorate	check	status	OK
+SELECT * FROM building;
+dir_code	building
+N41	1300
+N01	1453
+M00	1000
+N41	1301
+N41	1305
+SELECT * FROM directorate;
+dir_code	dir_name	dir_head_id
+N41	Development	333445555
+N01	Human Resources	123654321
+M00	Management	333444444
+USE db2;
+SHOW TABLES;
+Tables_in_db2
+staff
+tasking
+CHECK TABLE staff EXTENDED;
+Table	Op	Msg_type	Msg_text
+db2.staff	check	status	OK
+SELECT * FROM staff;
+id	first_name	mid_name	last_name	sex	salary	mgr_id
+333445555	John	Q	Smith	M	30000	333444444
+123763153	William	E	Walters	M	25000	123654321
+333444444	Alicia	F	St.Cruz	F	25000	NULL
+921312388	Goy	X	Hong	F	40000	123654321
+800122337	Rajesh	G	Kardakarna	M	38000	333445555
+820123637	Monty	C	Smythe	M	38000	333445555
+830132335	Richard	E	Jones	M	38000	333445555
+333445665	Edward	E	Engles	M	25000	333445555
+123654321	Beware	D	Borg	F	55000	333444444
+123456789	Wilma	N	Maxima	F	43000	333445555
+SHOW CREATE TABLE tasking;
+Table	Create Table
+tasking	CREATE TABLE `tasking` (
+  `id` char(9) DEFAULT NULL,
+  `project_number` char(9) DEFAULT NULL,
+  `hours_worked` double(10,2) DEFAULT NULL
+) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
+SELECT validity_point_time = @vp_time, 
+binlog_file = @vp_file, 
+binlog_pos = @vp_pos
+FROM mysql.backup_history
+WHERE backup_id = @bid;
+validity_point_time = @vp_time	binlog_file = @vp_file	binlog_pos = @vp_pos
+1	1	1
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP DATABASE db3;
+SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/suite/backup/t/backup.test'
--- a/mysql-test/suite/backup/t/backup.test	2009-02-24 20:57:21 +0000
+++ b/mysql-test/suite/backup/t/backup.test	2009-03-06 20:38:17 +0000
@@ -1,201 +1,24 @@
+#
+# General backup tests, that do not need DEBUG_SYNC.
+#
 --source include/have_innodb.inc
---source include/have_blackhole.inc
 --source include/not_embedded.inc
---source include/have_debug_sync.inc
 --source include/have_log_bin.inc
 
-SET DEBUG_SYNC= 'RESET';
-
-connect (backup,localhost,root,,);
-connect (breakpoints,localhost,root,,);
-
-connection backup;
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
-DROP DATABASE IF EXISTS db2;
-DROP DATABASE IF EXISTS db3;
-
-let $MYSQLD_BACKUPDIR= `select @@backupdir`;
---error 0,1
-remove_file $MYSQLD_BACKUPDIR/bup_default.bak;
---enable_warnings
-
-CREATE DATABASE db1;
-CREATE DATABASE db2 CHARACTER SET=utf8;
-CREATE DATABASE db3 COLLATE latin1_bin;
-
-USE db1;
-
-CREATE TABLE `building` (
-  `dir_code` char(4),
-  `building` char(6)
-) DEFAULT CHARSET=latin1;
-
-#
-# Dumping data for table `building`
-#
-
-INSERT INTO `building` VALUES ('N41','1300'),('N01','1453'),('M00','1000'),('N41','1301'),('N41','1305');
-
-
-#
-# Table structure for table `directorate`
-#
-
-CREATE TABLE `directorate` (
-  `dir_code` char(4),
-  `dir_name` char(30),
-  `dir_head_id` char(9)
-) DEFAULT CHARSET=latin1;
-
-#
-# Dumping data for table `directorate`
-#
-
-INSERT INTO `directorate` VALUES ('N41','Development','333445555'),('N01','Human Resources','123654321'),('M00','Management','333444444');
-
-USE db2;
-
-#
-# Table structure for table `staff`
-#
-
-CREATE TABLE `staff` (
-  `id` char(9),
-  `first_name` char(20),
-  `mid_name` char(20),
-  `last_name` char(30),
-  `sex` char(1),
-  `salary` int(11),
-  `mgr_id` char(9)
-) DEFAULT CHARSET=latin1;
+--let $MYSQLD_BACKUPDIR= `SELECT @@backupdir`
 
 #
-# Dumping data for table `staff`
-#
-
-INSERT INTO `staff` VALUES ('333445555','John','Q','Smith','M',30000,'333444444'),('123763153','William','E','Walters','M',25000,'123654321'),('333444444','Alicia','F','St.Cruz','F',25000,NULL),('921312388','Goy','X','Hong','F',40000,'123654321'),('800122337','Rajesh','G','Kardakarna','M',38000,'333445555'),('820123637','Monty','C','Smythe','M',38000,'333445555'),('830132335','Richard','E','Jones','M',38000,'333445555'),('333445665','Edward','E','Engles','M',25000,'333445555'),('123654321','Beware','D','Borg','F',55000,'333444444'),('123456789','Wilma','N','Maxima','F',43000,'333445555');
-
-#
-# Table structure for table `tasking`
-#
-
-CREATE TABLE `tasking` (
-  `id` char(9),
-  `project_number` char(9),
-  `hours_worked` double(10,2)
-) ENGINE=blackhole DEFAULT CHARSET=latin1;
-
-#
-# Dumping data for table `tasking`
-#
-
-INSERT INTO `tasking` VALUES ('333445555','405',23),('123763153','405',33.5),('921312388','601',44),('800122337','300',13),('820123637','300',9.5),('830132335','401',8.5),('333445555','300',11),('921312388','500',13),('800122337','300',44),('820123637','401',500.5),('830132335','400',12),('333445665','600',300.25),('123654321','607',444.75),('123456789','300',1000);
-
-#
-# Get a lock to check for locking thread in process list
-# Note that this portion of the test is designed to merely
-# test that the locking thread code is correctly displayed
-# in the process list and not a complete test of the locking
-# thread code.
-#
-connection backup;
---echo backup: Activate synchronization points for BACKUP.
---echo Depending on the driver used, one of the sync points is used,
---echo and the result differs in PROCESSLIST state and info.
-SET DEBUG_SYNC= 'default_locking_thread_added SIGNAL bup_thread_added
-                 WAIT_FOR finish';
-SET DEBUG_SYNC= concat(lower(@@storage_engine), '_locking_thread_added SIGNAL bup_thread_added WAIT_FOR finish');
---echo backup: Send the backup command.
-send BACKUP DATABASE db1,db2 TO 'test.ba';
-
-# get the lock and wait until lock is identified in process list
-connection breakpoints;
---echo breakpoints: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_thread_added';
-
---echo breakpoints: Sending finish signal to wake BACKUP.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-
-# reattach to backup job
-connection backup;
---replace_column 1 #
-reap;
-
-# get backup_id of the BACKUP operation. 
-SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
-
-# store VP time and binlog position
-
-SELECT validity_point_time FROM mysql.backup_history
-WHERE backup_id = @bid INTO @vp_time;
-SELECT binlog_file FROM mysql.backup_history
-WHERE backup_id = @bid INTO @vp_file;
-SELECT binlog_pos FROM mysql.backup_history
-WHERE backup_id = @bid INTO @vp_pos;
-
-DROP DATABASE db1;
-DROP DATABASE db2;
-
-#Disabled until SHOW commands are implemented.
-#SHOW BACKUP 'test.ba';
-
-USE mysql;
-
-# wait few seconds so that restore time != backup time
---sleep 2
-
---replace_column 1 #
-RESTORE FROM 'test.ba';
-
-# determine id of RESTORE operation
-SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
-
-remove_file $MYSQLD_BACKUPDIR/test.ba;
-
-SHOW CREATE DATABASE db1;
-SHOW CREATE DATABASE db2;
-SHOW CREATE DATABASE db3;
-
-USE db1;
-SHOW TABLES;
-
-CHECK TABLE building EXTENDED;
-CHECK TABLE directorate EXTENDED;
-
-SELECT * FROM building;
-SELECT * FROM directorate;
-
-
-USE db2;
-SHOW TABLES;
-
-CHECK TABLE staff EXTENDED;
-
-SELECT * FROM staff;
-SHOW CREATE TABLE tasking;
-
-# check that VP info was correctly read and reported
-
-SELECT validity_point_time = @vp_time, 
-       binlog_file = @vp_file, 
-       binlog_pos = @vp_pos
-FROM mysql.backup_history
-WHERE backup_id = @bid; 
-
-DROP DATABASE db1;
-DROP DATABASE db2;
-DROP DATABASE db3;
-SET DEBUG_SYNC= 'RESET';
-
-#
-# Check that PTR data (such as VP time and binlog positon) is correctly stored and read
+# Check that PTR data (such as VP time and binlog positon)
+# is correctly stored and read
 # when there are no tables to backup (BUG#40262). 
 #
 
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
 --error 0,1
 --remove_file $MYSQLD_BACKUPDIR/db1.bkp
+--enable_warnings
+
 CREATE DATABASE db1;
 
 --replace_column 1 #
@@ -238,10 +61,10 @@ DROP DATABASE db1;
 # This test is for the default and snapshot online backup drivers
 #
 
-connection backup;
-
 --disable_warnings
 DROP DATABASE IF EXISTS bup_default;
+--error 0,1
+--remove_file $MYSQLD_BACKUPDIR/bup_default.bak
 --enable_warnings
 
 CREATE DATABASE bup_default;
@@ -454,6 +277,12 @@ SELECT COUNT(*) FROM bup_default.wide;
 # BUG#35249 : Test backup when rows are deleted
 #
 
+--disable_warnings
+DROP DATABASE IF EXISTS bup_delete;
+--error 0,1
+--remove_file $MYSQLD_BACKUPDIR/bup_delete.bak
+--enable_warnings
+
 --echo create the database
 CREATE DATABASE bup_delete;
 
@@ -485,10 +314,14 @@ DROP TABLE bup_default.t1;
 DROP TABLE bup_default.t2;
 DROP TABLE bup_default.t1_blob;
 DROP TABLE bup_default.wide;
+--remove_file $MYSQLD_BACKUPDIR/bup_delete.bak
+--remove_file $MYSQLD_BACKUPDIR/bup_default.bak
 
 #
 # BUG#33573 : Check timestamp field values on restore.
 #
+--error 0,1
+--remove_file $MYSQLD_BACKUPDIR/bup_default_timestamp.bak
 
 --echo Create table with timestamp and populate.
 CREATE TABLE bup_default.time_t1 (a INT, b TIMESTAMP);
@@ -534,11 +367,18 @@ SELECT * FROM bup_default.time_t1;
 DROP DATABASE IF EXISTS bup_delete;
 DROP DATABASE IF EXISTS bup_default;
 --enable_warnings
+--remove_file $MYSQLD_BACKUPDIR/bup_default_timestamp.bak
 
 --echo # 
 --echo # Bug#38294 - Backup fails if no database selected.
 --echo #
 
+--disable_warnings
+DROP DATABASE IF EXISTS bup_usedb;
+--error 0,1
+--remove_file $MYSQLD_BACKUPDIR/bup_usedb.bak
+--enable_warnings
+
 CREATE DATABASE bup_usedb;
 CREATE FUNCTION bup_usedb.f1() RETURNS INT RETURN (SELECT 1);
 
@@ -560,15 +400,24 @@ SHOW TABLES;
 BACKUP DATABASE bup_usedb TO 'bup_usedb.bak';
 
 DROP DATABASE bup_usedb;
+--remove_file $MYSQLD_BACKUPDIR/bup_usedb.bak
 
 --echo #
---echo # Cleanup
+--echo # Bug#42756 - Backup: "backup database *" then restore
+--echo #             does not preserve mtr state
 --echo #
-
---remove_file $MYSQLD_BACKUPDIR/bup_usedb.bak
---remove_file $MYSQLD_BACKUPDIR/bup_delete.bak
---remove_file $MYSQLD_BACKUPDIR/bup_default_timestamp.bak
---remove_file $MYSQLD_BACKUPDIR/bup_default.bak
+#
+# The problem was that BACKUP included the default privileges for the
+# test database, which RESTORE could not re-create.
+#
 --error 0,1
---remove_file $MYSQLD_BACKUPDIR/test.bak
+--remove_file $MYSQLD_BACKUPDIR/bup_test.bak
+#
+--replace_column 1 #
+BACKUP DATABASE test TO 'bup_test.bak';
+#
+--replace_column 1 #
+RESTORE FROM 'bup_test.bak' OVERWRITE;
+#
+--remove_file $MYSQLD_BACKUPDIR/bup_test.bak
 

=== added file 'mysql-test/suite/backup/t/backup_sync.test'
--- a/mysql-test/suite/backup/t/backup_sync.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_sync.test	2009-03-06 20:38:17 +0000
@@ -0,0 +1,201 @@
+#
+# General backup tests, that use the Debug Sync Facility.
+#
+--source include/have_innodb.inc
+--source include/have_blackhole.inc
+--source include/not_embedded.inc
+--source include/have_debug_sync.inc
+--source include/have_log_bin.inc
+
+SET DEBUG_SYNC= 'RESET';
+
+connect (backup,localhost,root,,);
+connect (breakpoints,localhost,root,,);
+
+connection backup;
+
+--let $MYSQLD_BACKUPDIR= `SELECT @@backupdir`
+
+#
+# Test #1
+#
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+DROP DATABASE IF EXISTS db2;
+DROP DATABASE IF EXISTS db3;
+--error 0,1
+remove_file $MYSQLD_BACKUPDIR/test.ba;
+--enable_warnings
+
+CREATE DATABASE db1;
+CREATE DATABASE db2 CHARACTER SET=utf8;
+CREATE DATABASE db3 COLLATE latin1_bin;
+
+USE db1;
+
+CREATE TABLE `building` (
+  `dir_code` char(4),
+  `building` char(6)
+) DEFAULT CHARSET=latin1;
+
+#
+# Dumping data for table `building`
+#
+
+INSERT INTO `building` VALUES ('N41','1300'),('N01','1453'),('M00','1000'),('N41','1301'),('N41','1305');
+
+
+#
+# Table structure for table `directorate`
+#
+
+CREATE TABLE `directorate` (
+  `dir_code` char(4),
+  `dir_name` char(30),
+  `dir_head_id` char(9)
+) DEFAULT CHARSET=latin1;
+
+#
+# Dumping data for table `directorate`
+#
+
+INSERT INTO `directorate` VALUES ('N41','Development','333445555'),('N01','Human Resources','123654321'),('M00','Management','333444444');
+
+USE db2;
+
+#
+# Table structure for table `staff`
+#
+
+CREATE TABLE `staff` (
+  `id` char(9),
+  `first_name` char(20),
+  `mid_name` char(20),
+  `last_name` char(30),
+  `sex` char(1),
+  `salary` int(11),
+  `mgr_id` char(9)
+) DEFAULT CHARSET=latin1;
+
+#
+# Dumping data for table `staff`
+#
+
+INSERT INTO `staff` VALUES ('333445555','John','Q','Smith','M',30000,'333444444'),('123763153','William','E','Walters','M',25000,'123654321'),('333444444','Alicia','F','St.Cruz','F',25000,NULL),('921312388','Goy','X','Hong','F',40000,'123654321'),('800122337','Rajesh','G','Kardakarna','M',38000,'333445555'),('820123637','Monty','C','Smythe','M',38000,'333445555'),('830132335','Richard','E','Jones','M',38000,'333445555'),('333445665','Edward','E','Engles','M',25000,'333445555'),('123654321','Beware','D','Borg','F',55000,'333444444'),('123456789','Wilma','N','Maxima','F',43000,'333445555');
+
+#
+# Table structure for table `tasking`
+#
+
+CREATE TABLE `tasking` (
+  `id` char(9),
+  `project_number` char(9),
+  `hours_worked` double(10,2)
+) ENGINE=blackhole DEFAULT CHARSET=latin1;
+
+#
+# Dumping data for table `tasking`
+#
+
+INSERT INTO `tasking` VALUES ('333445555','405',23),('123763153','405',33.5),('921312388','601',44),('800122337','300',13),('820123637','300',9.5),('830132335','401',8.5),('333445555','300',11),('921312388','500',13),('800122337','300',44),('820123637','401',500.5),('830132335','400',12),('333445665','600',300.25),('123654321','607',444.75),('123456789','300',1000);
+
+#
+# Get a lock to check for locking thread in process list
+# Note that this portion of the test is designed to merely
+# test that the locking thread code is correctly displayed
+# in the process list and not a complete test of the locking
+# thread code.
+#
+connection backup;
+--echo backup: Activate synchronization points for BACKUP.
+--echo Depending on the driver used, one of the sync points is used,
+--echo and the result differs in PROCESSLIST state and info.
+SET DEBUG_SYNC= 'default_locking_thread_added SIGNAL bup_thread_added
+                 WAIT_FOR finish';
+SET DEBUG_SYNC= concat(lower(@@storage_engine), '_locking_thread_added SIGNAL bup_thread_added WAIT_FOR finish');
+--echo backup: Send the backup command.
+send BACKUP DATABASE db1,db2 TO 'test.ba';
+
+# get the lock and wait until lock is identified in process list
+connection breakpoints;
+--echo breakpoints: Wait for BACKUP to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_thread_added';
+
+--echo breakpoints: Sending finish signal to wake BACKUP.
+SET DEBUG_SYNC= 'now SIGNAL finish';
+
+# reattach to backup job
+connection backup;
+--replace_column 1 #
+reap;
+
+# get backup_id of the BACKUP operation. 
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+# store VP time and binlog position
+
+SELECT validity_point_time FROM mysql.backup_history
+WHERE backup_id = @bid INTO @vp_time;
+SELECT binlog_file FROM mysql.backup_history
+WHERE backup_id = @bid INTO @vp_file;
+SELECT binlog_pos FROM mysql.backup_history
+WHERE backup_id = @bid INTO @vp_pos;
+
+DROP DATABASE db1;
+DROP DATABASE db2;
+
+#Disabled until SHOW commands are implemented.
+#SHOW BACKUP 'test.ba';
+
+USE mysql;
+
+# wait few seconds so that restore time != backup time
+--sleep 2
+
+--replace_column 1 #
+RESTORE FROM 'test.ba';
+
+# determine id of RESTORE operation
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+remove_file $MYSQLD_BACKUPDIR/test.ba;
+
+SHOW CREATE DATABASE db1;
+SHOW CREATE DATABASE db2;
+SHOW CREATE DATABASE db3;
+
+USE db1;
+SHOW TABLES;
+
+CHECK TABLE building EXTENDED;
+CHECK TABLE directorate EXTENDED;
+
+SELECT * FROM building;
+SELECT * FROM directorate;
+
+
+USE db2;
+SHOW TABLES;
+
+CHECK TABLE staff EXTENDED;
+
+SELECT * FROM staff;
+SHOW CREATE TABLE tasking;
+
+# check that VP info was correctly read and reported
+
+SELECT validity_point_time = @vp_time, 
+       binlog_file = @vp_file, 
+       binlog_pos = @vp_pos
+FROM mysql.backup_history
+WHERE backup_id = @bid; 
+
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP DATABASE db3;
+SET DEBUG_SYNC= 'RESET';
+connection default;
+disconnect backup;
+disconnect breakpoints;
+

=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc	2009-03-06 09:45:28 +0000
+++ b/sql/si_objects.cc	2009-03-06 20:38:17 +0000
@@ -2175,7 +2175,7 @@ const String *Tablespace_obj::get_descri
 
   /* Either description or id and data file name must be not empty. */
   DBUG_ASSERT(m_description.length() ||
-              m_id.length() && m_data_file_name.length());
+              (m_id.length() && m_data_file_name.length()));
 
   if (m_description.length())
     DBUG_RETURN(&m_description);
@@ -2458,6 +2458,8 @@ Obj_iterator *get_db_events(THD *thd, co
 Obj_iterator *get_all_db_grants(THD *thd, const String *db_name)
 {
   String_stream s_stream;
+
+  /* Exclude the default privileges for the test database (user ''@'%'). */
   s_stream <<
     "(SELECT grantee AS c1, "
     "privilege_type AS c2, "
@@ -2465,7 +2467,7 @@ Obj_iterator *get_all_db_grants(THD *thd
     "NULL AS c4, "
     "NULL AS c5 "
     "FROM INFORMATION_SCHEMA.SCHEMA_PRIVILEGES "
-    "WHERE table_schema = '" << db_name << "') "
+    "WHERE table_schema = '" << db_name << "' AND grantee <> '''''@''%''') "
     "UNION "
     "(SELECT grantee, "
     "privilege_type, "


Attachment: [text/bzr-bundle] bzr/ingo.struewing@sun.com-20090306203817-7vx87snocwpl5oqs.bundle
Thread
bzr commit into mysql-6.0-backup branch (ingo.struewing:2791) Bug#42756Ingo Struewing6 Mar
  • Re: bzr commit into mysql-6.0-backup branch (ingo.struewing:2791)Bug#42756Rafal Somla9 Mar