diff options
author | Mattias Jonsson <mattias.jonsson@sun.com> | 2008-10-10 12:01:01 +0200 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@sun.com> | 2008-10-10 12:01:01 +0200 |
commit | d3ea7430152fad48cabd9efb8c80d177405dd090 (patch) | |
tree | 26c18991c89e887e3a6c706f648f8e6be6a7803f /sql/ha_partition.h | |
parent | 9846ab0a70241945f59e1f474137546dcbd66ed8 (diff) | |
download | mariadb-git-d3ea7430152fad48cabd9efb8c80d177405dd090.tar.gz |
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
There was actually two problems
1) when clustered pk, order by non pk index should also
compare with pk as last resort to differ keys from each
other
2) bug in the index search handling in ha_partition (was
found when extending the test case
Solution to 1 was to include the pk in key compare if
clustered pk and search on other index.
Solution for 2 was to remove the optimization from
ordered scan to unordered scan if clustered pk.
mysql-test/r/partition_innodb.result:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
updated test result.
mysql-test/t/partition_innodb.test:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
Added test case for bug verification.
sql/ha_partition.cc:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
using m_curr_key_info with both given index and PK
if clustered PK.
Also including PK in read_set.
Added debug prints for easier verification.
sql/ha_partition.h:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
Changed m_curr_key_info to a null terminated array
with max 2 keys and a terminating null.
For use with key_rec_cmp with both given index and PK.
sql/key.cc:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
added handling of a null terminated array of keys for
use in compare.
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r-- | sql/ha_partition.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 685f057dfce..6e52106dfa5 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -74,9 +74,16 @@ private: handler **m_added_file; // Added parts kept for errors partition_info *m_part_info; // local reference to partition Field **m_part_field_array; // Part field array locally to save acc - uchar *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan - KEY *m_curr_key_info; // Current index - uchar *m_rec0; // table->record[0] + uchar *m_ordered_rec_buffer; // Row and key buffer for ord. idx scan + /* + Current index. + When used in key_rec_cmp: If clustered pk, index compare + must compare pk if given index is same for two rows. + So normally m_curr_key_info[0]= current index and m_curr_key[1]= NULL, + and if clustered pk, [0]= current index, [1]= pk, [2]= NULL + */ + KEY *m_curr_key_info[3]; // Current index + uchar *m_rec0; // table->record[0] QUEUE m_queue; // Prio queue used by sorted read /* Since the partition handler is a handler on top of other handlers, it |