From: Date: June 9 2008 10:25am Subject: bzr commit into mysql-6.0 branch (ogrovlen:2632) Bug#36586, Bug#36624 List-Archive: http://lists.mysql.com/commits/47588 X-Bug: 36624 Message-Id: <20080609082534.AD562193@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///home/og136792/mysql/shared/mysql-6.0-backup-1/ 2632 Oystein Grovlen 2008-06-09 BUG#36586 Online backup stream library can miss end of a stream. Make sure end-of-stream is detected. added: mysql-test/r/backup_multi_blocks.result mysql-test/t/backup_multi_blocks.test modified: mysql-test/lib/mtr_report.pl sql/backup/stream_v1_transport.c per-file messages: mysql-test/lib/mtr_report.pl Ignore expected restore failure in that backup_multi_blocks test mysql-test/r/backup_multi_blocks.result Output for new test. mysql-test/t/backup_multi_blocks.test Test that a restore of a multi-block backup is succesful. Prior to this bug fix, test would hang. Until bug 36624 is fixed the restore in this test will fail, and currently the test is written to expect that. sql/backup/stream_v1_transport.c Make sure unexpected end-of-stream is detected in load_buffer() I have verified that all calls to as_read() now checks for end-of-stream. === modified file 'mysql-test/lib/mtr_report.pl' --- a/mysql-test/lib/mtr_report.pl 2008-05-05 19:38:05 +0000 +++ b/mysql-test/lib/mtr_report.pl 2008-06-09 08:25:26 +0000 @@ -333,6 +333,13 @@ sub mtr_report_stats ($) { ( /Backup:/ or /Restore:/ or /Can't open the online backup progress tables/ ) or + + # Filter expected Restore error in backup_multi_blocks + ($testname eq 'main.backup_multi_blocks') and + ( + /Restore: Error when reading summary section of backup image/ + ) or + # The tablespace test triggers error below on purpose ($testname eq 'main.backup_tablespace') and ( === added file 'mysql-test/r/backup_multi_blocks.result' --- a/mysql-test/r/backup_multi_blocks.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/r/backup_multi_blocks.result 2008-06-09 08:25:26 +0000 @@ -0,0 +1,33 @@ +create database mysqltest; +use mysqltest; +CREATE TABLE t1 (a longtext) engine=myisam; +use mysqltest; +insert into t1 values ("text"); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +update t1 set a=concat(a,a); +select length(a) from t1; +length(a) +32768 +BACKUP DATABASE mysqltest TO 'test.ba'; +backup_id +#; +DROP DATABASE mysqltest; +RESTORE FROM 'test.ba'; +ERROR HY000: Error when reading summary section of backup image +select length(a) from t1; +length(a) +checksum table t1; +Table Checksum +mysqltest.t1 0 +drop database mysqltest; === added file 'mysql-test/t/backup_multi_blocks.test' --- a/mysql-test/t/backup_multi_blocks.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/backup_multi_blocks.test 2008-06-09 08:25:26 +0000 @@ -0,0 +1,26 @@ +create database mysqltest; +use mysqltest; + +CREATE TABLE t1 (a longtext) engine=myisam; + +use mysqltest; +insert into t1 values ("text"); +let $1=13; +while ($1) +{ + update t1 set a=concat(a,a); + dec $1; +} +select length(a) from t1; + +--replace_column 1 #; +BACKUP DATABASE mysqltest TO 'test.ba'; + +DROP DATABASE mysqltest; + +--error 1698 +RESTORE FROM 'test.ba'; + +select length(a) from t1; +checksum table t1; +drop database mysqltest; === modified file 'sql/backup/stream_v1_transport.c' --- a/sql/backup/stream_v1_transport.c 2007-12-03 20:28:32 +0000 +++ b/sql/backup/stream_v1_transport.c 2008-06-09 08:25:26 +0000 @@ -1480,7 +1480,7 @@ int bstream_read_part(backup_stream *s, saved= *data; data->end= data->begin + howmuch; - as_read(&s->stream,data,buf); + if (as_read(&s->stream, data, buf) == BSTREAM_EOS) s->state= EOS; s->buf.begin += data->begin - saved.begin; s->buf.pos= s->buf.begin;