diff options
author | unknown <mikael/pappa@dator5.(none)> | 2006-09-28 06:16:16 -0400 |
---|---|---|
committer | unknown <mikael/pappa@dator5.(none)> | 2006-09-28 06:16:16 -0400 |
commit | dc9613ca36c5cf45d43b806eccf1e7368ad076b1 (patch) | |
tree | 73ffda1ee6b72f34b6bcd0d58fafdbd8354883f0 /sql | |
parent | f6230caa32cd3e9e5bb52f5da7fa4b0657aff01d (diff) | |
parent | a1101327b22e26e716d1989ffa0998ada808c8d2 (diff) | |
download | mariadb-git-dc9613ca36c5cf45d43b806eccf1e7368ad076b1.tar.gz |
Merge dator5.(none):/home/pappa/clean-mysql-5.1-kt
into dator5.(none):/home/pappa/bug18198
mysql-test/r/partition.result:
Auto merged
mysql-test/r/partition_range.result:
Auto merged
mysql-test/t/partition.test:
Auto merged
mysql-test/t/partition_range.test:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/r/partition_error.result:
SCCS merged
mysql-test/t/partition_error.test:
e
C
quit
exit
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_partition.cc | 27 | ||||
-rw-r--r-- | sql/ha_partition.h | 7 | ||||
-rw-r--r-- | sql/sql_table.cc | 27 |
3 files changed, 51 insertions, 10 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e435b356def..3cb855b1035 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1364,6 +1364,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 { @@ -1391,9 +1392,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 @@ -3655,7 +3663,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 +3880,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); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 97086d7b632..d76591b7514 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -45,9 +45,10 @@ private: { partition_index_read= 0, partition_index_first= 1, - partition_index_last= 2, - partition_index_read_last= 3, - partition_no_index_scan= 4 + partition_index_first_unordered= 2, + partition_index_last= 3, + partition_index_read_last= 4, + partition_no_index_scan= 5 }; /* Data for the partition handler */ int m_mode; // Open mode diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bbed97e28a4..4658ebb6cf4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1133,6 +1133,26 @@ bool execute_ddl_log_entry(THD *thd, uint first_entry) /* + Close the ddl log + SYNOPSIS + close_ddl_log() + RETURN VALUES + NONE +*/ + +static void close_ddl_log() +{ + DBUG_ENTER("close_ddl_log"); + if (global_ddl_log.file_id >= 0) + { + VOID(my_close(global_ddl_log.file_id, MYF(MY_WME))); + global_ddl_log.file_id= (File) -1; + } + DBUG_VOID_RETURN; +} + + +/* Execute the ddl log at recovery of MySQL Server SYNOPSIS execute_ddl_log_recovery() @@ -1183,6 +1203,7 @@ void execute_ddl_log_recovery() } } } + close_ddl_log(); create_ddl_log_file_name(file_name); VOID(my_delete(file_name, MYF(0))); global_ddl_log.recovery_phase= FALSE; @@ -1220,11 +1241,7 @@ void release_ddl_log() my_free((char*)free_list, MYF(0)); free_list= tmp; } - if (global_ddl_log.file_id >= 0) - { - VOID(my_close(global_ddl_log.file_id, MYF(MY_WME))); - global_ddl_log.file_id= (File) -1; - } + close_ddl_log(); global_ddl_log.inited= 0; pthread_mutex_unlock(&LOCK_gdl); VOID(pthread_mutex_destroy(&LOCK_gdl)); |