summaryrefslogtreecommitdiff
path: root/mysql-test/t/myisampack.test
diff options
context:
space:
mode:
authorSatya B <satya.bn@sun.com>2009-03-25 14:45:53 +0530
committerSatya B <satya.bn@sun.com>2009-03-25 14:45:53 +0530
commitca873cd7c7d94666c4dfb533f07af3576d242294 (patch)
treea5fcab5cc1a510a6ab10046d66933795ee146085 /mysql-test/t/myisampack.test
parentaeb9747a95dd77c983d58f553637812c99507753 (diff)
downloadmariadb-git-ca873cd7c7d94666c4dfb533f07af3576d242294.tar.gz
Fix for BUG#41541 - Valgrind warnings on packed MyISAM table
After the table is compressed by the myisampack utility, opening the table by the server produces valgrind warnings. This happens because when we try to read a record into the buffer we alway assume that the remaining buffer to read is always equal to word size(4 or 8 or 2 bytes) we read. Sometimes we have remaining buffer size less than word size and trying to read the entire word size will end up in valgrind errors. Fixed by reading byte by byte when we detect the remaining buffer size is less than the word size. myisam/mi_packrec.c: Fixed fill_buffer() to read byte by byte when the remaining buffer size is less than word size. mysql-test/r/myisampack.result: Result file for BUG#41541 mysql-test/t/myisampack.test: Testcase for BUG#41541
Diffstat (limited to 'mysql-test/t/myisampack.test')
-rw-r--r--mysql-test/t/myisampack.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test
index 6598af6318a..ace7afce88a 100644
--- a/mysql-test/t/myisampack.test
+++ b/mysql-test/t/myisampack.test
@@ -31,3 +31,22 @@ FLUSH TABLES;
--exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
+
+--echo #
+--echo # BUG#41541 - Valgrind warnings on packed MyISAM table
+--echo #
+CREATE TABLE t1(f1 VARCHAR(200), f2 TEXT);
+INSERT INTO t1 VALUES ('foo', 'foo1'), ('bar', 'bar1');
+let $i=9;
+--disable_query_log
+while ($i)
+{
+ INSERT INTO t1 SELECT * FROM t1;
+ dec $i;
+}
+--enable_query_log
+FLUSH TABLE t1;
+--echo # Compress the table using MYISAMPACK tool
+--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;