Below is the list of changes that have just been committed into a local
5.1 repository of rafal. When rafal does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-04-18 16:22:52+02:00, rafal@quant.(none) +3 -0
WL#3327: Handle situation when there is no tables to backup/restore.
mysql-test/r/backup_no_data.result@stripped, 2007-04-18 16:22:49+02:00, rafal@quant.(none) +71 -2
Result update.
mysql-test/t/backup_no_data.test@stripped, 2007-04-18 16:22:49+02:00, rafal@quant.(none) +34 -0
Add the case of a database with no tables in it.
sql/backup/data_backup.cc@stripped, 2007-04-18 16:22:49+02:00, rafal@quant.(none) +6 -0
Handle situation when there is no tables to backup/restore.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: rafal
# Host: quant.(none)
# Root: /ext/mysql/bk/backup/prototype
--- 1.1/mysql-test/r/backup_no_data.result 2007-04-18 16:24:18 +02:00
+++ 1.2/mysql-test/r/backup_no_data.result 2007-04-18 16:24:18 +02:00
@@ -2,6 +2,66 @@
Warnings:
Note 1008 Can't drop database 'empty_db'; database doesn't exist
CREATE DATABASE empty_db;
+BACKUP DATABASE empty_db TO 'empty_db.bak';
+Backup Summary
+Backed up 0 table in database empty_db.
+
+ header = 56 bytes
+ data = 0 bytes
+ --------------
+ total 56 bytes
+BACKUP DATABASE * TO 'all.bak';
+Backup Summary
+Backed up 0 table in database empty_db.
+Backed up 0 table in database test.
+
+ header = 100 bytes
+ data = 0 bytes
+ --------------
+ total 100 bytes
+DROP DATABASE empty_db;
+DROP DATABASE test;
+SHOW DATABASES;
+Database
+information_schema
+mysql
+SHOW DATABASES;
+Database
+information_schema
+mysql
+RESTORE DATABASE FROM 'all.bak';
+Restore Summary
+Restored 0 table in database empty_db.
+Restored 0 table in database test.
+
+ header = 100 bytes
+ data = 0 bytes
+ --------------
+ total 100 bytes
+SHOW DATABASES;
+Database
+information_schema
+empty_db
+mysql
+test
+DROP DATABASE empty_db;
+DROP DATABASE test;
+RESTORE DATABASE FROM 'empty_db.bak';
+Restore Summary
+Restored 0 table in database empty_db.
+
+ header = 56 bytes
+ data = 0 bytes
+ --------------
+ total 56 bytes
+SHOW DATABASES;
+Database
+information_schema
+empty_db
+mysql
+SHOW TABLES IN empty_db;
+Tables_in_empty_db
+USE empty_db;
DROP TABLE IF EXISTS `building`;
Warnings:
Note 1051 Unknown table 'building'
@@ -22,7 +82,6 @@
Database
information_schema
mysql
-test
SHOW BACKUP 'empty_db.bak';
Database Table Metadata
empty_db building CREATE TABLE `empty_db`.`building` (
@@ -33,7 +92,6 @@
Database
information_schema
mysql
-test
RESTORE DATABASE FROM 'empty_db.bak';
Restore Summary
Restored 1 table in database empty_db.
@@ -48,4 +106,15 @@
building
SELECT * FROM building;
dir_code building
+RESTORE DATABASE FROM 'all.bak';
+Restore Summary
+Restored 0 table in database empty_db.
+Restored 0 table in database test.
+
+ header = 100 bytes
+ data = 0 bytes
+ --------------
+ total 100 bytes
+SHOW TABLES IN empty_db;
+Tables_in_empty_db
DROP DATABASE IF EXISTS empty_db;
--- 1.1/mysql-test/t/backup_no_data.test 2007-04-18 16:24:18 +02:00
+++ 1.2/mysql-test/t/backup_no_data.test 2007-04-18 16:24:18 +02:00
@@ -9,6 +9,34 @@
CREATE DATABASE empty_db;
+BACKUP DATABASE empty_db TO 'empty_db.bak';
+BACKUP DATABASE * TO 'all.bak';
+
+DROP DATABASE empty_db;
+DROP DATABASE test;
+
+SHOW DATABASES;
+
+connection restore;
+
+SHOW DATABASES;
+
+RESTORE DATABASE FROM 'all.bak';
+
+SHOW DATABASES;
+
+DROP DATABASE empty_db;
+DROP DATABASE test;
+
+RESTORE DATABASE FROM 'empty_db.bak';
+
+SHOW DATABASES;
+SHOW TABLES IN empty_db;
+
+connection backup;
+
+USE empty_db;
+
--disable warnings
DROP TABLE IF EXISTS `building`;
--enable warnings
@@ -20,7 +48,9 @@
BACKUP DATABASE empty_db TO 'empty_db.bak';
+--disable warnings
DROP DATABASE empty_db;
+--enable warnings
SHOW DATABASES;
@@ -39,6 +69,10 @@
SHOW TABLES;
SELECT * FROM building;
+
+RESTORE DATABASE FROM 'all.bak';
+
+SHOW TABLES IN empty_db;
DROP DATABASE IF EXISTS empty_db;
--- 1.13/sql/backup/data_backup.cc 2007-04-18 16:24:18 +02:00
+++ 1.14/sql/backup/data_backup.cc 2007-04-18 16:24:18 +02:00
@@ -340,6 +340,9 @@
{
DBUG_ENTER("backup::write_table_data");
+ if (info.img_count==0 || info.table_count==0) // nothing to backup
+ DBUG_RETURN(TRUE);
+
Scheduler sch(s); // scheduler instance
List<Backup_subimage> inactive; // list of images not yet being created
size_t max_init_size=0; // keeps maximal init size for images in inactive list
@@ -888,6 +891,9 @@
DBUG_ENTER("restore::restore_table_data");
enum { READING, SENDING, DONE, ERROR } state= READING;
+
+ if (info.img_count==0 || info.table_count==0) // nothing to restore
+ DBUG_RETURN(TRUE);
Restore_driver* drv[32];
uint drv_count;
| Thread |
|---|
| • bk commit into 5.1 tree (rafal:1.2522) | rsomla | 18 Apr |