From 4e89fdb9d8e88607c0992bc2d049010344c0cb3b Mon Sep 17 00:00:00 2001 From: Stephen Long Date: Sat, 17 Aug 2019 12:59:16 -0400 Subject: MDEV-19837 and MDEV-19816: Change some comments --- sql/item.h | 2 +- sql/sql_insert.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/item.h b/sql/item.h index 6dc99970914..26bf8b91053 100644 --- a/sql/item.h +++ b/sql/item.h @@ -606,7 +606,7 @@ public: /* Cache of the result of is_expensive(). */ int8 is_expensive_cache; - /* Reuse size, only used by SP local variable assignment, otherwize 0 */ + /* Reuse size, only used by SP local variable assignment, otherwise 0 */ uint rsize; /* diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index ddf9bd155a9..075e37042f4 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1881,7 +1881,7 @@ before_trg_err: /****************************************************************************** - Check that all fields with arn't null_fields are used + Check that there aren't any null_fields ******************************************************************************/ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry, -- cgit v1.2.1 From 031c695b8c865e5eb6c4c09ced404ae08f98430f Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 9 Sep 2019 15:39:12 +0400 Subject: MDEV-16594 ALTER DATA DIRECTORY in PARTITIONS of InnoDB storage does nothing silently InnoDB intentionally (it's a documented behavior) ignores changing of DATA DIRECTORY and INDEX DIRECTORY for partitions. Though we should issue warning when this happens. --- sql/share/errmsg-utf8.txt | 2 ++ sql/sql_partition.cc | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) (limited to 'sql') diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 43d63fd705a..c5e83062f0f 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7142,3 +7142,5 @@ 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" diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 6ca181cdbb0..c214c2a13ee 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4660,6 +4660,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 it(alt_part_info->partitions); + partition_element *part_elem= it++;) + { + if (alt_part_info->is_sub_partitioned()) + { + for (List_iterator_fast 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 @@ -5389,6 +5452,8 @@ state of p1. { goto err; } + check_datadir_altered_for_innodb(thd, tab_part_info, alt_part_info); + /* Online handling: REORGANIZE PARTITION: -- cgit v1.2.1