List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:August 21 2009 3:43pm
Subject:bzr commit into mysql-6.0-backup branch (charles.bell:2862) Bug#41898
View as plain text  
#At file:///Users/cbell/source/bzr/mysql-6.0-bug-41898/ based on revid:charles.bell@stripped

 2862 Chuck Bell	2009-08-21
      BUG#41898 : Totalbytes in backup history log has same size for compressed/uncompressed data
      
      This bug and BUG#39780 which is a duplicate reports the problem that the
      'total_bytes' column of the backup_history log reports and incorrect and
      unrealistic value.
      
      This patch corrects the problem by making the 'total_bytes' column store 
      the number of bytes read or written. This means this column is now the
      same as the backup image file size.
     @ mysql-test/suite/backup/include/check_filesize.inc
        New include for comparing total_bytes with file size.
     @ mysql-test/suite/backup/r/backup_compression.result
        New result file with comment removed and correct result displayed.
     @ mysql-test/suite/backup/r/backup_intr_errors.result
        Corrected result file -- new location of close method in kernel.cc
        caused a different order for the error messages.
     @ mysql-test/suite/backup/r/backup_log_filesize.result
        New result file.
     @ mysql-test/suite/backup/r/backup_logs.result
        Corrected result file now that the bug is fixed.
     @ mysql-test/suite/backup/t/backup_compression.test
        Removed comment about bug report.
     @ mysql-test/suite/backup/t/backup_log_filesize.test
        New test to demonstrate the total_bytes column of the backup_history
        log corresponds to the backup image file size.
     @ mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc
        Changed masking of error messages to mask out 'Error on delete' comment
        in the log.
     @ sql/backup/image_info.h
        Changed data type to allow for large file sizes.
     @ sql/backup/kernel.cc
        Moved report_stats_post to close method because the stream close
        method writes bytes for backup and these must be counted for an
        accurate byte count.
     @ sql/backup/logger.h
        Added method to abstract writing of backup history.
     @ sql/backup/stream.cc
        Added code to total bytes read and written.
     @ sql/backup/stream.h
        Changed data type to allow for large file sizes.

    added:
      mysql-test/suite/backup/include/check_filesize.inc
      mysql-test/suite/backup/r/backup_log_filesize.result
      mysql-test/suite/backup/t/backup_log_filesize.test
    modified:
      mysql-test/suite/backup/r/backup_compression.result
      mysql-test/suite/backup/r/backup_intr_errors.result
      mysql-test/suite/backup/r/backup_logs.result
      mysql-test/suite/backup/t/backup_compression.test
      mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc
      sql/backup/image_info.h
      sql/backup/kernel.cc
      sql/backup/logger.h
      sql/backup/stream.cc
      sql/backup/stream.h
=== added file 'mysql-test/suite/backup/include/check_filesize.inc'
--- a/mysql-test/suite/backup/include/check_filesize.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/include/check_filesize.inc	2009-08-21 15:43:19 +0000
@@ -0,0 +1,27 @@
+#
+# This include file retrieves the file size from the file specified as 
+# FILE_NAME and compares it to the 'total_bytes' column of the backup_history
+# log where backup_id = @bid.
+#
+# Assumptions: The row to be checked is the only row in the backup_history
+# log (a flush has just occurred).
+# 
+# PARAMETERS
+#  @bid = backup_id to check
+#  FILE_NAME = file name of backup file to check
+#
+
+LET TOTAL_BYTES = `SELECT total_bytes FROM mysql.backup_history WHERE backup_id = @bid`;
+perl;
+my $filename = $ENV{FILE_NAME};
+my $filesize = -s $filename;
+if ($filesize eq $ENV{TOTAL_BYTES})
+{
+  print "Success! File size and total_bytes match.\n";
+}
+else
+{
+  print "ERROR: File size and total_bytes do NOT match!\n";
+  print "       ($filesize <> $ENV{TOTAL_BYTES})\n\n";
+}
+EOF

=== modified file 'mysql-test/suite/backup/r/backup_compression.result'
--- a/mysql-test/suite/backup/r/backup_compression.result	2009-06-26 13:23:35 +0000
+++ b/mysql-test/suite/backup/r/backup_compression.result	2009-08-21 15:43:19 +0000
@@ -36,12 +36,7 @@ SELECT total_bytes into @total_bytes_no_
 Verify the result
 SELECT @total_bytes_comp < @total_bytes_no_comp;
 @total_bytes_comp < @total_bytes_no_comp
-0
-The result 0 indicates that total bytes of compressed and uncompressed
-data is same(bug#41898). Once this bug is fixed, result should be 1.
-The size of compressed backup image should be less than uncomressed 
-image. 
-
+1
 Drop database and execute restore operation
 DROP DATABASE db1;
 PURGE BACKUP LOGS;

=== modified file 'mysql-test/suite/backup/r/backup_intr_errors.result'
--- a/mysql-test/suite/backup/r/backup_intr_errors.result	2009-05-07 01:44:37 +0000
+++ b/mysql-test/suite/backup/r/backup_intr_errors.result	2009-08-21 15:43:19 +0000
@@ -65,6 +65,8 @@ backup kernel	####	validity point
 backup kernel	####	cancel
 	####	Snapshot backup driver can't cancel its backup operation
 backup kernel	####	error
+	####	Backup/Restore: Error on close of backup stream
+	####	Error on delete of <backup image path> 
 SELECT backup_state, operation FROM mysql.backup_history;
 backup_state	operation
 error	backup
@@ -122,6 +124,7 @@ backup kernel	####	running
 backup kernel	####	cancel
 	####	Can't shut down Snapshot restore driver(s)
 backup kernel	####	error
+	####	Backup/Restore: Error on close of backup stream
 SELECT backup_state, operation FROM mysql.backup_history;
 backup_state	operation
 error	restore
@@ -188,6 +191,8 @@ backup kernel	####	validity point
 backup kernel	####	cancel
 	####	Default backup driver can't cancel its backup operation
 backup kernel	####	error
+	####	Backup/Restore: Error on close of backup stream
+	####	Error on delete of <backup image path> 
 SELECT backup_state, operation FROM mysql.backup_history;
 backup_state	operation
 error	backup
@@ -245,6 +250,7 @@ backup kernel	####	running
 backup kernel	####	cancel
 	####	Can't shut down Default restore driver(s)
 backup kernel	####	error
+	####	Backup/Restore: Error on close of backup stream
 SELECT backup_state, operation FROM mysql.backup_history;
 backup_state	operation
 error	restore

=== added file 'mysql-test/suite/backup/r/backup_log_filesize.result'
--- a/mysql-test/suite/backup/r/backup_log_filesize.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_log_filesize.result	2009-08-21 15:43:19 +0000
@@ -0,0 +1,134 @@
+DROP DATABASE IF EXISTS large;
+DROP DATABASE IF EXISTS small;
+#
+# Creating small database and populating it.
+#
+CREATE DATABASE small;
+CREATE TABLE small.t1 (a int);
+#
+# Creating large database and populating it.
+#
+CREATE DATABASE large;
+CREATE TABLE large.t1 (a int);
+INSERT INTO large.t1 values (1);
+SELECT count(*) FROM large.t1;
+count(*)
+1048576
+#
+# Test case 1 : BACKUP of small database no compression
+#
+BACKUP DATABASE small TO 'b1.bak';
+backup_id
+#
+#
+# Get backup_id of the BACKUP operation. 
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+#
+# Compare file size to the 'total_bytes' column of the backup_history log.
+#
+Success! File size and total_bytes match.
+#
+# RESTORE of small database no compression
+#
+RESTORE FROM 'b1.bak' OVERWRITE;
+backup_id
+#
+#
+# Get backup_id of the RESTORE operation. 
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+#
+# Compare file size to the 'total_bytes' column of the backup_history log.
+#
+Success! File size and total_bytes match.
+#
+# Test case 2 : BACKUP of small database with compression
+#
+BACKUP DATABASE small TO 'b1.bak' WITH COMPRESSION;
+backup_id
+#
+#
+# Get backup_id of the BACKUP operation. 
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+#
+# Compare file size to the 'total_bytes' column of the backup_history log.
+#
+Success! File size and total_bytes match.
+#
+# RESTORE of small database with compression
+#
+RESTORE FROM 'b1.bak' OVERWRITE;
+backup_id
+#
+#
+# Get backup_id of the RESTORE operation. 
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+#
+# Compare file size to the 'total_bytes' column of the backup_history log.
+#
+Success! File size and total_bytes match.
+#
+# Test case 3 : BACKUP of large database no compression
+#
+BACKUP DATABASE large TO 'b1.bak';
+backup_id
+#
+#
+# Get backup_id of the BACKUP operation. 
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+#
+# Compare file size to the 'total_bytes' column of the backup_history log.
+#
+Success! File size and total_bytes match.
+#
+# RESTORE of large database no compression
+#
+RESTORE FROM 'b1.bak' OVERWRITE;
+backup_id
+#
+#
+# Get backup_id of the RESTORE operation. 
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+#
+# Compare file size to the 'total_bytes' column of the backup_history log.
+#
+Success! File size and total_bytes match.
+#
+# Test case 4 : BACKUP of large database with compression
+#
+BACKUP DATABASE large TO 'b1.bak' WITH COMPRESSION;
+backup_id
+#
+#
+# Get backup_id of the BACKUP operation. 
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+#
+# Compare file size to the 'total_bytes' column of the backup_history log.
+#
+Success! File size and total_bytes match.
+#
+# RESTORE of large database with compression
+#
+RESTORE FROM 'b1.bak' OVERWRITE;
+backup_id
+#
+#
+# Get backup_id of the RESTORE operation. 
+#
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+#
+# Compare file size to the 'total_bytes' column of the backup_history log.
+#
+Success! File size and total_bytes match.
+#
+# Cleanup.
+#
+FLUSH BACKUP LOGS;
+DROP DATABASE IF EXISTS small;
+DROP DATABASE IF EXISTS large;

=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result	2009-08-04 20:12:18 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result	2009-08-21 15:43:19 +0000
@@ -255,7 +255,7 @@ backup_state	complete
 operation	backup
 error_num	0
 num_objects	11
-total_bytes	5215
+total_bytes	4216
 validity_point_time	#
 start_time	#
 stop_time	#
@@ -274,7 +274,7 @@ backup_id	object	error_num	notes
 #	backup kernel	#	#
 #	backup kernel	#	#
 #	backup kernel	#	#
-File sizes are not identical
+File sizes are identical
 
 The actual backup file size and from backup_history logs are different
 because of bug#37980. Once this bug is fixed, both should show 
@@ -324,7 +324,7 @@ backup_state	complete
 operation	restore
 error_num	0
 num_objects	11
-total_bytes	1483
+total_bytes	4216
 validity_point_time	#
 start_time	#
 stop_time	#

=== modified file 'mysql-test/suite/backup/t/backup_compression.test'
--- a/mysql-test/suite/backup/t/backup_compression.test	2009-06-26 13:23:35 +0000
+++ b/mysql-test/suite/backup/t/backup_compression.test	2009-08-21 15:43:19 +0000
@@ -59,11 +59,6 @@ SELECT total_bytes into @total_bytes_no_
 --echo Verify the result
 SELECT @total_bytes_comp < @total_bytes_no_comp;
 
---echo The result 0 indicates that total bytes of compressed and uncompressed
---echo data is same(bug#41898). Once this bug is fixed, result should be 1.
---echo The size of compressed backup image should be less than uncomressed 
---echo image. 
---echo
 --echo Drop database and execute restore operation
 
 DROP DATABASE db1;

=== added file 'mysql-test/suite/backup/t/backup_log_filesize.test'
--- a/mysql-test/suite/backup/t/backup_log_filesize.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_log_filesize.test	2009-08-21 15:43:19 +0000
@@ -0,0 +1,216 @@
+#
+# This test includes tests for ensuring the backup history table reports the
+# correct file size of the backup image in the column 'total_bytes' as discussed
+# and decided in BUG#41898.
+#
+# There are four test cases:
+#  1) backup of a small database - no compression 
+#     restore a small database - no compression
+#  2) backup of a small database - with compression 
+#     restore a small database - with compression
+#  3) backup of a large database - no compression 
+#     restore a large database - no compression
+#  4) backup of a large database - with compression 
+#     restore a large database - with compression
+#
+# The small database test case is needed to test conditions where the output
+# buffer is not completely full and the large database to test conditions
+# where more than one buffer is used to read/write.
+#
+
+--source include/not_embedded.inc
+--source include/have_debug.inc
+
+LET $MYSQLD_BACKUPDIR= `SELECT @@backupdir`;
+
+--disable_warnings
+DROP DATABASE IF EXISTS large;
+DROP DATABASE IF EXISTS small;
+--enable_warnings
+
+LET FILE_NAME = $MYSQLD_BACKUPDIR/b1.bak;
+
+--echo #
+--echo # Creating small database and populating it.
+--echo #
+CREATE DATABASE small;
+CREATE TABLE small.t1 (a int);
+
+--echo #
+--echo # Creating large database and populating it.
+--echo #
+CREATE DATABASE large;
+CREATE TABLE large.t1 (a int);
+
+INSERT INTO large.t1 values (1);
+LET $iterations = 20;
+LET $twopower = 1;
+
+--disable_query_log
+while ($iterations) {
+  --eval INSERT INTO large.t1 SELECT a+$twopower FROM large.t1;
+  dec $iterations;
+  LET $twopower=$twopower*2;
+}
+--enable_query_log
+
+SELECT count(*) FROM large.t1;
+
+--echo #
+--echo # Test case 1 : BACKUP of small database no compression
+--echo #
+
+--replace_column 1 #
+BACKUP DATABASE small TO 'b1.bak';
+
+--echo #
+--echo # Get backup_id of the BACKUP operation. 
+--echo #
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+--echo #
+--echo # Compare file size to the 'total_bytes' column of the backup_history log.
+--echo #
+--source suite/backup/include/check_filesize.inc
+
+--echo #
+--echo # RESTORE of small database no compression
+--echo #
+
+--replace_column 1 #
+RESTORE FROM 'b1.bak' OVERWRITE;
+
+--echo #
+--echo # Get backup_id of the RESTORE operation. 
+--echo #
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+--echo #
+--echo # Compare file size to the 'total_bytes' column of the backup_history log.
+--echo #
+--source suite/backup/include/check_filesize.inc
+
+--remove_file $MYSQLD_BACKUPDIR/b1.bak
+
+--echo #
+--echo # Test case 2 : BACKUP of small database with compression
+--echo #
+
+--replace_column 1 #
+BACKUP DATABASE small TO 'b1.bak' WITH COMPRESSION;
+
+--echo #
+--echo # Get backup_id of the BACKUP operation. 
+--echo #
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+--echo #
+--echo # Compare file size to the 'total_bytes' column of the backup_history log.
+--echo #
+--source suite/backup/include/check_filesize.inc
+
+--echo #
+--echo # RESTORE of small database with compression
+--echo #
+
+--replace_column 1 #
+RESTORE FROM 'b1.bak' OVERWRITE;
+
+--echo #
+--echo # Get backup_id of the RESTORE operation. 
+--echo #
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+--echo #
+--echo # Compare file size to the 'total_bytes' column of the backup_history log.
+--echo #
+--source suite/backup/include/check_filesize.inc
+
+--remove_file $MYSQLD_BACKUPDIR/b1.bak
+
+--echo #
+--echo # Test case 3 : BACKUP of large database no compression
+--echo #
+
+--replace_column 1 #
+BACKUP DATABASE large TO 'b1.bak';
+
+--echo #
+--echo # Get backup_id of the BACKUP operation. 
+--echo #
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+--echo #
+--echo # Compare file size to the 'total_bytes' column of the backup_history log.
+--echo #
+--source suite/backup/include/check_filesize.inc
+
+--echo #
+--echo # RESTORE of large database no compression
+--echo #
+
+--replace_column 1 #
+RESTORE FROM 'b1.bak' OVERWRITE;
+
+--echo #
+--echo # Get backup_id of the RESTORE operation. 
+--echo #
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+--echo #
+--echo # Compare file size to the 'total_bytes' column of the backup_history log.
+--echo #
+--source suite/backup/include/check_filesize.inc
+
+--remove_file $MYSQLD_BACKUPDIR/b1.bak
+
+--echo #
+--echo # Test case 4 : BACKUP of large database with compression
+--echo #
+
+--replace_column 1 #
+BACKUP DATABASE large TO 'b1.bak' WITH COMPRESSION;
+
+--echo #
+--echo # Get backup_id of the BACKUP operation. 
+--echo #
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+--echo #
+--echo # Compare file size to the 'total_bytes' column of the backup_history log.
+--echo #
+--source suite/backup/include/check_filesize.inc
+
+--echo #
+--echo # RESTORE of large database with compression
+--echo #
+
+--replace_column 1 #
+RESTORE FROM 'b1.bak' OVERWRITE;
+
+--echo #
+--echo # Get backup_id of the RESTORE operation. 
+--echo #
+SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
+
+--echo #
+--echo # Compare file size to the 'total_bytes' column of the backup_history log.
+--echo #
+--source suite/backup/include/check_filesize.inc
+--remove_file $MYSQLD_BACKUPDIR/b1.bak
+
+
+--echo #
+--echo # Cleanup.
+--echo #
+
+FLUSH BACKUP LOGS;
+
+--disable_warnings
+DROP DATABASE IF EXISTS small;
+DROP DATABASE IF EXISTS large;
+--enable_warnings
+
+--error 0,1
+--remove_file $MYSQLD_BACKUPDIR/b1.bak
+

=== modified file 'mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc'
--- a/mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc	2009-05-07 01:44:37 +0000
+++ b/mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc	2009-08-21 15:43:19 +0000
@@ -92,13 +92,13 @@ eval $command;
 reap;
 --replace_column 2 <error-code>
 # One error message contains file path - mask it out.
---replace_regex /Error on delete of '.*'/Error on delete of <backup image path>/
+--replace_regex /Error on delete of '.*' /Error on delete of <backup image path> /
 SHOW WARNINGS;
 
 --echo #
 --echo # Examine backup logs.
 --echo #
---replace_regex /[0000-9999]+/####/
+--replace_regex  /[0000-9999]+/####/ /Error on delete of '.*/Error on delete of <backup image path> / 
 SELECT object, error_num, notes FROM mysql.backup_progress;
 --replace_regex /[0000-9999]+/####/
 SELECT backup_state, operation FROM mysql.backup_history;

=== modified file 'sql/backup/image_info.h'
--- a/sql/backup/image_info.h	2009-07-28 06:25:23 +0000
+++ b/sql/backup/image_info.h	2009-08-21 15:43:19 +0000
@@ -87,7 +87,7 @@ public: // public interface
 
   virtual bool is_valid() =0;  ///< Is the structure valid?
 
-  size_t     data_size;      ///< How much of table data is saved in the image.
+  ulonglong  data_size;      ///< How much of table data is saved in the image.
   /// To store master position info.
   st_bstream_binlog_info  master_binlog_info; 
 

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2009-08-11 11:09:31 +0000
+++ b/sql/backup/kernel.cc	2009-08-21 15:43:19 +0000
@@ -1161,8 +1161,15 @@ int Backup_restore_ctx::close()
       if (ret != BSTREAM_OK)
         fatal_error(ER_BACKUP_CLOSE);
     }
+    if (m_catalog)
+      m_catalog->data_size= m_stream->bytes;
   }
 
+  if (m_catalog)
+    report_stats_post(*m_catalog);
+
+  Logger::close();
+
   /* 
     Destroy backup stream's memory allocator (this frees memory)
   
@@ -1250,7 +1257,6 @@ int Backup_restore_ctx::do_backup()
 
   DEBUG_SYNC(m_thd, "before_backup_completed");
   m_completed= TRUE;
-  report_stats_post(info);                      // Never errors
 
   DBUG_PRINT("backup",("Backup done."));
   DEBUG_SYNC(m_thd, "before_backup_done");
@@ -1507,8 +1513,6 @@ int Backup_restore_ctx::do_restore(bool 
   if (info.flags & BSTREAM_FLAG_BINLOG)
     report_binlog_info(info.binlog_info);
 
-  report_stats_post(info);                      // Never errors
-
   DEBUG_SYNC(m_thd, "before_restore_done");
 
   DBUG_RETURN(close());

=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h	2009-05-21 13:17:37 +0000
+++ b/sql/backup/logger.h	2009-08-21 15:43:19 +0000
@@ -51,6 +51,7 @@ public:
    Logger(THD*);
    ~Logger();
    int init(enum_type type, const char *query);
+   void close();
 
    int report_error(int error_code, ...);
    int report_error(log_level::value level, int error_code, ...);
@@ -266,11 +267,6 @@ void Logger::report_completed(time_t whe
   
   // Report stop time to backup logs.
   backup_log->stop(when);
-  /* 
-    Since the operation has completed, we can now write the backup history log
-    entry describing it.
-  */
-  backup_log->write_history();
 }
 
 /**
@@ -304,15 +300,7 @@ void Logger::report_aborted(time_t when,
    report_error(log_level::WARNING, ER_OPERATION_ABORTED);
 
   // Report stop time to backup logs.
-
   backup_log->stop(when);
-  /* 
-    Since the operation has ended, we can now write the backup history log
-    entry describing it.
-  */
-  backup_log->write_history();
-
-  m_state= DONE;
 }
 
 /** 
@@ -427,6 +415,18 @@ int Logger::init(enum_type type, const c
   return 0;
 }
 
+inline
+void Logger::close()
+{
+  if (m_state == DONE)
+    return;
+
+  if (m_state == RUNNING && backup_log)
+    backup_log->write_history();
+  
+  m_state= DONE;
+}
+
 /**
   Error reported
 

=== modified file 'sql/backup/stream.cc'
--- a/sql/backup/stream.cc	2009-08-11 11:09:31 +0000
+++ b/sql/backup/stream.cc	2009-08-21 15:43:19 +0000
@@ -414,7 +414,7 @@ bool Output_stream::init()
     return FALSE;
   }
 
-  bytes= 0;
+  bytes= len;
 
   /*
     The backup stream library uses unsigned long type for storing block size.
@@ -537,6 +537,11 @@ int Output_stream::close()
     } while (zerr != Z_STREAM_END);
     if ((zerr= deflateEnd(&zstream)) != Z_OK)
       m_log.report_error(ER_GET_ERRMSG, zerr, zstream.msg, "deflateEnd");
+    /*
+      If this is a compressed image, store bytes writtent to the 
+      zstream total.
+    */
+    bytes= zstream.total_out; 
     my_free(zbuf, MYF(0));
     if (zerr != Z_OK)
       ret= BSTREAM_ERROR;
@@ -640,7 +645,7 @@ bool Input_stream::init()
     return FALSE;
   }
 
-  bytes= 0;
+  bytes= len;
 
   if (BSTREAM_OK != bstream_open_rd(this, len))
   {
@@ -745,6 +750,11 @@ int Input_stream::close()
     int zerr;
     if ((zerr= inflateEnd(&zstream)) != Z_OK)
       m_log.report_error(ER_GET_ERRMSG, zerr, zstream.msg, "inflateEnd");
+    /*
+      If this is a compressed image, store bytes read from the 
+      zstream total.
+    */
+    bytes= zstream.total_in; 
     my_free(zbuf, (MYF(0)));
     if (zerr)
       ret = BSTREAM_ERROR;

=== modified file 'sql/backup/stream.h'
--- a/sql/backup/stream.h	2009-08-11 11:09:31 +0000
+++ b/sql/backup/stream.h	2009-08-21 15:43:19 +0000
@@ -59,7 +59,7 @@ extern "C" int stream_read(void *instanc
 struct fd_stream: public backup_stream
 {
   int m_fd;                 ///< file descriptor
-  size_t bytes;             ///< bytes read
+  ulonglong bytes;          ///< bytes read
   uchar m_header_buf[10];   ///< header buffer
   bool m_with_compression;  ///< switch to use compression
 #ifdef HAVE_COMPRESS


Attachment: [text/bzr-bundle] bzr/charles.bell@sun.com-20090821154319-vm4qocgcd1bh3w93.bundle
Thread
bzr commit into mysql-6.0-backup branch (charles.bell:2862) Bug#41898Chuck Bell21 Aug