Commit 6a154536 authored by unknown's avatar unknown

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


mysql-test/r/partition.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/inc/partition_alter4.inc:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  copy-paste error, changed from REBUILT to REPAIR, as the heading says
mysql-test/suite/parts/r/partition_alter1_innodb.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/r/partition_alter1_myisam.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/r/partition_alter2_innodb.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/r/partition_alter2_myisam.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/r/partition_basic_innodb.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/r/partition_basic_myisam.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/r/partition_engine_innodb.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/r/partition_engine_myisam.result:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Test result
mysql-test/suite/parts/t/disabled.def:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  Disabled test since the tested feature is not longer supported
mysql-test/t/partition.test:
  Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
  
  OPTIMIZE PARTITION is not longer supported, waiting for WL#4176
sql/ha_partition.cc:
  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
  (returning HA_ADMIN_NOT_IMPLEMENTED and
  #ifdef'ed the non-reachable code)
parent 324d5417
...@@ -342,7 +342,7 @@ PARTITION BY LIST (a) ...@@ -342,7 +342,7 @@ PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20)); (PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text 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; drop table t1;
create table t1 create table t1
(a int) (a int)
...@@ -1045,9 +1045,7 @@ SHOW TABLE STATUS; ...@@ -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 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 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; ALTER TABLE t1 OPTIMIZE PARTITION p0;
SHOW TABLE STATUS; ERROR 42000: The storage engine for the table doesn't support optimize partition
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
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a); CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
ALTER TABLE t1 DISABLE KEYS; ALTER TABLE t1 DISABLE KEYS;
......
...@@ -83,17 +83,17 @@ let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1; ...@@ -83,17 +83,17 @@ let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
--echo #------------------------------------------------------------------------ --echo #------------------------------------------------------------------------
--echo # 5 ALTER ... REPAIR PARTITION --echo # 5 ALTER ... REPAIR PARTITION
--echo #------------------------------------------------------------------------ --echo #------------------------------------------------------------------------
--echo # 5.1 ALTER ... REBUILD PARTITION part_1; --echo # 5.1 ALTER ... REPAIR PARTITION part_1;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1; let $alter= ALTER TABLE t1 REPAIR PARTITION part_1;
--source suite/parts/inc/partition_alter_41.inc --source suite/parts/inc/partition_alter_41.inc
--echo # 5.2 ALTER ... REBUILD PARTITION part_1,part_2; --echo # 5.2 ALTER ... REPAIR PARTITION part_1,part_2;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_2; let $alter= ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
--source suite/parts/inc/partition_alter_41.inc --source suite/parts/inc/partition_alter_41.inc
--echo # 5.3 ALTER ... 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 REBUILD 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 --source suite/parts/inc/partition_alter_41.inc
--echo # 5.4 ALTER ... 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 REBUILD 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 --source suite/parts/inc/partition_alter_41.inc
--echo #------------------------------------------------------------------------ --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 ...@@ -16,3 +16,5 @@ partition_sessions : needs system_3_init.inc
partition_engine_ndb : cannot create t1 partition_engine_ndb : cannot create t1
part_supported_sql_func_ndb : cannot create t1 part_supported_sql_func_ndb : cannot create t1
rpl_ndb_dd_partitions : 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) ...@@ -35,7 +35,7 @@ PARTITION `p5` VALUES LESS THAN (2010)
COMMENT 'APSTART \' APEND' 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 #--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; SELECT * FROM t1 LIMIT 1;
DROP TABLE t1; DROP TABLE t1;
...@@ -1208,9 +1208,11 @@ SHOW TABLE STATUS; ...@@ -1208,9 +1208,11 @@ SHOW TABLE STATUS;
DELETE from t1 where a = 1; DELETE from t1 where a = 1;
--replace_column 9 0 12 NULL 13 NULL 14 NULL --replace_column 9 0 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS; SHOW TABLE STATUS;
# restore this after WL#4176 is completed
-- error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 OPTIMIZE PARTITION p0; ALTER TABLE t1 OPTIMIZE PARTITION p0;
--replace_column 12 NULL 13 NULL 14 NULL #--replace_column 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS; #SHOW TABLE STATUS;
DROP TABLE t1; DROP TABLE t1;
# #
...@@ -1568,9 +1570,9 @@ PARTITION BY RANGE (a) ( ...@@ -1568,9 +1570,9 @@ PARTITION BY RANGE (a) (
PARTITION p1 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20) PARTITION p2 VALUES LESS THAN (20)
); );
--error 1064 --error ER_PARSE_ERROR
ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED; ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED;
--error 1064 --error ER_PARSE_ERROR
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED; ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -1035,6 +1035,13 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, ...@@ -1035,6 +1035,13 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
DBUG_ENTER("handle_opt_part"); DBUG_ENTER("handle_opt_part");
DBUG_PRINT("enter", ("flag = %u", flag)); 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) if (flag == OPTIMIZE_PARTS)
error= file->ha_optimize(thd, check_opt); error= file->ha_optimize(thd, check_opt);
else if (flag == ANALYZE_PARTS) else if (flag == ANALYZE_PARTS)
...@@ -1051,6 +1058,7 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, ...@@ -1051,6 +1058,7 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
if (error == HA_ADMIN_ALREADY_DONE) if (error == HA_ADMIN_ALREADY_DONE)
error= 0; error= 0;
DBUG_RETURN(error); DBUG_RETURN(error);
#endif
} }
...@@ -1080,6 +1088,12 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, ...@@ -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_ENTER("ha_partition::handle_opt_partitions");
DBUG_PRINT("enter", ("all_parts %u, flag= %u", all_parts, flag)); 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 do
{ {
partition_element *part_elem= part_it++; partition_element *part_elem= part_it++;
...@@ -1110,6 +1124,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, ...@@ -1110,6 +1124,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
} }
} while (++i < no_parts); } while (++i < no_parts);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
#endif
} }
/* /*
......
...@@ -6113,6 +6113,18 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ...@@ -6113,6 +6113,18 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
((alter_info->flags & ALTER_REPAIR_PARTITION) && ((alter_info->flags & ALTER_REPAIR_PARTITION) &&
(error= table->file->ha_repair_partitions(thd)))) (error= table->file->ha_repair_partitions(thd))))
{ {
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)); table->file->print_error(error, MYF(0));
goto err; 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