diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-11 08:48:00 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-11 08:48:00 +0300 |
commit | f7fe51f126043899d024a60f3f983d7b9be400ae (patch) | |
tree | 3f4d1bb1eb4fcb5ad8f0268446857cd95522044d /sql/sql_partition.cc | |
parent | 5ec4efb7b1b36006e629d258e396d8a95df127e1 (diff) | |
parent | d6f0e60a67a5e81dc6fd90a117db2aa5fb658664 (diff) | |
download | mariadb-git-f7fe51f126043899d024a60f3f983d7b9be400ae.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index f5ad4b86a91..4a200dd670b 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4382,6 +4382,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 @@ -5136,6 +5199,8 @@ state of p1. { goto err; } + check_datadir_altered_for_innodb(thd, tab_part_info, alt_part_info); + /* Online handling: REORGANIZE PARTITION: |