Below is the list of changes that have just been committed into a local
6.0 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, 2008-04-04 12:16:31+02:00, rafal@quant.(none) +3 -0
WL#4341 (backup stream extension for storing tablespace info):
This patch implements the changes in the backup stream library outlined in the WL. Also
documents
changes in the backup image format.
sql/backup/kernel.cc@stripped, 2008-04-04 12:16:24+02:00, rafal@quant.(none) +3 -0
Add support for table space iterator. Currently it is a null iterator not returning
any items.
sql/backup/stream_v1.c@stripped, 2008-04-04 12:16:25+02:00, rafal@quant.(none) +63 -7
- Document extensions of the backup image format for storing table space information.
- Modify bstream_{wr,rd}_catalogue() to handle the list of table spaces.
- Modify bstream_{wr,rd}_item_type() to handle new item type.
sql/backup/stream_v1.h@stripped, 2008-04-04 12:16:25+02:00, rafal@quant.(none) +1 -0
Add new item type for tablespaces.
diff -Nrup a/sql/backup/kernel.cc b/sql/backup/kernel.cc
--- a/sql/backup/kernel.cc 2008-03-21 10:57:36 +01:00
+++ b/sql/backup/kernel.cc 2008-04-04 12:16:24 +02:00
@@ -1176,6 +1176,9 @@ void* bcat_iterator_get(st_bstream_image
case BSTREAM_IT_USER: // users
return &null_iter;
+ case BSTREAM_IT_TABLESPACE: // table spaces
+ return &null_iter;
+
case BSTREAM_IT_PERDB: // per-db objects, except tables
{
Backup_info::Perdb_iterator *it= info->get_perdb();
diff -Nrup a/sql/backup/stream_v1.c b/sql/backup/stream_v1.c
--- a/sql/backup/stream_v1.c 2008-03-18 15:25:11 +01:00
+++ b/sql/backup/stream_v1.c 2008-04-04 12:16:25 +02:00
@@ -535,8 +535,8 @@ int bstream_rd_image_info(backup_stream
identify and select them.
@verbatim
- [catalogue]= [ charsets ! 0x00 ! users ! 0x00 ! databases |
- db catalogue | ... | db catalogue ]
+ [catalogue]= [ charsets ! 0x00 ! users ! 0x00 ! tablespaces ! 0x00 !
+ databases | db catalogue | ... | db catalogue ]
@endverbatim
Catalogue starts with list of charsets where each charset is identified by its
@@ -560,6 +560,7 @@ int bstream_rd_image_info(backup_stream
The following charsets are any charsets used by the items stored in the image
and thus needed to restore these items.
+
@verbatim
[users]= [ user name ! ... ! user name ]
@@ -567,7 +568,15 @@ int bstream_rd_image_info(backup_stream
User list contains users for which any privileges are stored in the image.
- After [users] a list of all databases follows. If the list is empty, it
+ Following user list is a list of tablespaces used by the tables stored in
+ the backup image. Only tablespace names are listed here, their definitions
+ are stored in the meta-data section.
+ @verbatim
+
+ [tablespaces]= [ ts name ! ... ! ts name ]
+ @endverbatim
+
+ Finally, a list of all databases follows. If the list is empty, it
consists of a single null string. Otherwise it has format:
@verbatim
@@ -584,7 +593,7 @@ int bstream_rd_image_info(backup_stream
are no database catalogues.
@verbatim
- [catalogue (no databases)] = [ charsets ! 0x00 ! users ! 0x00 ]
+ [catalogue (no databases)] = [ charsets ! 0x00 ! users ! 0x00 ! tablespaces ! 0x00 ]
@endverbatim
*/
@@ -642,6 +651,22 @@ int bstream_wr_catalogue(backup_stream *
bcat_iterator_free(cat,it);
+ /* list of table spaces */
+
+ it= bcat_iterator_get(cat,BSTREAM_IT_TABLESPACE);
+
+ if (!it)
+ return BSTREAM_ERROR;
+
+ while ((name= (blob*) bcat_iterator_next(cat,it)))
+ {
+ CHECK_WR_RES(bstream_wr_string(s,*name));
+ }
+
+ CHECK_WR_RES(bstream_wr_byte(s,0x00));
+
+ bcat_iterator_free(cat,it);
+
/* list of databases */
it= bcat_iterator_get(cat,BSTREAM_IT_DB);
@@ -726,6 +751,27 @@ int bstream_rd_catalogue(backup_stream *
/* list of users */
item.type= BSTREAM_IT_USER;
+ item.pos= 0;
+
+ do{
+
+ CHECK_RD_RES(bstream_rd_string(s,&item.name));
+
+ /* empty string signals end of the list */
+ if (item.name.begin == NULL)
+ break;
+
+ if (bcat_add_item(cat,&item) != BSTREAM_OK)
+ return BSTREAM_ERROR;
+
+ item.pos++;
+
+ } while (ret == BSTREAM_OK);
+
+ /* list of table spaces */
+
+ item.type= BSTREAM_IT_TABLESPACE;
+ item.pos= 0;
do{
@@ -815,6 +861,11 @@ int bstream_rd_catalogue(backup_stream *
- 4 = database,
- 5 = table,
- 6 = view.
+ - 7 = stored procedure.
+ - 8 = stored function.
+ - 9 = event.
+ - 10 = trigger.
+ - 11 = table space.
Value 0 doesn't encode a valid item type and is used as item list separator.
*/
@@ -838,6 +889,7 @@ int bstream_wr_item_type(backup_stream *
case BSTREAM_IT_SFUNC: return bstream_wr_int2(s,8);
case BSTREAM_IT_EVENT: return bstream_wr_int2(s,9);
case BSTREAM_IT_TRIGGER: return bstream_wr_int2(s,10);
+ case BSTREAM_IT_TABLESPACE: return bstream_wr_int2(s,11);
case BSTREAM_IT_LAST: return bstream_wr_int2(s,0);
default: return BSTREAM_ERROR;
}
@@ -873,6 +925,7 @@ int bstream_rd_item_type(backup_stream *
case 8: *type= BSTREAM_IT_SFUNC; break;
case 9: *type= BSTREAM_IT_EVENT; break;
case 10: *type= BSTREAM_IT_TRIGGER; break;
+ case 11: *type= BSTREAM_IT_TABLESPACE; break;
default: return BSTREAM_ERROR;
}
@@ -1045,9 +1098,12 @@ int bstream_rd_db_catalogue(backup_strea
[meta data]= [ global items | tables | other items ]
@endverbatim
- [Global items] include all databases. [Tables] section contains all tables
- which are grouped on per-database basis (this is for easier skipping of tables
- upon selective restore).
+ The only global items for which we store meta-data information are tablespaces
+ and databases. Tablespace definitions should come before database definitions
+ on the [global items] list.
+
+ [Tables] section contains all tables which are grouped on per-database basis
+ (this is for easier skipping of tables upon selective restore).
@verbatim
[tables] = [ tables from db1 | ... | tables from dbN ]
diff -Nrup a/sql/backup/stream_v1.h b/sql/backup/stream_v1.h
--- a/sql/backup/stream_v1.h 2008-03-04 17:08:40 +01:00
+++ b/sql/backup/stream_v1.h 2008-04-04 12:16:25 +02:00
@@ -224,6 +224,7 @@ enum enum_bstream_item_type {
BSTREAM_IT_SFUNC,
BSTREAM_IT_EVENT,
BSTREAM_IT_TRIGGER,
+ BSTREAM_IT_TABLESPACE,
BSTREAM_IT_LAST
};