diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2012-09-10 13:32:50 +0200 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2012-09-10 13:32:50 +0200 |
commit | 8ce6582c37be81281b7ada6797c456c661c214dd (patch) | |
tree | dd9ae7dc854d8862ade0eaaa3586c019be839fca /sql/ha_partition.h | |
parent | 7dbada1674aee6914aff096885dd18a7ea7b73c0 (diff) | |
download | mariadb-git-8ce6582c37be81281b7ada6797c456c661c214dd.tar.gz |
Bug#14495351: CRASH IN HA_PARTITION::HANDLE_UNORDERED_NEXT
The partitioning engine does not implement index_next for partitions
which return HA_ERR_KEY_NOT_FOUND in index_read_map.
If HA_ERR_KEY_NOT_FOUND was returned by a partition during
index_read_map, that partition would not be included in following
calls to index_next. If no partition returned a row in index_read_map,
then the subsequent call to index_next would try to use a non existing
handler (index out of bound).
Even after fixing the index out of bound if at least one partition
returned.
So it is really two connected bugs
1) crash due to index out of bound (-1 unsigned).
2) not including partitions that returned HA_ERR_KEY_NOT_FOUND.
Fixed by recording the partitions that returned HA_ERR_KEY_NOT_FOUND,
and include them too when doing handle_ordered_next the first time.
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r-- | sql/ha_partition.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 294e9f8adf6..24f04ee596b 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -183,6 +183,9 @@ private: static int compare_number_of_records(ha_partition *me, const uint32 *a, const uint32 *b); + /** partitions that returned HA_ERR_KEY_NOT_FOUND. */ + MY_BITMAP m_key_not_found_partitions; + bool m_key_not_found; public: handler *clone(const char *name, MEM_ROOT *mem_root); virtual void set_part_info(partition_info *part_info) @@ -519,6 +522,7 @@ private: int handle_unordered_next(uchar * buf, bool next_same); int handle_unordered_scan_next_partition(uchar * buf); int handle_ordered_index_scan(uchar * buf, bool reverse_order); + int handle_ordered_index_scan_key_not_found(); int handle_ordered_next(uchar * buf, bool next_same); int handle_ordered_prev(uchar * buf); void return_top_record(uchar * buf); |