From: Ashish Agarwal Date: October 22 2011 1:32pm Subject: bzr push into mysql-5.5 branch (ashish.y.agarwal:3587 to 3588) Bug#11758979 List-Archive: http://lists.mysql.com/commits/141547 X-Bug: 11758979 Message-Id: <201110221332.p9MDWW9k023206@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3588 Ashish Agarwal 2011-10-22 [merge] bug#11758979 - 51252: ARCHIVE TABLES STILL FAIL UNDER STRESS TESTS: CRASH, CORRUPTION, 4G MEMOR Issue: Valgrind errors due to checksum and optimize query against archive tables with null columns. Table record buffer was not initialized. Solution: Initialize the record buffer. modified: mysql-test/r/archive.result mysql-test/t/archive.test storage/archive/ha_archive.cc 3587 Nirbhay Choubey 2011-10-21 [merge] Merge of fix for bug#13106585 from mysql-5.1. modified: cmd-line-utils/libedit/CMakeLists.txt cmd-line-utils/libedit/chartype.c cmd-line-utils/libedit/histedit.h cmd-line-utils/libedit/refresh.c cmd-line-utils/libedit/sys.h cmd-line-utils/libedit/terminal.c === modified file 'mysql-test/r/archive.result' --- a/mysql-test/r/archive.result 2011-03-03 09:12:32 +0000 +++ b/mysql-test/r/archive.result 2011-10-21 10:49:58 +0000 @@ -12823,3 +12823,22 @@ a b c d e f -1 b c d e 1 DROP TABLE t1; SET sort_buffer_size=DEFAULT; +# +# BUG#11758979 - 51252: ARCHIVE TABLES STILL FAIL UNDER STRESS +# TESTS: CRASH, CORRUPTION, 4G MEMOR +# (to be executed with valgrind) +CREATE TABLE t1(a BLOB, b VARCHAR(200)) ENGINE=ARCHIVE; +INSERT INTO t1 VALUES(NULL, ''); +FLUSH TABLE t1; +# we need this select to workaround BUG#11764364 +SELECT * FROM t1; +a b +NULL +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 286155052 +FLUSH TABLE t1; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +DROP TABLE t1; === modified file 'mysql-test/t/archive.test' --- a/mysql-test/t/archive.test 2011-03-03 09:12:32 +0000 +++ b/mysql-test/t/archive.test 2011-10-21 10:49:58 +0000 @@ -1745,3 +1745,18 @@ INSERT INTO t1 SELECT t1.* FROM t1,t1 t2 SELECT * FROM t1 ORDER BY f LIMIT 1; DROP TABLE t1; SET sort_buffer_size=DEFAULT; + + +--echo # +--echo # BUG#11758979 - 51252: ARCHIVE TABLES STILL FAIL UNDER STRESS +--echo # TESTS: CRASH, CORRUPTION, 4G MEMOR +--echo # (to be executed with valgrind) +CREATE TABLE t1(a BLOB, b VARCHAR(200)) ENGINE=ARCHIVE; +INSERT INTO t1 VALUES(NULL, ''); +FLUSH TABLE t1; +--echo # we need this select to workaround BUG#11764364 +SELECT * FROM t1; +CHECKSUM TABLE t1 EXTENDED; +FLUSH TABLE t1; +OPTIMIZE TABLE t1; +DROP TABLE t1; === modified file 'storage/archive/ha_archive.cc' --- a/storage/archive/ha_archive.cc 2011-08-15 18:12:11 +0000 +++ b/storage/archive/ha_archive.cc 2011-10-21 10:49:58 +0000 @@ -819,6 +819,7 @@ uint32 ha_archive::max_row_length(const ptr != end ; ptr++) { + if (!table->field[*ptr]->is_null()) length += 2 + ((Field_blob*)table->field[*ptr])->get_length(); } @@ -1178,6 +1179,17 @@ int ha_archive::unpack_row(azio_stream * /* Copy null bits */ const uchar *ptr= record_buffer->buffer; + /* + Field::unpack() is not called when field is NULL. For VARCHAR + Field::unpack() only unpacks as much bytes as occupied by field + value. In these cases respective memory area on record buffer is + not initialized. + + These uninitialized areas may be accessed by CHECKSUM TABLE or + by optimizer using temporary table (BUG#12997905). We may remove + this memset() when they're fixed. + */ + memset(record, 0, table->s->reclength); memcpy(record, ptr, table->s->null_bytes); ptr+= table->s->null_bytes; for (Field **field=table->field ; *field ; field++) No bundle (reason: useless for push emails).