Loading mysql-test/r/partition_mgm_err.result +8 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,14 @@ ALTER TABLE t1 DROP PARTITION x1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 COALESCE PARTITION 1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 ANALYZE PARTITION p1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 CHECK PARTITION p1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 OPTIMIZE PARTITION p1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 REPAIR PARTITION p1; ERROR HY000: Partition management on a not partitioned table is not possible DROP TABLE t1; CREATE TABLE t1 (a int) PARTITION BY KEY (a) Loading mysql-test/t/partition_mgm_err.test +12 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,18 @@ ALTER TABLE t1 DROP PARTITION x1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 COALESCE PARTITION 1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 ANALYZE PARTITION p1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 CHECK PARTITION p1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 OPTIMIZE PARTITION p1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 REPAIR PARTITION p1; DROP TABLE t1; CREATE TABLE t1 (a int) Loading sql/ha_partition.cc +8 −20 Original line number Diff line number Diff line Loading @@ -877,10 +877,7 @@ int ha_partition::optimize(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::optimize"); DBUG_RETURN(handle_opt_partitions(thd, check_opt, OPTIMIZE_PARTS, thd->lex->alter_info.flags & ALTER_OPTIMIZE_PARTITION ? FALSE : TRUE)); DBUG_RETURN(handle_opt_partitions(thd, check_opt, OPTIMIZE_PARTS)); } Loading @@ -901,10 +898,7 @@ int ha_partition::analyze(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::analyze"); DBUG_RETURN(handle_opt_partitions(thd, check_opt, ANALYZE_PARTS, thd->lex->alter_info.flags & ALTER_ANALYZE_PARTITION ? FALSE : TRUE)); DBUG_RETURN(handle_opt_partitions(thd, check_opt, ANALYZE_PARTS)); } Loading @@ -925,10 +919,7 @@ int ha_partition::check(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::check"); DBUG_RETURN(handle_opt_partitions(thd, check_opt, CHECK_PARTS, thd->lex->alter_info.flags & ALTER_CHECK_PARTITION ? FALSE : TRUE)); DBUG_RETURN(handle_opt_partitions(thd, check_opt, CHECK_PARTS)); } Loading @@ -949,12 +940,10 @@ int ha_partition::repair(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::repair"); DBUG_RETURN(handle_opt_partitions(thd, check_opt, REPAIR_PARTS, thd->lex->alter_info.flags & ALTER_REPAIR_PARTITION ? FALSE : TRUE)); DBUG_RETURN(handle_opt_partitions(thd, check_opt, REPAIR_PARTS)); } /* Handle optimize/analyze/check/repair of one partition Loading Loading @@ -1057,7 +1046,6 @@ static bool print_admin_msg(THD* thd, const char* msg_type, thd Thread object check_opt Options flag Optimize/Analyze/Check/Repair flag all_parts All partitions or only a subset RETURN VALUE >0 Failure Loading @@ -1065,7 +1053,7 @@ static bool print_admin_msg(THD* thd, const char* msg_type, */ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flag, bool all_parts) uint flag) { List_iterator<partition_element> part_it(m_part_info->partitions); uint no_parts= m_part_info->no_parts; Loading @@ -1073,7 +1061,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint i= 0; int error; DBUG_ENTER("ha_partition::handle_opt_partitions"); DBUG_PRINT("enter", ("all_parts %u, flag= %u", all_parts, flag)); DBUG_PRINT("enter", ("flag= %u", flag)); do { Loading @@ -1082,7 +1070,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, when ALTER TABLE <CMD> PARTITION ... it should only do named partitions, otherwise all partitions */ if (all_parts || if (!(thd->lex->alter_info.flags & ALTER_ADMIN_PARTITION) || part_elem->part_state == PART_CHANGED) { if (m_is_sub_partitioned) Loading sql/ha_partition.h +1 −2 Original line number Diff line number Diff line Loading @@ -1003,8 +1003,7 @@ class ha_partition :public handler virtual bool is_crashed() const; private: int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags, bool all_parts); int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags); public: /* ------------------------------------------------------------------------- Loading sql/sql_lex.h +3 −6 Original line number Diff line number Diff line Loading @@ -843,15 +843,12 @@ inline bool st_select_lex_unit::is_union () #define ALTER_COALESCE_PARTITION (1L << 15) #define ALTER_REORGANIZE_PARTITION (1L << 16) #define ALTER_PARTITION (1L << 17) #define ALTER_OPTIMIZE_PARTITION (1L << 18) #define ALTER_ADMIN_PARTITION (1L << 18) #define ALTER_TABLE_REORG (1L << 19) #define ALTER_REBUILD_PARTITION (1L << 20) #define ALTER_ALL_PARTITION (1L << 21) #define ALTER_ANALYZE_PARTITION (1L << 22) #define ALTER_CHECK_PARTITION (1L << 23) #define ALTER_REPAIR_PARTITION (1L << 24) #define ALTER_REMOVE_PARTITIONING (1L << 25) #define ALTER_FOREIGN_KEY (1L << 26) #define ALTER_REMOVE_PARTITIONING (1L << 22) #define ALTER_FOREIGN_KEY (1L << 23) enum enum_alter_table_change_level { Loading Loading
mysql-test/r/partition_mgm_err.result +8 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,14 @@ ALTER TABLE t1 DROP PARTITION x1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 COALESCE PARTITION 1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 ANALYZE PARTITION p1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 CHECK PARTITION p1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 OPTIMIZE PARTITION p1; ERROR HY000: Partition management on a not partitioned table is not possible ALTER TABLE t1 REPAIR PARTITION p1; ERROR HY000: Partition management on a not partitioned table is not possible DROP TABLE t1; CREATE TABLE t1 (a int) PARTITION BY KEY (a) Loading
mysql-test/t/partition_mgm_err.test +12 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,18 @@ ALTER TABLE t1 DROP PARTITION x1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 COALESCE PARTITION 1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 ANALYZE PARTITION p1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 CHECK PARTITION p1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 OPTIMIZE PARTITION p1; --error ER_PARTITION_MGMT_ON_NONPARTITIONED ALTER TABLE t1 REPAIR PARTITION p1; DROP TABLE t1; CREATE TABLE t1 (a int) Loading
sql/ha_partition.cc +8 −20 Original line number Diff line number Diff line Loading @@ -877,10 +877,7 @@ int ha_partition::optimize(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::optimize"); DBUG_RETURN(handle_opt_partitions(thd, check_opt, OPTIMIZE_PARTS, thd->lex->alter_info.flags & ALTER_OPTIMIZE_PARTITION ? FALSE : TRUE)); DBUG_RETURN(handle_opt_partitions(thd, check_opt, OPTIMIZE_PARTS)); } Loading @@ -901,10 +898,7 @@ int ha_partition::analyze(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::analyze"); DBUG_RETURN(handle_opt_partitions(thd, check_opt, ANALYZE_PARTS, thd->lex->alter_info.flags & ALTER_ANALYZE_PARTITION ? FALSE : TRUE)); DBUG_RETURN(handle_opt_partitions(thd, check_opt, ANALYZE_PARTS)); } Loading @@ -925,10 +919,7 @@ int ha_partition::check(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::check"); DBUG_RETURN(handle_opt_partitions(thd, check_opt, CHECK_PARTS, thd->lex->alter_info.flags & ALTER_CHECK_PARTITION ? FALSE : TRUE)); DBUG_RETURN(handle_opt_partitions(thd, check_opt, CHECK_PARTS)); } Loading @@ -949,12 +940,10 @@ int ha_partition::repair(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::repair"); DBUG_RETURN(handle_opt_partitions(thd, check_opt, REPAIR_PARTS, thd->lex->alter_info.flags & ALTER_REPAIR_PARTITION ? FALSE : TRUE)); DBUG_RETURN(handle_opt_partitions(thd, check_opt, REPAIR_PARTS)); } /* Handle optimize/analyze/check/repair of one partition Loading Loading @@ -1057,7 +1046,6 @@ static bool print_admin_msg(THD* thd, const char* msg_type, thd Thread object check_opt Options flag Optimize/Analyze/Check/Repair flag all_parts All partitions or only a subset RETURN VALUE >0 Failure Loading @@ -1065,7 +1053,7 @@ static bool print_admin_msg(THD* thd, const char* msg_type, */ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flag, bool all_parts) uint flag) { List_iterator<partition_element> part_it(m_part_info->partitions); uint no_parts= m_part_info->no_parts; Loading @@ -1073,7 +1061,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint i= 0; int error; DBUG_ENTER("ha_partition::handle_opt_partitions"); DBUG_PRINT("enter", ("all_parts %u, flag= %u", all_parts, flag)); DBUG_PRINT("enter", ("flag= %u", flag)); do { Loading @@ -1082,7 +1070,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, when ALTER TABLE <CMD> PARTITION ... it should only do named partitions, otherwise all partitions */ if (all_parts || if (!(thd->lex->alter_info.flags & ALTER_ADMIN_PARTITION) || part_elem->part_state == PART_CHANGED) { if (m_is_sub_partitioned) Loading
sql/ha_partition.h +1 −2 Original line number Diff line number Diff line Loading @@ -1003,8 +1003,7 @@ class ha_partition :public handler virtual bool is_crashed() const; private: int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags, bool all_parts); int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags); public: /* ------------------------------------------------------------------------- Loading
sql/sql_lex.h +3 −6 Original line number Diff line number Diff line Loading @@ -843,15 +843,12 @@ inline bool st_select_lex_unit::is_union () #define ALTER_COALESCE_PARTITION (1L << 15) #define ALTER_REORGANIZE_PARTITION (1L << 16) #define ALTER_PARTITION (1L << 17) #define ALTER_OPTIMIZE_PARTITION (1L << 18) #define ALTER_ADMIN_PARTITION (1L << 18) #define ALTER_TABLE_REORG (1L << 19) #define ALTER_REBUILD_PARTITION (1L << 20) #define ALTER_ALL_PARTITION (1L << 21) #define ALTER_ANALYZE_PARTITION (1L << 22) #define ALTER_CHECK_PARTITION (1L << 23) #define ALTER_REPAIR_PARTITION (1L << 24) #define ALTER_REMOVE_PARTITIONING (1L << 25) #define ALTER_FOREIGN_KEY (1L << 26) #define ALTER_REMOVE_PARTITIONING (1L << 22) #define ALTER_FOREIGN_KEY (1L << 23) enum enum_alter_table_change_level { Loading