mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
12
mysql-test/r/stat_tables_partition.result
Normal file
12
mysql-test/r/stat_tables_partition.result
Normal file
@ -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;
|
17
mysql-test/t/stat_tables_partition.test
Normal file
17
mysql-test/t/stat_tables_partition.test
Normal file
@ -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;
|
@ -8371,7 +8371,9 @@ int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len)
|
|||||||
if ((flag= (int) (bits_a - bits_b)))
|
if ((flag= (int) (bits_a - bits_b)))
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
return memcmp(a, b, field_length);
|
if (!bytes_in_rec)
|
||||||
|
return 0;
|
||||||
|
return memcmp(a, b, bytes_in_rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user