diff options
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r-- | sql/ha_partition.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 220af4d4e89..2142fd27a7f 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -511,6 +511,8 @@ public: virtual int read_range_next(); private: + bool init_record_priority_queue(); + void destroy_record_priority_queue(); int common_index_read(uchar * buf, bool have_start_key); int common_first_last(uchar * buf); int partition_scan_set_up(uchar * buf, bool idx_read_flag); @@ -518,8 +520,15 @@ private: int handle_unordered_scan_next_partition(uchar * buf); uchar *queue_buf(uint part_id) { - return (m_ordered_rec_buffer + - (part_id * (m_rec_length + PARTITION_BYTES_IN_POS))); + uint16 *part_id_map= (uint16*) m_ordered_rec_buffer; + /* Offset to the partition's record buffer in number of partitions. */ + uint offset= part_id_map[part_id]; + /* + Return the pointer to the partition's record buffer. + First skip the partition id map, and then add the offset. + */ + return (m_ordered_rec_buffer + m_tot_parts * PARTITION_BYTES_IN_POS + + (offset * (m_rec_length + PARTITION_BYTES_IN_POS))); } uchar *rec_buf(uint part_id) { |