diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-11 10:32:24 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-11 10:32:24 +0300 |
commit | c6a6830916b08a66d0d94318e2821a608128b66d (patch) | |
tree | 430d172b30b83b168246719e6cc6739a0e22d60b /sql | |
parent | f1616bacb7dab7bd62f509647d4e3fd2f7a4234e (diff) | |
parent | f7fe51f126043899d024a60f3f983d7b9be400ae (diff) | |
download | mariadb-git-c6a6830916b08a66d0d94318e2821a608128b66d.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'sql')
-rw-r--r-- | sql/share/errmsg-utf8.txt | 2 | ||||
-rw-r--r-- | sql/sql_partition.cc | 65 |
2 files changed, 67 insertions, 0 deletions
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index b6cd8e6487d..07b6df38c86 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7338,6 +7338,8 @@ ER_NO_EIS_FOR_FIELD ER_WARN_AGGFUNC_DEPENDENCE eng "Aggregate function '%-.192s)' of SELECT #%d belongs to SELECT #%d" ukr "Агрегатна функція '%-.192s)' з SELECTу #%d належить до SELECTу #%d" +WARN_INNODB_PARTITION_OPTION_IGNORED + eng "<%-.64s> option ignored for InnoDB partition" # # Internal errors, not used diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index a3dbadd9025..d23ee8583e3 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4794,6 +4794,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 @@ -5629,6 +5692,8 @@ state of p1. { goto err; } + check_datadir_altered_for_innodb(thd, tab_part_info, alt_part_info); + /* Online handling: REORGANIZE PARTITION: |