#At file:///ext/mysql/bzr/backup/stream-doc/ based on revid:rafal.somla@stripped
2869 Rafal Somla 2009-09-08
Followup patch for BUG#40587. It moves definitions of functions
bstream_{rd,wr}_summary() and bstream_{rd,wr}_binlog_pos() in
backup/stream_v1.c so that they are defined at the place where
summary block format is described in the documentation. This is
so that it is easy to verify that functions correctly implement
the described format.
modified:
sql/backup/stream_v1.c
=== modified file 'sql/backup/stream_v1.c'
--- a/sql/backup/stream_v1.c 2009-09-08 06:43:02 +0000
+++ b/sql/backup/stream_v1.c 2009-09-08 07:13:45 +0000
@@ -283,104 +283,6 @@ int bstream_rd_preamble(backup_stream *s
}
-/**
- Save binlog position.
-
- @see @ref summary.
-*/
-int bstream_wr_binlog_pos(backup_stream *s, struct st_bstream_binlog_info pos)
-{
- blob name;
- int ret= BSTREAM_OK;
-
- name.begin= (byte *)pos.file;
- name.end= name.begin + (pos.file ? strlen(pos.file) : 0);
- CHECK_WR_RES(bstream_wr_int4(s,pos.pos));
- CHECK_WR_RES(bstream_wr_string(s,name));
-
- wr_error:
-
- return ret;
-}
-
-/**
- Read binlog position.
-
- @retval BSTREAM_ERROR Error while reading
- @retval BSTREAM_OK Read successful
- @retval BSTREAM_EOC Read successful and end of chunk has been reached
- @retval BSTREAM_EOS Read successful and end of stream has been reached
-
- @see @ref summary.
-*/
-int bstream_rd_binlog_pos(backup_stream *s, struct st_bstream_binlog_info *pos)
-{
- blob name= {NULL, NULL};
- int ret= BSTREAM_OK;
-
- CHECK_RD_OK(bstream_rd_int4(s,&pos->pos));
- CHECK_RD_RES(bstream_rd_string(s,&name));
-
- if (ret != BSTREAM_ERROR)
- pos->file= (char*)name.begin;
-
- rd_error:
-
- return ret;
-}
-
-/**
- Write backup image summary.
-
- This function assumes that all members of the header (such as @c vp_time) are
- already filled. It also stores the 0x00 byte separating summary from the
- preceding table data chunks.
-
- @see @ref summary
-*/
-int bstream_wr_summary(backup_stream *s, struct st_bstream_image_header *hdr)
-{
- int ret= BSTREAM_OK;
-
- CHECK_WR_RES(bstream_wr_byte(s,0x00));
- CHECK_WR_RES(bstream_wr_time(s,&hdr->vp_time));
- CHECK_WR_RES(bstream_wr_time(s,&hdr->end_time));
- CHECK_WR_RES(bstream_wr_binlog_pos(s,hdr->binlog_info));
- CHECK_WR_RES(bstream_wr_binlog_pos(s,hdr->binlog_group));
-
- wr_error:
-
- return ret;
-}
-
-/**
- Read backup image summary
-
- The information stored in the summary section is read and stored in the image
- header structure.
-
- @retval BSTREAM_ERROR Error while reading
- @retval BSTREAM_OK Read successful
- @retval BSTREAM_EOC Read successful and end of chunk has been reached
- @retval BSTREAM_EOS Read successful and end of stream has been reached
-
- @see @ref summary
-*/
-int bstream_rd_summary(backup_stream *s, struct st_bstream_image_header *hdr)
-{
- int ret= BSTREAM_OK;
-
- CHECK_RD_OK(bstream_rd_time(s,&hdr->vp_time));
- CHECK_RD_OK(bstream_rd_time(s,&hdr->end_time));
- CHECK_RD_OK(bstream_rd_binlog_pos(s,&hdr->binlog_info));
- CHECK_RD_RES(bstream_rd_binlog_pos(s,&hdr->binlog_group));
-
- rd_error:
-
- return ret;
-}
-
-
/*************************************************************************
*
* IMAGE HEADER
@@ -2179,6 +2081,105 @@ int bstream_rd_data_chunk(backup_stream
*/
+/**
+ Save binlog position.
+
+ @see @ref summary.
+*/
+int bstream_wr_binlog_pos(backup_stream *s, struct st_bstream_binlog_info pos)
+{
+ blob name;
+ int ret= BSTREAM_OK;
+
+ name.begin= (byte *)pos.file;
+ name.end= name.begin + (pos.file ? strlen(pos.file) : 0);
+ CHECK_WR_RES(bstream_wr_int4(s,pos.pos));
+ CHECK_WR_RES(bstream_wr_string(s,name));
+
+ wr_error:
+
+ return ret;
+}
+
+/**
+ Read binlog position.
+
+ @retval BSTREAM_ERROR Error while reading
+ @retval BSTREAM_OK Read successful
+ @retval BSTREAM_EOC Read successful and end of chunk has been reached
+ @retval BSTREAM_EOS Read successful and end of stream has been reached
+
+ @see @ref summary.
+*/
+int bstream_rd_binlog_pos(backup_stream *s, struct st_bstream_binlog_info *pos)
+{
+ blob name= {NULL, NULL};
+ int ret= BSTREAM_OK;
+
+ CHECK_RD_OK(bstream_rd_int4(s,&pos->pos));
+ CHECK_RD_RES(bstream_rd_string(s,&name));
+
+ if (ret != BSTREAM_ERROR)
+ pos->file= (char*)name.begin;
+
+ rd_error:
+
+ return ret;
+}
+
+
+/**
+ Write backup image summary.
+
+ This function assumes that all members of the header (such as @c vp_time) are
+ already filled. It also stores the 0x00 byte separating summary from the
+ preceding table data chunks.
+
+ @see @ref summary
+*/
+int bstream_wr_summary(backup_stream *s, struct st_bstream_image_header *hdr)
+{
+ int ret= BSTREAM_OK;
+
+ CHECK_WR_RES(bstream_wr_byte(s,0x00));
+ CHECK_WR_RES(bstream_wr_time(s,&hdr->vp_time));
+ CHECK_WR_RES(bstream_wr_time(s,&hdr->end_time));
+ CHECK_WR_RES(bstream_wr_binlog_pos(s,hdr->binlog_info));
+ CHECK_WR_RES(bstream_wr_binlog_pos(s,hdr->binlog_group));
+
+ wr_error:
+
+ return ret;
+}
+
+/**
+ Read backup image summary
+
+ The information stored in the summary section is read and stored in the image
+ header structure.
+
+ @retval BSTREAM_ERROR Error while reading
+ @retval BSTREAM_OK Read successful
+ @retval BSTREAM_EOC Read successful and end of chunk has been reached
+ @retval BSTREAM_EOS Read successful and end of stream has been reached
+
+ @see @ref summary
+*/
+int bstream_rd_summary(backup_stream *s, struct st_bstream_image_header *hdr)
+{
+ int ret= BSTREAM_OK;
+
+ CHECK_RD_OK(bstream_rd_time(s,&hdr->vp_time));
+ CHECK_RD_OK(bstream_rd_time(s,&hdr->end_time));
+ CHECK_RD_OK(bstream_rd_binlog_pos(s,&hdr->binlog_info));
+ CHECK_RD_RES(bstream_rd_binlog_pos(s,&hdr->binlog_group));
+
+ rd_error:
+
+ return ret;
+}
+
+
/*********************************************************************
*
* WRITING/READING BASIC TYPES
Attachment: [text/bzr-bundle] bzr/rafal.somla@sun.com-20090908071345-m4z8tr2jdhzib9w3.bundle
| Thread |
|---|
| • bzr commit into mysql-6.0-backup branch (Rafal.Somla:2869) Bug#40587 | Rafal Somla | 8 Sep |