summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorunknown <mikael@dator5.(none)>2006-07-05 12:57:23 -0400
committerunknown <mikael@dator5.(none)>2006-07-05 12:57:23 -0400
commit43179555d90d1aee70d196e918e981f70168eb8d (patch)
tree8f36a7bb24ca74f2a63dee7cf39c872db64f6570 /sql/ha_partition.cc
parent60d070b2736fb3d326eacd973a5af9a2ba094c84 (diff)
downloadmariadb-git-43179555d90d1aee70d196e918e981f70168eb8d.tar.gz
BUG#20770: DATA DIRECTORY and INDEX DIRECTORY error when ALTER TABLE ADD/DROP/REORGANIZE partition
Also some error in handling options for subpartitions. mysql-test/r/partition.result: New test cases mysql-test/t/partition.test: New test cases sql/ha_partition.cc: Added partition_element to prepare_new_partition so that we can properly set-up table before creating partitions. sql/ha_partition.h: Added partition_element to prepare_new_partition so that we can properly set-up table before creating partitions. sql/sql_yacc.yy: Ensure that subpartitions always inherit options from the partition they belong to. They can change it afterwards but will use the options as set on partition level if set at that level.
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index c0257e08537..85b02553be4 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1125,13 +1125,15 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
int ha_partition::prepare_new_partition(TABLE *table,
HA_CREATE_INFO *create_info,
- handler *file, const char *part_name)
+ handler *file, const char *part_name,
+ partition_element *p_elem)
{
int error;
bool create_flag= FALSE;
bool open_flag= FALSE;
DBUG_ENTER("prepare_new_partition");
+ set_up_table_before_create(table, part_name, create_info, 0, p_elem);
if ((error= file->create(part_name, table, create_info)))
goto error;
create_flag= TRUE;
@@ -1420,7 +1422,8 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
DBUG_PRINT("info", ("Add subpartition %s", part_name_buff));
if ((error= prepare_new_partition(table, create_info,
new_file_array[part],
- (const char *)part_name_buff)))
+ (const char *)part_name_buff,
+ sub_elem)))
{
cleanup_new_partition(part_count);
DBUG_RETURN(error);
@@ -1436,7 +1439,8 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
DBUG_PRINT("info", ("Add partition %s", part_name_buff));
if ((error= prepare_new_partition(table, create_info,
new_file_array[i],
- (const char *)part_name_buff)))
+ (const char *)part_name_buff,
+ part_elem)))
{
cleanup_new_partition(part_count);
DBUG_RETURN(error);
@@ -1648,7 +1652,7 @@ uint ha_partition::del_ren_cre_table(const char *from,
error= (*file)->delete_table((const char*) from_buff);
else
{
- set_up_table_before_create(table_arg, from_buff, create_info, i);
+ set_up_table_before_create(table_arg, from_buff, create_info, i, NULL);
error= (*file)->create(from_buff, table_arg, create_info);
}
name_buffer_ptr= strend(name_buffer_ptr) + 1;
@@ -1724,12 +1728,15 @@ partition_element *ha_partition::find_partition_element(uint part_id)
void ha_partition::set_up_table_before_create(TABLE *table,
const char *partition_name_with_path,
HA_CREATE_INFO *info,
- uint part_id)
+ uint part_id,
+ partition_element *part_elem)
{
- partition_element *part_elem= find_partition_element(part_id);
-
if (!part_elem)
- return; // Fatal error
+ {
+ part_elem= find_partition_element(part_id);
+ if (!part_elem)
+ return; // Fatal error
+ }
table->s->max_rows= part_elem->part_max_rows;
table->s->min_rows= part_elem->part_min_rows;
const char *partition_name= strrchr(partition_name_with_path, FN_LIBCHAR);