Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION

Problem was that it did not work with corrupted/crashed tables.

Solution is to disable these commands until WL#4176 is completed
parent f2040f48
......@@ -342,7 +342,7 @@ PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t1 analyze note The storage engine for the table doesn't support analyze
drop table t1;
create table t1
(a int)
......@@ -1045,9 +1045,7 @@ SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 14 14 0 0 7 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
ALTER TABLE t1 OPTIMIZE PARTITION p0;
SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 7 7 0 1024 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
ERROR 42000: The storage engine for the table doesn't support optimize partition
DROP TABLE t1;
CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
ALTER TABLE t1 DISABLE KEYS;
......
......@@ -83,17 +83,17 @@ let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
--echo #------------------------------------------------------------------------
--echo # 5 ALTER ... REPAIR PARTITION
--echo #------------------------------------------------------------------------
--echo # 5.1 ALTER ... REBUILD PARTITION part_1;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1;
--echo # 5.1 ALTER ... REPAIR PARTITION part_1;
let $alter= ALTER TABLE t1 REPAIR PARTITION part_1;
--source suite/parts/inc/partition_alter_41.inc
--echo # 5.2 ALTER ... REBUILD PARTITION part_1,part_2;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_2;
--echo # 5.2 ALTER ... REPAIR PARTITION part_1,part_2;
let $alter= ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
--source suite/parts/inc/partition_alter_41.inc
--echo # 5.3 ALTER ... REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10;
--echo # 5.3 ALTER ... REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
let $alter= ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
--source suite/parts/inc/partition_alter_41.inc
--echo # 5.4 ALTER ... REBUILD PARTITION part_1,part_1,part_1;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
--echo # 5.4 ALTER ... REPAIR PARTITION part_1,part_1,part_1;
let $alter= ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
--source suite/parts/inc/partition_alter_41.inc
--echo #------------------------------------------------------------------------
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -16,3 +16,5 @@ partition_sessions : needs system_3_init.inc
partition_engine_ndb : cannot create t1
part_supported_sql_func_ndb : cannot create t1
rpl_ndb_dd_partitions : cannot create t1
partition_alter4_myisam : Bug#20129 / WL#4176
partition_alter4_innodb : Bug#20129 / WL#4176
......@@ -35,7 +35,7 @@ PARTITION `p5` VALUES LESS THAN (2010)
COMMENT 'APSTART \' APEND'
);
#--exec sed 's/APSTART \\/APSTART /' var/master-data/test/t1.frm > tmpt1.frm && mv tmpt1.frm var/master-data/test/t1.frm
#--error 1064
#--error ER_PARSE_ERROR
SELECT * FROM t1 LIMIT 1;
DROP TABLE t1;
......@@ -1208,9 +1208,11 @@ SHOW TABLE STATUS;
DELETE from t1 where a = 1;
--replace_column 9 0 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS;
# restore this after WL#4176 is completed
-- error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 OPTIMIZE PARTITION p0;
--replace_column 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS;
#--replace_column 12 NULL 13 NULL 14 NULL
#SHOW TABLE STATUS;
DROP TABLE t1;
#
......@@ -1568,9 +1570,9 @@ PARTITION BY RANGE (a) (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20)
);
--error 1064
--error ER_PARSE_ERROR
ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED;
--error 1064
--error ER_PARSE_ERROR
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
DROP TABLE t1;
......
......@@ -1035,6 +1035,13 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
DBUG_ENTER("handle_opt_part");
DBUG_PRINT("enter", ("flag = %u", flag));
/*
TODO:
Rewrite the code for ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION WL4176
*/
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
#ifdef WL4176_IS_DONE
if (flag == OPTIMIZE_PARTS)
error= file->ha_optimize(thd, check_opt);
else if (flag == ANALYZE_PARTS)
......@@ -1051,6 +1058,7 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
if (error == HA_ADMIN_ALREADY_DONE)
error= 0;
DBUG_RETURN(error);
#endif
}
......@@ -1080,6 +1088,12 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
DBUG_ENTER("ha_partition::handle_opt_partitions");
DBUG_PRINT("enter", ("all_parts %u, flag= %u", all_parts, flag));
/*
TODO:
Rewrite the code for ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION WL4176
*/
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
#ifdef WL4176_IS_DONE
do
{
partition_element *part_elem= part_it++;
......@@ -1110,6 +1124,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
}
} while (++i < no_parts);
DBUG_RETURN(FALSE);
#endif
}
/*
......
......@@ -6113,7 +6113,19 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
((alter_info->flags & ALTER_REPAIR_PARTITION) &&
(error= table->file->ha_repair_partitions(thd))))
{
table->file->print_error(error, MYF(0));
if (error == HA_ADMIN_NOT_IMPLEMENTED) {
if (alter_info->flags & ALTER_OPTIMIZE_PARTITION)
my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "optimize partition");
else if (alter_info->flags & ALTER_ANALYZE_PARTITION)
my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "analyze partition");
else if (alter_info->flags & ALTER_CHECK_PARTITION)
my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "check partition");
else if (alter_info->flags & ALTER_REPAIR_PARTITION)
my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "repair partition");
else
table->file->print_error(error, MYF(0));
} else
table->file->print_error(error, MYF(0));
goto err;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment