From: Ashish Agarwal Date: October 22 2011 1:34pm Subject: bzr push into mysql-trunk branch (ashish.y.agarwal:3524 to 3525) Bug#11758979 List-Archive: http://lists.mysql.com/commits/141548 X-Bug: 11758979 Message-Id: <201110221334.p9MDYGjr023733@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3525 Ashish Agarwal 2011-10-22 [merge] #BUG#11758979 - 51252: merge from mysql-5.5 modified: mysql-test/r/archive.result mysql-test/t/archive.test storage/archive/ha_archive.cc 3524 kevin.lewis@stripped 2011-10-21 WL5873 - TABLE FLAGS REFACTORING ** This is a non-functional change. Isolate all table flag handling to inline functions. Separate handing of table flags from tablespace flags, table flags and SYS_TABLES.TYPE. Add and clarify lots of comments. Make conversion routines between the three versions of these flags. Make validation routines for tablespace flags and table flags. Updated copyright on touched files and other code cleanup. modified: storage/innobase/btr/btr0cur.c storage/innobase/dict/dict0boot.c storage/innobase/dict/dict0crea.c storage/innobase/dict/dict0load.c storage/innobase/dict/dict0mem.c storage/innobase/fil/fil0fil.c storage/innobase/fsp/fsp0fsp.c storage/innobase/handler/ha_innodb.cc storage/innobase/handler/i_s.cc storage/innobase/ibuf/ibuf0ibuf.c storage/innobase/include/dict0dict.h storage/innobase/include/dict0dict.ic storage/innobase/include/dict0mem.h storage/innobase/include/fsp0fsp.h storage/innobase/include/fsp0fsp.ic storage/innobase/include/page0types.h storage/innobase/include/page0zip.ic storage/innobase/include/rem0types.h storage/innobase/include/univ.i storage/innobase/page/page0zip.c storage/innobase/row/row0ext.c storage/innobase/row/row0mysql.c storage/innobase/row/row0sel.c === modified file 'mysql-test/r/archive.result' --- a/mysql-test/r/archive.result 2011-10-18 08:57:54 +0000 +++ b/mysql-test/r/archive.result 2011-10-22 13:27:18 +0000 @@ -12896,3 +12896,22 @@ Warning 1071 Specified key was too long; Warning 1194 Found wrong key definition in #sql-temporary; Please do "ALTER TABLE `#sql-temporary` FORCE" to fix it! Error 1005 Can't create table 'test.#sql-temporary' (errno: -1) DROP TABLE t1; +# +# 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-10-18 08:57:54 +0000 +++ b/mysql-test/t/archive.test 2011-10-22 13:27:18 +0000 @@ -1788,3 +1788,17 @@ CREATE INDEX i1 ON t1(c1); --replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ SHOW WARNINGS; DROP TABLE t1; + +--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-10-08 17:18:28 +0000 +++ b/storage/archive/ha_archive.cc 2011-10-22 13:27:18 +0000 @@ -931,6 +931,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(); } @@ -1295,6 +1296,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).