MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Hema Sridharan Date:September 4 2009 9:59pm
Subject:bzr commit into mysql-6.0-backup branch (hema:2867) Bug#47082
View as plain text  
#At file:///export/home/tmp/bug47082/mysql-6.0-backup/ based on revid:hema@stripped

 2867 Hema Sridharan	2009-09-04
      BUG#47082 (Backup should be able to handle rows in
      table of size 1GB). The patch for this bug will 
      create new test case backup_row_size and is placed in 
      backup suite.
      added:
        mysql-test/suite/backup/r/backup_row_size.result
        mysql-test/suite/backup/t/backup_row_size.test

per-file messages:
  mysql-test/suite/backup/r/backup_row_size.result
    Result file for backup_row_size.test
  mysql-test/suite/backup/t/backup_row_size.test
    New test backup_row_size will verify that backup and restore are successful when table has rows of size 1GB
=== added file 'mysql-test/suite/backup/r/backup_row_size.result'
--- a/mysql-test/suite/backup/r/backup_row_size.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_row_size.result	2009-09-04 21:59:07 +0000
@@ -0,0 +1,93 @@
+# Initial clean-up.
+DROP DATABASE IF EXISTS db1;
+# Test 1: Perform backup and restore of database that has table with
+# row size of 1GB
+# Connection con1:
+SELECT @@global.max_allowed_packet;
+@@global.max_allowed_packet
+1048576
+SELECT @@max_allowed_packet;
+@@max_allowed_packet
+1048576
+# Connection default:
+SET GLOBAL MAX_ALLOWED_PACKET=1073741824;
+# Connection con1:
+SELECT @@global.max_allowed_packet;
+@@global.max_allowed_packet
+1073741824
+SELECT @@max_allowed_packet;
+@@max_allowed_packet
+1073741824
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (c1 longblob);
+# We choose longblob as it can handle row sizes upto 4GB in tables
+# The default size of maximum allowed packet is 1MB. Therefore, we
+# change the max allowed packet size to 1GB in order to create rows 
+# of size 1GB
+INSERT INTO db1.t1 VALUES(repeat('z',1073741824));
+SELECT COUNT(*) FROM db1.t1;
+COUNT(*)
+1
+SELECT LENGTH(c1) FROM db1.t1;
+LENGTH(c1)
+1073741824
+# Perform backup and restore
+BACKUP DATABASE db1 TO 'db1.bak';
+backup_id
+#
+DROP DATABASE db1;
+RESTORE FROM 'db1.bak';
+backup_id
+#
+# Verify the data and size of table after restore
+SELECT LENGTH(c1) FROM db1.t1;
+LENGTH(c1)
+1073741824
+SELECT COUNT(*) FROM db1.t1;
+COUNT(*)
+1
+# Check for any errors
+CHECK TABLE db1.t1;
+Table	Op	Msg_type	Msg_text
+db1.t1	check	status	OK
+# Test 2: Increase the size of data in table and perform backup and
+# restore
+SHOW CREATE TABLE db1.t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO db1.t1 VALUES(repeat('z',1073741824));
+INSERT INTO db1.t1 VALUES(repeat('z',1024));
+SELECT COUNT(*) FROM db1.t1;
+COUNT(*)
+3
+SELECT LENGTH(c1) FROM db1.t1;
+LENGTH(c1)
+1073741824
+1073741824
+1024
+CHECK TABLE db1.t1;
+Table	Op	Msg_type	Msg_text
+db1.t1	check	status	OK
+# Perform backup and restore
+BACKUP DATABASE db1 TO 'db1.bak';
+backup_id
+#
+DROP DATABASE db1;
+RESTORE FROM 'db1.bak';
+backup_id
+#
+# Verify the data and size of table after restore
+SELECT SUM(LENGTH(c1)) FROM db1.t1;
+SUM(LENGTH(c1))
+2147484672
+SELECT COUNT(*) FROM db1.t1;
+COUNT(*)
+3
+# Check for any errors
+CHECK TABLE db1.t1;
+Table	Op	Msg_type	Msg_text
+db1.t1	check	status	OK
+# Final clean-up.
+DROP DATABASE db1;

=== added file 'mysql-test/suite/backup/t/backup_row_size.test'
--- a/mysql-test/suite/backup/t/backup_row_size.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_row_size.test	2009-09-04 21:59:07 +0000
@@ -0,0 +1,109 @@
+# This test is created for BUG#47082
+# In this test we will verify that MySQL backup handles tables with row size
+# of 1GB. Mysqldump always had issue to handle row sizes of 1GB
+
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+
+let $bdir=`SELECT @@backupdir`;
+let $allowed_packet=`select @@max_allowed_packet`;
+--echo # Initial clean-up.
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+--error 0,1
+--remove_file $bdir/db1.bak
+--enable_warnings
+
+connect (con1,localhost,root,,);
+
+--echo # Test 1: Perform backup and restore of database that has table with
+--echo # row size of 1GB
+
+--echo # Connection con1:
+connection con1;
+SELECT @@global.max_allowed_packet;
+SELECT @@max_allowed_packet;
+disconnect con1;
+
+--echo # Connection default:
+connection default;
+SET GLOBAL MAX_ALLOWED_PACKET=1073741824;
+
+connect (con1,localhost,root,,);
+
+--echo # Connection con1:
+connection con1;
+SELECT @@global.max_allowed_packet;
+SELECT @@max_allowed_packet;
+
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (c1 longblob);
+
+--echo # We choose longblob as it can handle row sizes upto 4GB in tables
+--echo # The default size of maximum allowed packet is 1MB. Therefore, we
+--echo # change the max allowed packet size to 1GB in order to create rows 
+--echo # of size 1GB
+
+INSERT INTO db1.t1 VALUES(repeat('z',1073741824));
+SELECT COUNT(*) FROM db1.t1;
+SELECT LENGTH(c1) FROM db1.t1;
+
+--echo # Perform backup and restore
+
+--replace_column 1 #
+BACKUP DATABASE db1 TO 'db1.bak';
+
+DROP DATABASE db1;
+
+--replace_column 1 #
+RESTORE FROM 'db1.bak';
+
+--echo # Verify the data and size of table after restore
+SELECT LENGTH(c1) FROM db1.t1;
+SELECT COUNT(*) FROM db1.t1;
+
+--echo # Check for any errors
+CHECK TABLE db1.t1;
+--remove_file $bdir/db1.bak
+
+--echo # Test 2: Increase the size of data in table and perform backup and
+--echo # restore
+
+# Increase the size of data in table to 2GB by inserting one more 1GB row.
+# NOTE: It is not possible to insert rows >1GB as max_allowed_packet size range
+# is from 1024 bytes to 1GB max
+
+SHOW CREATE TABLE db1.t1;
+INSERT INTO db1.t1 VALUES(repeat('z',1073741824));
+INSERT INTO db1.t1 VALUES(repeat('z',1024));
+SELECT COUNT(*) FROM db1.t1;
+SELECT LENGTH(c1) FROM db1.t1;
+CHECK TABLE db1.t1;
+
+--echo # Perform backup and restore
+
+--replace_column 1 #
+BACKUP DATABASE db1 TO 'db1.bak';
+
+DROP DATABASE db1;
+
+--replace_column 1 #
+RESTORE FROM 'db1.bak';
+
+--echo # Verify the data and size of table after restore
+SELECT SUM(LENGTH(c1)) FROM db1.t1;
+SELECT COUNT(*) FROM db1.t1;
+
+--echo # Check for any errors
+CHECK TABLE db1.t1;
+
+--echo # Final clean-up.
+
+--disable_query_log
+eval SET GLOBAL MAX_ALLOWED_PACKET=$allowed_packet;
+--enable_query_log
+
+DROP DATABASE db1;
+--remove_file $bdir/db1.bak
+

Thread
bzr commit into mysql-6.0-backup branch (hema:2867) Bug#47082Hema Sridharan4 Sep