Merge dator5.(none):/home/pappa/bug21350
into dator5.(none):/home/pappa/bug21388 sql/ha_partition.cc: Auto merged mysql-test/r/partition.result: manual merge mysql-test/t/partition.test: manual merge
This commit is contained in:
commit
f56dd7f9f8
@ -42,6 +42,15 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
|
|||||||
t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int)
|
create table t1 (a int)
|
||||||
|
partition by key (a)
|
||||||
|
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||||
|
ERROR 42000: Incorrect table name 'part-data'
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by key (a)
|
||||||
|
(partition p0,
|
||||||
|
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||||
|
ERROR 42000: Incorrect table name 'part-data'
|
||||||
|
create table t1 (a int)
|
||||||
partition by list (a)
|
partition by list (a)
|
||||||
(partition p0 values in (1));
|
(partition p0 values in (1));
|
||||||
create procedure pz()
|
create procedure pz()
|
||||||
|
@ -50,6 +50,24 @@ insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
|||||||
show table status;
|
show table status;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug 21350: Data Directory problems
|
||||||
|
#
|
||||||
|
-- error 1103
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by key (a)
|
||||||
|
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||||
|
|
||||||
|
#
|
||||||
|
# Insert a test that manages to create the first partition and fails with
|
||||||
|
# the second, ensure that we clean up afterwards in a proper manner.
|
||||||
|
#
|
||||||
|
--error 1103
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by key (a)
|
||||||
|
(partition p0,
|
||||||
|
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug 19309 Partitions: Crash if double procedural alter
|
# Bug 19309 Partitions: Crash if double procedural alter
|
||||||
#
|
#
|
||||||
|
@ -1134,7 +1134,9 @@ int ha_partition::prepare_new_partition(TABLE *table,
|
|||||||
bool open_flag= FALSE;
|
bool open_flag= FALSE;
|
||||||
DBUG_ENTER("prepare_new_partition");
|
DBUG_ENTER("prepare_new_partition");
|
||||||
|
|
||||||
set_up_table_before_create(table, part_name, create_info, 0, p_elem);
|
if ((error= set_up_table_before_create(table, part_name, create_info,
|
||||||
|
0, p_elem)))
|
||||||
|
goto error;
|
||||||
if ((error= file->create(part_name, table, create_info)))
|
if ((error= file->create(part_name, table, create_info)))
|
||||||
goto error;
|
goto error;
|
||||||
create_flag= TRUE;
|
create_flag= TRUE;
|
||||||
@ -1633,7 +1635,7 @@ uint ha_partition::del_ren_cre_table(const char *from,
|
|||||||
char from_buff[FN_REFLEN], to_buff[FN_REFLEN];
|
char from_buff[FN_REFLEN], to_buff[FN_REFLEN];
|
||||||
char *name_buffer_ptr;
|
char *name_buffer_ptr;
|
||||||
uint i;
|
uint i;
|
||||||
handler **file;
|
handler **file, **abort_file;
|
||||||
DBUG_ENTER("del_ren_cre_table()");
|
DBUG_ENTER("del_ren_cre_table()");
|
||||||
|
|
||||||
if (get_from_handler_file(from, current_thd->mem_root))
|
if (get_from_handler_file(from, current_thd->mem_root))
|
||||||
@ -1657,8 +1659,10 @@ uint ha_partition::del_ren_cre_table(const char *from,
|
|||||||
error= (*file)->delete_table((const char*) from_buff);
|
error= (*file)->delete_table((const char*) from_buff);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_up_table_before_create(table_arg, from_buff, create_info, i, NULL);
|
if ((error= set_up_table_before_create(table_arg, from_buff,
|
||||||
error= (*file)->create(from_buff, table_arg, create_info);
|
create_info, i, NULL)) ||
|
||||||
|
((error= (*file)->create(from_buff, table_arg, create_info))))
|
||||||
|
goto create_error;
|
||||||
}
|
}
|
||||||
name_buffer_ptr= strend(name_buffer_ptr) + 1;
|
name_buffer_ptr= strend(name_buffer_ptr) + 1;
|
||||||
if (error)
|
if (error)
|
||||||
@ -1666,6 +1670,16 @@ uint ha_partition::del_ren_cre_table(const char *from,
|
|||||||
i++;
|
i++;
|
||||||
} while (*(++file));
|
} while (*(++file));
|
||||||
DBUG_RETURN(save_error);
|
DBUG_RETURN(save_error);
|
||||||
|
create_error:
|
||||||
|
name_buffer_ptr= m_name_buffer_ptr;
|
||||||
|
for (abort_file= file, file= m_file; file < abort_file; file++)
|
||||||
|
{
|
||||||
|
create_partition_name(from_buff, from, name_buffer_ptr, NORMAL_PART_NAME,
|
||||||
|
FALSE);
|
||||||
|
VOID((*file)->delete_table((const char*) from_buff));
|
||||||
|
name_buffer_ptr= strend(name_buffer_ptr) + 1;
|
||||||
|
}
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1720,7 +1734,8 @@ partition_element *ha_partition::find_partition_element(uint part_id)
|
|||||||
part_id Partition id of partition to set-up
|
part_id Partition id of partition to set-up
|
||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
NONE
|
TRUE Error
|
||||||
|
FALSE Success
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Set up
|
Set up
|
||||||
@ -1730,31 +1745,40 @@ partition_element *ha_partition::find_partition_element(uint part_id)
|
|||||||
4) Data file name on partition
|
4) Data file name on partition
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ha_partition::set_up_table_before_create(TABLE *table,
|
int ha_partition::set_up_table_before_create(TABLE *table,
|
||||||
const char *partition_name_with_path,
|
const char *partition_name_with_path,
|
||||||
HA_CREATE_INFO *info,
|
HA_CREATE_INFO *info,
|
||||||
uint part_id,
|
uint part_id,
|
||||||
partition_element *part_elem)
|
partition_element *part_elem)
|
||||||
{
|
{
|
||||||
|
int error= 0;
|
||||||
|
const char *partition_name;
|
||||||
|
THD *thd= current_thd;
|
||||||
|
DBUG_ENTER("set_up_table_before_create");
|
||||||
|
|
||||||
if (!part_elem)
|
if (!part_elem)
|
||||||
{
|
{
|
||||||
part_elem= find_partition_element(part_id);
|
part_elem= find_partition_element(part_id);
|
||||||
if (!part_elem)
|
if (!part_elem)
|
||||||
return; // Fatal error
|
DBUG_RETURN(1); // Fatal error
|
||||||
}
|
}
|
||||||
table->s->max_rows= part_elem->part_max_rows;
|
table->s->max_rows= part_elem->part_max_rows;
|
||||||
table->s->min_rows= part_elem->part_min_rows;
|
table->s->min_rows= part_elem->part_min_rows;
|
||||||
const char *partition_name= strrchr(partition_name_with_path, FN_LIBCHAR);
|
partition_name= strrchr(partition_name_with_path, FN_LIBCHAR);
|
||||||
if (part_elem->index_file_name)
|
if ((part_elem->index_file_name &&
|
||||||
append_file_to_dir(current_thd,
|
(error= append_file_to_dir(thd,
|
||||||
(const char**)&part_elem->index_file_name,
|
(const char**)&part_elem->index_file_name,
|
||||||
partition_name+1);
|
partition_name+1))) ||
|
||||||
if (part_elem->data_file_name)
|
(part_elem->data_file_name &&
|
||||||
append_file_to_dir(current_thd,
|
(error= append_file_to_dir(thd,
|
||||||
(const char**)&part_elem->data_file_name,
|
(const char**)&part_elem->data_file_name,
|
||||||
partition_name+1);
|
partition_name+1))))
|
||||||
|
{
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
}
|
||||||
info->index_file_name= part_elem->index_file_name;
|
info->index_file_name= part_elem->index_file_name;
|
||||||
info->data_file_name= part_elem->data_file_name;
|
info->data_file_name= part_elem->data_file_name;
|
||||||
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,11 +222,11 @@ private:
|
|||||||
bool new_handlers_from_part_info(MEM_ROOT *mem_root);
|
bool new_handlers_from_part_info(MEM_ROOT *mem_root);
|
||||||
bool create_handlers(MEM_ROOT *mem_root);
|
bool create_handlers(MEM_ROOT *mem_root);
|
||||||
void clear_handler_file();
|
void clear_handler_file();
|
||||||
void set_up_table_before_create(TABLE *table_arg,
|
int set_up_table_before_create(TABLE *table_arg,
|
||||||
const char *partition_name_with_path,
|
const char *partition_name_with_path,
|
||||||
HA_CREATE_INFO *info,
|
HA_CREATE_INFO *info,
|
||||||
uint part_id,
|
uint part_id,
|
||||||
partition_element *p_elem);
|
partition_element *p_elem);
|
||||||
partition_element *find_partition_element(uint part_id);
|
partition_element *find_partition_element(uint part_id);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user