[Commits] Rev 3570: Fixed bug mdev-3866. in file:///home/igor/maria/maria-5.5-mwl248/

Igor Babaev igor at askmonty.org
Mon Nov 19 23:04:38 EET 2012


At file:///home/igor/maria/maria-5.5-mwl248/

------------------------------------------------------------
revno: 3570
revision-id: igor at askmonty.org-20121119210437-yw8dv6nwhuv3269g
parent: igor at askmonty.org-20121103033805-k8ljjjflkoerlef4
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.5-mwl248
timestamp: Mon 2012-11-19 13:04:37 -0800
message:
  Fixed bug mdev-3866.
  The invalid implementation of the method Field_bit::cmp_max could
  trigger a valgrind complain or could lead to incorrect statistical
  data when collecting engine-independent statistics on BIT fields.
-------------- next part --------------
=== added file 'mysql-test/r/stat_tables_partition.result'
--- a/mysql-test/r/stat_tables_partition.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/stat_tables_partition.result	2012-11-19 21:04:37 +0000
@@ -0,0 +1,12 @@
+#
+# Bug mdev-3866: valgrind complain from ANALYZE on a table with BIT field
+# 
+SET use_stat_tables = 'preferably';
+CREATE TABLE t1 (pk int PRIMARY KEY, a bit(1), INDEX idx(a)
+) ENGINE=MyISAM PARTITION BY KEY(pk) PARTITIONS 2;
+INSERT INTO t1 VALUES (1,1),(2,0),(3,0),(4,1);
+ANALYZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	OK
+SET use_stat_tables = DEFAULT;
+DROP TABLE t1;

=== added file 'mysql-test/t/stat_tables_partition.test'
--- a/mysql-test/t/stat_tables_partition.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/stat_tables_partition.test	2012-11-19 21:04:37 +0000
@@ -0,0 +1,17 @@
+--source include/have_partition.inc
+
+--echo #
+--echo # Bug mdev-3866: valgrind complain from ANALYZE on a table with BIT field
+--echo # 
+
+SET use_stat_tables = 'preferably';
+
+CREATE TABLE t1 (pk int PRIMARY KEY, a bit(1), INDEX idx(a)
+) ENGINE=MyISAM PARTITION BY KEY(pk) PARTITIONS 2;
+INSERT INTO t1 VALUES (1,1),(2,0),(3,0),(4,1);
+
+ANALYZE TABLE t1;
+
+SET use_stat_tables = DEFAULT;
+
+DROP TABLE t1;

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2012-11-03 03:38:05 +0000
+++ b/sql/field.cc	2012-11-19 21:04:37 +0000
@@ -8371,7 +8371,9 @@
     if ((flag= (int) (bits_a - bits_b)))
       return flag;
   }
-  return memcmp(a, b, field_length);
+  if (!bytes_in_rec)
+    return 0;
+  return memcmp(a, b, bytes_in_rec);
 }
 
 



More information about the commits mailing list