mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge 10.4 into 10.5
This commit is contained in:
@ -4788,6 +4788,69 @@ bool compare_partition_options(HA_CREATE_INFO *table_create_info,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check if the ALTER command tries to change DATA DIRECTORY
|
||||
or INDEX DIRECTORY for its partitions and warn if so.
|
||||
@param thd THD
|
||||
@param part_elem partition_element to check
|
||||
*/
|
||||
static void warn_if_datadir_altered(THD *thd,
|
||||
const partition_element *part_elem)
|
||||
{
|
||||
DBUG_ASSERT(part_elem);
|
||||
|
||||
if (part_elem->engine_type &&
|
||||
part_elem->engine_type->db_type != DB_TYPE_INNODB)
|
||||
return;
|
||||
|
||||
if (part_elem->data_file_name)
|
||||
{
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
WARN_INNODB_PARTITION_OPTION_IGNORED,
|
||||
ER(WARN_INNODB_PARTITION_OPTION_IGNORED),
|
||||
"DATA DIRECTORY");
|
||||
}
|
||||
if (part_elem->index_file_name)
|
||||
{
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
WARN_INNODB_PARTITION_OPTION_IGNORED,
|
||||
ER(WARN_INNODB_PARTITION_OPTION_IGNORED),
|
||||
"INDEX DIRECTORY");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Currently changing DATA DIRECTORY and INDEX DIRECTORY for InnoDB partitions is
|
||||
not possible. This function checks it and warns on that case.
|
||||
@param thd THD
|
||||
@param tab_part_info old partition info
|
||||
@param alt_part_info new partition info
|
||||
*/
|
||||
static void check_datadir_altered_for_innodb(THD *thd,
|
||||
partition_info *tab_part_info,
|
||||
partition_info *alt_part_info)
|
||||
{
|
||||
if (tab_part_info->default_engine_type->db_type != DB_TYPE_INNODB)
|
||||
return;
|
||||
|
||||
for (List_iterator_fast<partition_element> it(alt_part_info->partitions);
|
||||
partition_element *part_elem= it++;)
|
||||
{
|
||||
if (alt_part_info->is_sub_partitioned())
|
||||
{
|
||||
for (List_iterator_fast<partition_element> it2(part_elem->subpartitions);
|
||||
const partition_element *sub_part_elem= it2++;)
|
||||
{
|
||||
warn_if_datadir_altered(thd, sub_part_elem);
|
||||
}
|
||||
}
|
||||
else
|
||||
warn_if_datadir_altered(thd, part_elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Prepare for ALTER TABLE of partition structure
|
||||
|
||||
@ -5623,6 +5686,8 @@ state of p1.
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
check_datadir_altered_for_innodb(thd, tab_part_info, alt_part_info);
|
||||
|
||||
/*
|
||||
Online handling:
|
||||
REORGANIZE PARTITION:
|
||||
|
Reference in New Issue
Block a user