#At file:///home/svoj/mysql/server/mysql-5.1-bug57162/ based on revid:build@stripped
3605 Sergey Vojtovich 2011-02-24
BUG#11764339 - valgrind errors, random data when returning
ordered data from archive tables
Archive was using wrong memory address to check if field
is NULL (after filesort, when reading record again).
@ mysql-test/r/archive.result
A test case for BUG#11764339.
@ mysql-test/t/archive.test
A test case for BUG#11764339.
@ storage/archive/ha_archive.cc
Null bytes are restored to "record" buffer, which may
or may not be equal to record buffer for field. Check
null bits in "record" buffer, instead of Field::null_ptr.
modified:
mysql-test/r/archive.result
mysql-test/t/archive.test
storage/archive/ha_archive.cc
=== modified file 'mysql-test/r/archive.result'
--- a/mysql-test/r/archive.result 2010-03-25 19:57:06 +0000
+++ b/mysql-test/r/archive.result 2011-02-24 12:25:07 +0000
@@ -12756,3 +12756,19 @@ a
1
2
DROP TABLE t1;
+#
+# BUG#57162 - valgrind errors, random data when returning
+# ordered data from archive tables
+#
+SET sort_buffer_size=32804;
+CREATE TABLE t1(a INT, b CHAR(255), c CHAR(255), d CHAR(255),
+e CHAR(255), f INT) ENGINE=ARCHIVE DEFAULT CHARSET utf8;
+INSERT INTO t1 VALUES(-1,'b','c','d','e',1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6;
+SELECT * FROM t1 ORDER BY f LIMIT 1;
+a b c d e f
+-1 b c d e 1
+DROP TABLE t1;
+SET sort_buffer_size=DEFAULT;
=== modified file 'mysql-test/t/archive.test'
--- a/mysql-test/t/archive.test 2010-03-25 19:57:06 +0000
+++ b/mysql-test/t/archive.test 2011-02-24 12:25:07 +0000
@@ -1678,3 +1678,18 @@ SELECT * FROM t1;
REPAIR TABLE t1 EXTENDED;
SELECT * FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # BUG#57162 - valgrind errors, random data when returning
+--echo # ordered data from archive tables
+--echo #
+SET sort_buffer_size=32804;
+CREATE TABLE t1(a INT, b CHAR(255), c CHAR(255), d CHAR(255),
+ e CHAR(255), f INT) ENGINE=ARCHIVE DEFAULT CHARSET utf8;
+INSERT INTO t1 VALUES(-1,'b','c','d','e',1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6;
+SELECT * FROM t1 ORDER BY f LIMIT 1;
+DROP TABLE t1;
+SET sort_buffer_size=DEFAULT;
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc 2010-03-25 19:57:06 +0000
+++ b/storage/archive/ha_archive.cc 2011-02-24 12:25:07 +0000
@@ -1111,7 +1111,7 @@ int ha_archive::unpack_row(azio_stream *
ptr+= table->s->null_bytes;
for (Field **field=table->field ; *field ; field++)
{
- if (!((*field)->is_null()))
+ if (!((*field)->is_null_in_record(record)))
{
ptr= (*field)->unpack(record + (*field)->offset(table->record[0]), ptr);
}
Attachment: [text/bzr-bundle] bzr/sergey.vojtovich@oracle.com-20110224122507-bp1tmv0nxiw4wn0n.bundle