List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:April 15 2009 8:25pm
Subject:bzr commit into mysql-6.0-backup branch (charles.bell:2797) Bug#43324
View as plain text  
#At file:///C:/source/bzr/mysql-6.0-bug-43324/ based on revid:jorgen.loland@stripped

 2797 Chuck Bell	2009-04-15
      BUG#43324 : Wrong table count per snapshot stored in backup image
      
      The wrong table count is being written to the stream.
      When the backup client reads the stream it produces the
      wrong output. The table count always returned 1.
      
      This is because the code was counting the tables in the
      add_snapshot() method which is only called once.
      
      This patch moves the table counting code to allow proper
      counting of the tables in the snapshot.
      
      As a result, the backup client test results have been
      corrected as well.
      modified:
        mysql-test/suite/backup/r/backup_client.result
        mysql-test/suite/backup/r/backup_client_binlog.result
        sql/backup/image_info.cc

per-file messages:
  mysql-test/suite/backup/r/backup_client.result
    Corrected result file.
  mysql-test/suite/backup/r/backup_client_binlog.result
    Corrected result file.
  sql/backup/image_info.cc
    Moves the table counting step to the add_table() method
    because the add_snapshot() method is only called once
    for only the first table the generates a new snapshot.
=== modified file 'mysql-test/suite/backup/r/backup_client.result'
--- a/mysql-test/suite/backup/r/backup_client.result	2009-03-28 08:42:55 +0000
+++ b/mysql-test/suite/backup/r/backup_client.result	2009-04-15 20:25:14 +0000
@@ -3426,19 +3426,19 @@ Snapshots:
 
   Snapshot 0 type    native from 'MyISAM'  version 1.0
   Snapshot 0 version 1
-  Snapshot 0 tables  1
+  Snapshot 0 tables  3
   Snapshot 0 table   'mysqltest1'.'t1'
   Snapshot 0 table   'mysqltest2'.'t3'
   Snapshot 0 table   'mysqltest3'.'t2'
   Snapshot 1 type    logical from consistent snapshot
   Snapshot 1 version 1
-  Snapshot 1 tables  1
+  Snapshot 1 tables  3
   Snapshot 1 table   'mysqltest1'.'t2'
   Snapshot 1 table   'mysqltest2'.'t1'
   Snapshot 1 table   'mysqltest3'.'t3'
   Snapshot 2 type    logical from locked tables
   Snapshot 2 version 1
-  Snapshot 2 tables  1
+  Snapshot 2 tables  3
   Snapshot 2 table   'mysqltest1'.'t3'
   Snapshot 2 table   'mysqltest2'.'t2'
   Snapshot 2 table   'mysqltest3'.'t1'
@@ -3462,19 +3462,19 @@ Snapshots:
 
   Snapshot 0 type    native from 'MyISAM'  version 1.0
   Snapshot 0 version 1
-  Snapshot 0 tables  1
+  Snapshot 0 tables  3
   Snapshot 0 table   'mysqltest1'.'t1'
   Snapshot 0 table   'mysqltest2'.'t3'
   Snapshot 0 table   'mysqltest3'.'t2'
   Snapshot 1 type    logical from consistent snapshot
   Snapshot 1 version 1
-  Snapshot 1 tables  1
+  Snapshot 1 tables  3
   Snapshot 1 table   'mysqltest1'.'t2'
   Snapshot 1 table   'mysqltest2'.'t1'
   Snapshot 1 table   'mysqltest3'.'t3'
   Snapshot 2 type    logical from locked tables
   Snapshot 2 version 1
-  Snapshot 2 tables  1
+  Snapshot 2 tables  3
   Snapshot 2 table   'mysqltest1'.'t3'
   Snapshot 2 table   'mysqltest2'.'t2'
   Snapshot 2 table   'mysqltest3'.'t1'
@@ -3710,19 +3710,19 @@ Snapshots:
 
   Snapshot 0 type    native from 'MyISAM'  version 1.0
   Snapshot 0 version 1
-  Snapshot 0 tables  1
+  Snapshot 0 tables  3
   Snapshot 0 table   'mysqltest1'.'t1'
   Snapshot 0 table   'mysqltest2'.'t3'
   Snapshot 0 table   'mysqltest3'.'t2'
   Snapshot 1 type    logical from consistent snapshot
   Snapshot 1 version 1
-  Snapshot 1 tables  1
+  Snapshot 1 tables  3
   Snapshot 1 table   'mysqltest1'.'t2'
   Snapshot 1 table   'mysqltest2'.'t1'
   Snapshot 1 table   'mysqltest3'.'t3'
   Snapshot 2 type    logical from locked tables
   Snapshot 2 version 1
-  Snapshot 2 tables  1
+  Snapshot 2 tables  3
   Snapshot 2 table   'mysqltest1'.'t3'
   Snapshot 2 table   'mysqltest2'.'t2'
   Snapshot 2 table   'mysqltest3'.'t1'
@@ -3945,19 +3945,19 @@ Snapshots:
 
   Snapshot 0 type    native from 'MyISAM'  version 1.0
   Snapshot 0 version 1
-  Snapshot 0 tables  1
+  Snapshot 0 tables  3
   Snapshot 0 table   'mysqltest1'.'t1'
   Snapshot 0 table   'mysqltest2'.'t3'
   Snapshot 0 table   'mysqltest3'.'t2'
   Snapshot 1 type    logical from consistent snapshot
   Snapshot 1 version 1
-  Snapshot 1 tables  1
+  Snapshot 1 tables  3
   Snapshot 1 table   'mysqltest1'.'t2'
   Snapshot 1 table   'mysqltest2'.'t1'
   Snapshot 1 table   'mysqltest3'.'t3'
   Snapshot 2 type    logical from locked tables
   Snapshot 2 version 1
-  Snapshot 2 tables  1
+  Snapshot 2 tables  3
   Snapshot 2 table   'mysqltest1'.'t3'
   Snapshot 2 table   'mysqltest2'.'t2'
   Snapshot 2 table   'mysqltest3'.'t1'
@@ -4340,19 +4340,19 @@ Snapshots:
 
   Snapshot 0 type    native from 'MyISAM'  version 1.0
   Snapshot 0 version 1
-  Snapshot 0 tables  1
+  Snapshot 0 tables  3
   Snapshot 0 table   'mysqltest1'.'t1'
   Snapshot 0 table   'mysqltest2'.'t3'
   Snapshot 0 table   'mysqltest3'.'t2'
   Snapshot 1 type    logical from consistent snapshot
   Snapshot 1 version 1
-  Snapshot 1 tables  1
+  Snapshot 1 tables  3
   Snapshot 1 table   'mysqltest1'.'t2'
   Snapshot 1 table   'mysqltest2'.'t1'
   Snapshot 1 table   'mysqltest3'.'t3'
   Snapshot 2 type    logical from locked tables
   Snapshot 2 version 1
-  Snapshot 2 tables  1
+  Snapshot 2 tables  3
   Snapshot 2 table   'mysqltest1'.'t3'
   Snapshot 2 table   'mysqltest2'.'t2'
   Snapshot 2 table   'mysqltest3'.'t1'
@@ -5334,12 +5334,12 @@ Snapshots:
 
   Snapshot 0 type    native from 'MyISAM'  version 1.0
   Snapshot 0 version 1
-  Snapshot 0 tables  1
+  Snapshot 0 tables  2
   Snapshot 0 table   'mysqltest1'.'t1'
   Snapshot 0 table   'mysqltest1'.'t2'
   Snapshot 1 type    logical from consistent snapshot
   Snapshot 1 version 1
-  Snapshot 1 tables  1
+  Snapshot 1 tables  2
   Snapshot 1 table   'mysqltest2'.'t1'
   Snapshot 1 table   'mysqltest2'.'t2'
 

=== modified file 'mysql-test/suite/backup/r/backup_client_binlog.result'
--- a/mysql-test/suite/backup/r/backup_client_binlog.result	2009-04-02 13:14:17 +0000
+++ b/mysql-test/suite/backup/r/backup_client_binlog.result	2009-04-15 20:25:14 +0000
@@ -41,12 +41,12 @@ Snapshots:
 
   Snapshot 0 type    native from 'MyISAM'  version 1.0
   Snapshot 0 version 1
-  Snapshot 0 tables  1
+  Snapshot 0 tables  2
   Snapshot 0 table   'mysqltest1'.'t1'
   Snapshot 0 table   'mysqltest1'.'t2'
   Snapshot 1 type    logical from consistent snapshot
   Snapshot 1 version 1
-  Snapshot 1 tables  1
+  Snapshot 1 tables  2
   Snapshot 1 table   'mysqltest2'.'t1'
   Snapshot 1 table   'mysqltest2'.'t2'
 

=== modified file 'sql/backup/image_info.cc'
--- a/sql/backup/image_info.cc	2009-02-16 12:20:31 +0000
+++ b/sql/backup/image_info.cc	2009-04-15 20:25:14 +0000
@@ -193,8 +193,6 @@ int Image_info::add_snapshot(Snapshot_in
   bzero(&info, sizeof(st_bstream_snapshot_info));
   info.type= enum_bstream_snapshot_type(snap.type());
   info.version= snap.version();
-  info.table_count= snap.table_count();
-  
   if (snap.type() == Snapshot_info::NATIVE_SNAPSHOT)
   {
     Native_snapshot &ns= static_cast<Native_snapshot&>(snap);
@@ -314,6 +312,10 @@ Image_info::add_table(Db &db, const ::St
   if (!snap.m_num)
    return NULL;
 
+  // Record the table count for the stream header.
+  st_bstream_snapshot_info &info= snapshot[snap.m_num-1];
+  info.table_count= snap.table_count();
+
   t->snap_num= snap.m_num - 1;
   t->base.base.pos= pos;
 

Thread
bzr commit into mysql-6.0-backup branch (charles.bell:2797) Bug#43324Chuck Bell15 Apr