List:Commits« Previous MessageNext Message »
From:Rafal Somla Date:September 8 2009 9:59am
Subject:bzr commit into mysql-6.0-backup branch (Rafal.Somla:2870) Bug#40587
View as plain text  
#At file:///ext/mysql/bzr/backup/stream-doc/ based on revid:rafal.somla@stripped

 2870 Rafal Somla	2009-09-08
      Followup patch for BUG#40587. It removes from bstream library code 
      which was supposed to handle aspects of backup image which were 
      never needed/used and disappeared from image format specifications.
      These are:
      
      1. The possibility of having the summary block inside image's preamble 
      instead of always having it at the end of the image. Current code 
      always writes summary at the end of backup image.
      
      2. Explicit listing of per-table objects in the catalogue and in the 
      metadata section. We do not handle per-table objects explicitly.
      Things like indexes are created together with the tables with one 
      CREATE TABLE statement.
     @ client/backup_stream.c
        Remove parts related to per-table iterator.
     @ client/mysqlbackup.cc
        Remove support for inline summary.
     @ mysql-test/suite/backup/t/backup_client_coverage.test
        Remove error injection which was testing per-table iterator code.
     @ sql/backup/kernel.cc
        Remove implementation of per-table iterator.
     @ sql/backup/stream_v1.c
        - Remove support for inline summary.
        - Remove code for writing/reading per-table objects.
     @ sql/backup/stream_v1.h
        - Remove BSTREAM_FLAG_INLINE_SUMMARY.
        - Remove structure for describing per-table objects.
     @ unittest/backup/bstr_callback_errors-t.c
        Remove test for per-table iterators.
     @ unittest/backup/catalog.c
        Remove implementation of per-table iterator.

    modified:
      client/backup_stream.c
      client/mysqlbackup.cc
      mysql-test/suite/backup/r/backup_client_coverage.result
      mysql-test/suite/backup/t/backup_client_coverage.test
      sql/backup/kernel.cc
      sql/backup/stream_v1.c
      sql/backup/stream_v1.h
      unittest/backup/bstr_callback_errors-t.c
      unittest/backup/catalog.c
=== modified file 'client/backup_stream.c'
--- a/client/backup_stream.c	2009-05-21 13:17:37 +0000
+++ b/client/backup_stream.c	2009-09-08 09:59:05 +0000
@@ -1175,7 +1175,6 @@ bcat_iterator_get(struct st_bstream_imag
   iter->it_index= -1;
   iter->it_type= it_type;
 
-  ERROR_INJECT("bcat_iterator_get_type", it_type= BSTREAM_IT_PERTABLE;);
   switch (it_type) {
 
     /* purecov: begin inspected */
@@ -1212,11 +1211,6 @@ bcat_iterator_get(struct st_bstream_imag
     goto err;
     /* purecov: end */
 
-  case BSTREAM_IT_PERTABLE:
-    errm("iterator type not yet implemented: pertable\n");
-    DBUG_PRINT("bupstrm", ("NOTYET implemented: pertable"));
-    goto err;
-
     /* purecov: begin inspected */
   default:
     errm("iterator type not yet implemented: type %u\n", it_type);

=== modified file 'client/mysqlbackup.cc'
--- a/client/mysqlbackup.cc	2009-05-21 13:17:37 +0000
+++ b/client/mysqlbackup.cc	2009-09-08 09:59:05 +0000
@@ -1362,13 +1362,6 @@ print_header(struct st_backup_catalog *b
     const char  *comma= ", ";
 
     printf("Image options:       ");
-    if (hdr->flags & BSTREAM_FLAG_INLINE_SUMMARY)
-    {
-      /* purecov: begin inspected */
-      printf("%sINLINE_SUMMARY", separator);
-      separator= comma;
-      /* purecov: end */
-    }
     if (hdr->flags & BSTREAM_FLAG_BIG_ENDIAN)
     {
       /* purecov: begin inspected */
@@ -2165,21 +2158,6 @@ main(int argc, char **argv)
   print_header(bup_catalog);
 
   /*
-    The summary section may be inside the image header or at image end.
-  */
-  if (bup_catalog->cat_header.flags & BSTREAM_FLAG_INLINE_SUMMARY)
-  {
-    /* purecov: begin inspected */
-    brc= read_and_print_summary(strm, bup_catalog);
-    if (brc != BSTREAM_OK)
-      goto end;
-
-    /* Summary is printed already, no need to read it any more. */
-    need_summary= FALSE;
-    /* purecov: end */
-  }
-
-  /*
     We want to save image reading time if part of the information is not
     wanted. Since we read the image sequentially, we can skip a section
     only if it - and all sections behind it - are not needed.

=== modified file 'mysql-test/suite/backup/r/backup_client_coverage.result'
--- a/mysql-test/suite/backup/r/backup_client_coverage.result	2009-03-11 14:13:15 +0000
+++ b/mysql-test/suite/backup/r/backup_client_coverage.result	2009-09-08 09:59:05 +0000
@@ -380,24 +380,6 @@ mysqlbackup: Out of memory
 
 ERROR: error on stream library read of catalog.
 
-# Injecting error at bcat_iterator_get_type
-
-Image path: #
-Image size: #
-Image compression:   none
-Image version:       1
-Creation time: #
-Server version: #
-Server byte order: #
-
-ERROR: ERROR_INJECT("bcat_iterator_get_type")
-
-
-ERROR: iterator type not yet implemented: pertable
-
-
-ERROR: error on stream library read of catalog.
-
 # Injecting error at bcat_create_item_malloc
 
 Image path: #

=== modified file 'mysql-test/suite/backup/t/backup_client_coverage.test'
--- a/mysql-test/suite/backup/t/backup_client_coverage.test	2009-02-26 13:07:12 +0000
+++ b/mysql-test/suite/backup/t/backup_client_coverage.test	2009-09-08 09:59:05 +0000
@@ -192,11 +192,6 @@ exec $MYSQL_BACKUP -v --summary  --debug
 --error 1
 exec $MYSQL_BACKUP -v --summary  --debug=d,bcat_iterator_get_malloc  $BACKUPDIR/mysqltest.bak 2>&1;
 #
---echo # Injecting error at bcat_iterator_get_type
---source suite/backup/include/backup_client_regex_output.inc
---error 1
-exec $MYSQL_BACKUP -v --summary  --debug=d,bcat_iterator_get_type  $BACKUPDIR/mysqltest.bak 2>&1;
-#
 --echo # Injecting error at bcat_create_item_malloc
 --source suite/backup/include/backup_client_regex_output.inc
 --error 1

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2009-09-08 09:29:08 +0000
+++ b/sql/backup/kernel.cc	2009-09-08 09:59:05 +0000
@@ -1954,9 +1954,6 @@ void* bcat_iterator_get(st_bstream_image
 
   switch (type) {
 
-  case BSTREAM_IT_PERTABLE: // per-table objects
-    return &null_iter;
-
   case BSTREAM_IT_CHARSET:  // character sets
     cset_iter= 0;
     return &cset_iter;

=== modified file 'sql/backup/stream_v1.c'
--- a/sql/backup/stream_v1.c	2009-09-08 09:43:04 +0000
+++ b/sql/backup/stream_v1.c	2009-09-08 09:59:05 +0000
@@ -258,17 +258,6 @@ int bstream_rd_preamble(backup_stream *s
     return BSTREAM_ERROR;
   CHECK_RD_OK(bstream_next_chunk(s));
 
-  /* In this version, we always write summary at the end of the stream. */ 
-  /* purecov: begin inspected */
-  if (hdr->flags & BSTREAM_FLAG_INLINE_SUMMARY)
-  {
-    CHECK_RD_RES(bstream_rd_summary(s,hdr));
-    if (ret == BSTREAM_EOS)
-      return BSTREAM_ERROR;
-    CHECK_RD_OK(bstream_next_chunk(s));
-  }
-  /* purecov: end inspected */
-
   CHECK_RD_RES(bstream_rd_catalogue(s,hdr));
   if (ret == BSTREAM_EOS)
     return BSTREAM_ERROR;
@@ -1152,12 +1141,7 @@ int bstream_rd_db_catalogue(backup_strea
 enum enum_bstream_meta_item_kind {
   GLOBAL_ITEM,   /**< only object position is stored */
   TABLE_ITEM,    /**< only table position is stored (database is implicit) */
-  PER_DB_ITEM,   /**< object position followed by its database position */
-  /**
-    Item position followed by its table's database position followed by the
-    table's position inside that database
-  */
-  PER_TABLE_ITEM
+  PER_DB_ITEM    /**< object position followed by its database position */
 };
 
 int bstream_wr_meta_item(backup_stream*, enum enum_bstream_meta_item_kind,
@@ -1275,18 +1259,10 @@ int bstream_wr_meta_data(backup_stream *
   bcat_iterator_free(cat,iter);
   iter= NULL;
 
-  /* per-table items */
+  /* The final 0x00 bytes */
 
   CHECK_WR_RES(bstream_wr_item_type(s,BSTREAM_IT_LAST));
 
-  iter= bcat_iterator_get(cat,BSTREAM_IT_PERTABLE);
-
-  if (!iter)
-    return BSTREAM_ERROR;
-
-  while ((item= bcat_iterator_next(cat,iter)))
-    CHECK_WR_RES(bstream_wr_item_def(s,cat,PER_TABLE_ITEM,item));
-
 wr_error:
 
   /* Free iterators if not already done */
@@ -1359,18 +1335,6 @@ int bstream_rd_meta_data(backup_stream *
   CHECK_RD_OK(bstream_next_chunk(s));
   CHECK_RD_RES(read_and_create_items(s,cat,PER_DB_ITEM));
 
-  /*
-    If we hit end of chunk/stream, there is nothing more to read
-    (no per-table objects)
-  */
-
-  if (ret != BSTREAM_OK)
-    return ret;
-
-  /* per-table objects */
-
-  CHECK_RD_RES(read_and_create_items(s,cat,PER_TABLE_ITEM));
-
   rd_error:
 
   /* Free iterator if not already done */
@@ -1512,12 +1476,9 @@ int bstream_wr_meta_item(backup_stream *
     return ret;
   }
 
-  if ((kind == PER_TABLE_ITEM) || (kind == PER_DB_ITEM))
+  if (kind == PER_DB_ITEM)
     CHECK_WR_RES(bstream_wr_num(s,((struct st_bstream_dbitem_info*)item)->db->base.pos));
 
-  if (kind == PER_TABLE_ITEM)
-    CHECK_WR_RES(bstream_wr_num(s,
-                   ((struct st_bstream_titem_info*)item)->table->base.base.pos));
   wr_error:
 
   return ret;
@@ -1551,7 +1512,6 @@ int bstream_rd_meta_item(backup_stream *
                          struct st_bstream_item_info **item)
 {
   static struct st_bstream_db_info db;
-  static struct st_bstream_table_info table;
 
   static union
   {
@@ -1559,7 +1519,6 @@ int bstream_rd_meta_item(backup_stream *
     struct st_bstream_db_info     db;
     struct st_bstream_table_info  table;
     struct st_bstream_dbitem_info per_db;
-    struct st_bstream_titem_info  per_table;
   } item_buf;
 
   int ret= BSTREAM_OK;
@@ -1596,7 +1555,7 @@ int bstream_rd_meta_item(backup_stream *
 
   /* read db pos if present */
 
-  if ((kind == PER_TABLE_ITEM) || (kind == PER_DB_ITEM))
+  if (kind == PER_DB_ITEM)
   {
     if (ret != BSTREAM_OK)
       return BSTREAM_ERROR;
@@ -1607,20 +1566,6 @@ int bstream_rd_meta_item(backup_stream *
     item_buf.per_db.db= &db;
   }
 
-  /* read table pos if present */
-
-  if (kind == PER_TABLE_ITEM)
-  {
-    if (ret != BSTREAM_OK)
-      return BSTREAM_ERROR;
-
-    table.base.base.type= BSTREAM_IT_TABLE;
-    table.base.db= &db;
-    CHECK_RD_RES(bstream_rd_num(s,&table.base.base.pos));
-
-    item_buf.per_table.table= &table;
-  }
-
   rd_error:
 
   return ret;

=== modified file 'sql/backup/stream_v1.h'
--- a/sql/backup/stream_v1.h	2009-08-03 07:59:51 +0000
+++ b/sql/backup/stream_v1.h	2009-09-08 09:59:05 +0000
@@ -181,15 +181,6 @@ struct st_bstream_image_header
 /* Flags */
 
 /**
-  Position of the summary block.
-
-  If this flag is set, the block containing summary info (available at the end
-  of backup process) is stored in the image's preamble. Otherwise, this block
-  is appended at the end of the image.
- */
-#define BSTREAM_FLAG_INLINE_SUMMARY (1U<<0)
-
-/**
   Byte order of the server which created backup image.
 
   If set, informs that backup image was created on big-endian server. This might
@@ -285,14 +276,6 @@ struct st_bstream_table_info
   unsigned short int  snap_num;  /**< snapshot where table's data is stored */
 };
 
-/**
-  Describes item which sits inside a table.
- */
-struct st_bstream_titem_info
-{
-  struct st_bstream_item_info  base;   /**< data common to all items */
-  struct st_bstream_table_info *table; /**< table to which this item belongs */
-};
 
 /*
   The following constants denote additional backup item categories. Items of
@@ -305,8 +288,6 @@ struct st_bstream_titem_info
 #define BSTREAM_IT_GLOBAL    BSTREAM_IT_LAST
 /** Definition of backup stream per database item index. */
 #define BSTREAM_IT_PERDB     (BSTREAM_IT_LAST+1)
-/** Definition of backup stream per table item index. */
-#define BSTREAM_IT_PERTABLE  (BSTREAM_IT_LAST+2)
 
 
 /*************************************************************************

=== modified file 'unittest/backup/bstr_callback_errors-t.c'
--- a/unittest/backup/bstr_callback_errors-t.c	2009-06-30 20:37:35 +0000
+++ b/unittest/backup/bstr_callback_errors-t.c	2009-09-08 09:59:05 +0000
@@ -61,8 +61,6 @@ void run_test()
      "Errors in bcat_iterator_get() callback (for all global objects)");
   ok(fail_iterator(WR, BSTREAM_IT_PERDB),
      "Errors in bcat_iterator_get() callback (for per-database objects)");
-  ok(fail_iterator(WR, BSTREAM_IT_PERTABLE),
-     "Errors in bcat_iterator_get() callback (for per-table objects)");
 
   /* test failures in database iterators (for each database in the catalogue) */
   for (i=0; i < db_count; ++i)

=== modified file 'unittest/backup/catalog.c'
--- a/unittest/backup/catalog.c	2009-06-30 20:37:35 +0000
+++ b/unittest/backup/catalog.c	2009-09-08 09:59:05 +0000
@@ -4,10 +4,9 @@
   stream library.
 
   The contents of the catalogue is determined by arrays @c snapshots[],
-  @c objects_global[], @c objects_perdb[], @c objects_pertable[]. Additionally,
-  the catalogue will contain DB_COUNT databases named db1, ..., dbN and
-  TABLE_COUNT tables named t1, ..., tM. Tables are distributed among available
-  databases and snapshots.
+  @c objects_global[], @c objects_perdb[]. Additionally, the catalogue will 
+  contain DB_COUNT databases named db1, ..., dbN and TABLE_COUNT tables named 
+  t1, ..., tM. Tables are distributed among available databases and snapshots.
 
   For each object in the catalogue, the serialization string and extra metadata
   string have form "serialization of <object name>" and
@@ -58,17 +57,6 @@ item_info objects_perdb[]=
 };
 const uint perdb_count= sizeof(objects_perdb)/sizeof(item_info);
 
-/*
-  List of per-table objects.
-
-  These objects are distributed among all the tables present in the catalogue.
-*/
-item_info objects_pertable[]=
-{
-  {BSTREAM_IT_TRIGGER,    {(byte*)"trigger",NULL},    0}
-};
-const uint pertable_count= sizeof(objects_pertable)/sizeof(item_info);
-
 /**
   Defines number N of databases present in the catalogue.
 
@@ -183,14 +171,6 @@ void init_catalog(image_header *hdr)
     objects_perdb[i].name.end= (byte*)name + strlen(name);
   }
 
-  /* Initialize other per-table items */
-
-  for (i=0; i < pertable_count; ++i)
-  {
-    name= (char*)objects_pertable[i].name.begin;
-    objects_pertable[i].name.end= (byte*)name + strlen(name);
-  }
-
 }
 
 /** Reset all callback counters. */
@@ -236,8 +216,6 @@ int check_iterators()
      stored (BSTREAM_IT_GLOBAL).
   c) iterator determining order in which per-database objects' metadata will
      be stored (BSTREAM_IT_PERDB).
-  d) iterator determining order in which per-table objects' metadata will be
-     stored (BSTREAM_IT_PERTABLE).
 
   The iterators are represented by pointers to the corresponding @c it_*
   counter. In case of iterators a) and b) they are both represented by a pointer
@@ -256,7 +234,6 @@ int check_iterators()
 int  it_global;
 int  it_db;
 int  it_perdb;
-int  it_pertable;
 
 /** Iterate over databases */
 item_info* db_iterator_next()
@@ -390,27 +367,6 @@ dbitem_info* perdb_iterator_next(struct 
   return &item_buf;
 }
 
-/**
-  Iterate over all per-table objects (in all tables).
-
-  Per-table object descriptions are stored in @c objects_pertable[] array.
-  Counter @c it_pertable is used to keep position within that table.
-*/
-titem_info* pertable_iterator_next()
-{
- static titem_info item;
-
- DBUG_ASSERT(it_pertable >= 0);
-
- if ((unsigned)it_pertable >= pertable_count)
-   return NULL;
-
- item.base= objects_pertable[it_pertable++];
- item.table= &tables[it_pertable % table_count];
-
- return &item;
-}
-
 
 /**********************************************************************
 
@@ -432,9 +388,6 @@ titem_info* pertable_iterator_next()
   BSTREAM_IT_PERDB - an iterator determining order in which per-database 
      objects' metadata will be stored.
 
-  BSTREAM_IT_PERTABLE - an iterator determining order in which per-table
-     objects' metadata will be stored.
-
   @return Pointer to the @c it_* counter representing given iterator or NULL
   in case of error.
 */
@@ -460,10 +413,6 @@ void* bcat_iterator_get(struct st_bstrea
     it_db= 0;
     return &it_db;
 
-  case BSTREAM_IT_PERTABLE:
-    it_pertable= 0;
-    return &it_pertable;
-
   default:
     it_global= type;
     it_db= 0;
@@ -491,8 +440,6 @@ void  bcat_iterator_free(struct st_bstre
     type= BSTREAM_IT_PERDB;
   else if (iter == &it_db)
     type= BSTREAM_IT_DB;
-  else if (iter == &it_pertable)
-    type= BSTREAM_IT_PERTABLE;
 
   ++(callback_counts.iterator_free[type]);
 }
@@ -523,9 +470,6 @@ bcat_iterator_next(struct st_bstream_ima
   if (iter == &it_db)
     return db_iterator_next();
 
-  if (iter == &it_pertable)
-    return (item_info*)pertable_iterator_next();
-
   /*
     If iter == &it_perdb we want to enumerate all per-database objects. We
     iterate over all databases using it_db counter and for each database use


Attachment: [text/bzr-bundle] bzr/rafal.somla@sun.com-20090908095905-vorpzdwhsquoc5pb.bundle
Thread
bzr commit into mysql-6.0-backup branch (Rafal.Somla:2870) Bug#40587Rafal Somla8 Sep
  • Re: bzr commit into mysql-6.0-backup branch (Rafal.Somla:2870)Bug#40587Charles Bell8 Sep