From 814b81ad6b8583fdaa67fa2c6999feac0a5a0a26 Mon Sep 17 00:00:00 2001 From: "mikael/pappa@dator5.(none)" <> Date: Mon, 4 Sep 2006 11:18:34 -0400 Subject: BUG#21210: ALTER TABLE t1 REORGANIZE PARTITION crashes when using InnoDB Inserted wrong handlers into the new_file_array which later caused havoc in rename_partitions --- sql/ha_partition.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sql/ha_partition.cc') diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 30c64760c88..377f5dbc83c 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1360,6 +1360,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, i= 0; part_count= 0; orig_count= 0; + first= TRUE; part_it.rewind(); do { @@ -1387,9 +1388,16 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, DBUG_RETURN(ER_OUTOFMEMORY); } } while (++j < no_subparts); + if (part_elem->part_state == PART_CHANGED) + orig_count+= no_subparts; + else if (temp_partitions && first) + { + orig_count+= (no_subparts * temp_partitions); + first= FALSE; + } } } while (++i < no_parts); - + first= FALSE; /* Step 5: Create the new partitions and also open, lock and call external_lock -- cgit v1.2.1 From 3b4ef2a9755328c9a510d31336792ba52d4555d3 Mon Sep 17 00:00:00 2001 From: "mikael/pappa@dator5.(none)" <> Date: Tue, 19 Sep 2006 02:56:02 -0400 Subject: BUG#22178: Scan ordered performed also on engines not supporting ordered scans Scan of ranges without start key should not use ordered scans unless it is requested. --- sql/ha_partition.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'sql/ha_partition.cc') diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e435b356def..6b08d42edce 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3655,7 +3655,10 @@ int ha_partition::read_range_first(const key_range *start_key, if (!start_key) // Read first record { - m_index_scan_type= partition_index_first; + if (m_ordered) + m_index_scan_type= partition_index_first; + else + m_index_scan_type= partition_index_first_unordered; error= common_first_last(m_rec0); } else @@ -3869,6 +3872,18 @@ int ha_partition::handle_unordered_scan_next_partition(byte * buf) DBUG_PRINT("info", ("index_first on partition %d", i)); error= file->index_first(buf); break; + case partition_index_first_unordered: + /* + We perform a scan without sorting and this means that we + should not use the index_first since not all handlers + support it and it is also unnecessary to restrict sort + order. + */ + DBUG_PRINT("info", ("read_range_first on partition %d", i)); + table->record[0]= buf; + error= file->read_range_first(0, end_range, eq_range, 0); + table->record[0]= m_rec0; + break; default: DBUG_ASSERT(FALSE); DBUG_RETURN(1); -- cgit v1.2.1 From 1cdf82e012148370a721d9c4ac5c3cc9bcba00ba Mon Sep 17 00:00:00 2001 From: "mikael/pappa@dator5.(none)" <> Date: Mon, 2 Oct 2006 15:52:29 -0400 Subject: BUG#18198: Partition function handling Fixes of after review fixes --- sql/ha_partition.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sql/ha_partition.cc') diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 3cb855b1035..1e75dd08f38 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2670,7 +2670,10 @@ int ha_partition::write_row(byte * buf) #endif dbug_tmp_restore_column_map(table->read_set, old_map); if (unlikely(error)) + { + m_part_info->err_value= func_value; DBUG_RETURN(error); + } m_last_part= part_id; DBUG_PRINT("info", ("Insert in partition %d", part_id)); DBUG_RETURN(m_file[part_id]->write_row(buf)); @@ -2719,6 +2722,7 @@ int ha_partition::update_row(const byte *old_data, byte *new_data) m_part_info, &old_part_id, &new_part_id, &func_value))) { + m_part_info->err_value= func_value; DBUG_RETURN(error); } -- cgit v1.2.1