Below is the list of changes that have just been committed into a local
5.1 repository of svoj. When svoj does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-09-06 17:05:07+05:00, svoj@stripped +3 -0
BUG#30583 - Partition on DOUBLE key + INNODB + count(*) == crash
Issuing SELECT COUNT(*) against partitioned InnoDB table may cause
server crash.
Fixed that not all required fields were included into read_set.
mysql-test/r/partition_innodb.result@stripped, 2007-09-06 17:05:05+05:00, svoj@stripped +7 -0
A test case for BUG#30583.
mysql-test/t/partition_innodb.test@stripped, 2007-09-06 17:05:05+05:00, svoj@stripped +8 -0
A test case for BUG#30583.
sql/ha_partition.cc@stripped, 2007-09-06 17:05:05+05:00, svoj@stripped +18 -0
We may get empty read_set for engines that support partial column
read and ::info doesn't return exact row count. This may happen
e.g. with SELECT COUNT(*) FROM t1. We must ensure that all columns
of current key are included into read_set, as partitioning requires
them for sorting (see ha_partition::handle_ordered_index_scan).
diff -Nrup a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
--- a/mysql-test/r/partition_innodb.result 2007-04-16 21:16:12 +05:00
+++ b/mysql-test/r/partition_innodb.result 2007-09-06 17:05:05 +05:00
@@ -129,3 +129,10 @@ insert into t1 (time, first_name, last_n
SELECT * FROM t1 WHERE first_name='Andy' OR last_name='Jake';
id time first_name last_name
drop table t1;
+CREATE TABLE t1 (a DOUBLE NOT NULL, KEY(a)) ENGINE=InnoDB
+PARTITION BY KEY(a) PARTITIONS 10;
+INSERT INTO t1 VALUES(1),(2);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+DROP TABLE t1;
diff -Nrup a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
--- a/mysql-test/t/partition_innodb.test 2007-04-15 21:45:06 +05:00
+++ b/mysql-test/t/partition_innodb.test 2007-09-06 17:05:05 +05:00
@@ -134,3 +134,11 @@ SELECT * FROM t1 WHERE first_name='Andy'
drop table t1;
+#
+# BUG#30583 - Partition on DOUBLE key + INNODB + count(*) == crash
+#
+CREATE TABLE t1 (a DOUBLE NOT NULL, KEY(a)) ENGINE=InnoDB
+PARTITION BY KEY(a) PARTITIONS 10;
+INSERT INTO t1 VALUES(1),(2);
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
diff -Nrup a/sql/ha_partition.cc b/sql/ha_partition.cc
--- a/sql/ha_partition.cc 2007-08-02 09:50:52 +05:00
+++ b/sql/ha_partition.cc 2007-09-06 17:05:05 +05:00
@@ -3324,6 +3324,24 @@ int ha_partition::index_init(uint inx, b
*/
if (m_lock_type == F_WRLCK)
bitmap_union(table->read_set, &m_part_info->full_part_field_set);
+ else if (!(m_table_flags & HA_STATS_RECORDS_IS_EXACT) &&
+ m_table_flags & HA_PARTIAL_COLUMN_READ)
+ {
+ /*
+ We may get empty read_set for engines that support partial column
+ read and ::info doesn't return exact row count. This may happen
+ e.g. with SELECT COUNT(*) FROM t1. We must ensure that all columns
+ of current key are included into read_set, as partitioning requires
+ them for sorting (see ha_partition::handle_ordered_index_scan).
+
+ TODO: optimize this workaround away from here, as we actually do not
+ need to perform ordered index scan in this case.
+ */
+ uint i;
+ for (i= 0; i < m_curr_key_info->key_parts; i++)
+ bitmap_set_bit(table->read_set,
+ m_curr_key_info->key_part[i].field->field_index);
+ }
file= m_file;
do
{