Bug#30573: Ordered range scan over partitioned tables returns some rows twice

and
Bug#33555: Group By Query does not correctly aggregate partitions

Backport of bug-33257 which is the same bug.

read_range_*() calls was not passed to the partition handlers,
but was translated to index_read/next family calls.
Resulting in duplicates rows and wrong aggregations.

mysql-test/r/partition_range.result:
  Bug#30573: Ordered range scan over partitioned tables returns some rows twice
  
  Updated result file
mysql-test/t/partition_range.test:
  Bug#30573: Ordered range scan over partitioned tables returns some rows twice
  
  Re-enabled the test
sql/ha_partition.cc:
  Bug#30573: Ordered range scan over partitioned tables returns some rows twice
  
  backport of bug-33257, correct handling of read_range_* calls,
  without converting them to index_read/next calls
sql/ha_partition.h:
  Bug#30573: Ordered range scan over partitioned tables returns some rows twice
  
  backport of bug-33257, correct handling of read_range_* calls,
  without converting them to index_read/next calls
This commit is contained in:
Mattias Jonsson 2008-09-18 22:49:34 +03:00
commit 3e1d88d188
4 changed files with 159 additions and 90 deletions

View file

@ -49,7 +49,8 @@ private:
partition_index_first_unordered= 2,
partition_index_last= 3,
partition_index_read_last= 4,
partition_no_index_scan= 5
partition_read_range = 5,
partition_no_index_scan= 6
};
/* Data for the partition handler */
int m_mode; // Open mode
@ -63,8 +64,6 @@ private:
handler **m_reorged_file; // Reorganised partitions
handler **m_added_file; // Added parts kept for errors
partition_info *m_part_info; // local reference to partition
uchar *m_start_key_ref; // Reference of start key in current
// index scan info
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
@ -429,9 +428,7 @@ public:
virtual int read_range_next();
private:
int common_index_read(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag);
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);
int handle_unordered_next(uchar * buf, bool next_same);