mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
f50c4207f2
partition is corrupt The main problem was that ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION took another code path (over mysql_alter_table instead of mysql_admin_table) which differs in two ways: 1) alter table opens the tables in a different way than admin tables do resulting in returning with error before it tried the command 2) alter table does not start to send any diagnostic rows to the client which the lower admin functions continue to use -> resulting in assertion crash The fix: Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION to use the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE t. Adding check in mysql_admin_table to setup the partition list for which partitions that should be used. Partitioned tables will still not work with REPAIR TABLE/PARTITION USE_FRM, since that requires moving partitions to tables, REPAIR TABLE t USE_FRM, and check that the data still fulfills the partitioning function and then move the table back to being a partition. NOTE: I have removed the following functions from the handler interface: analyze_partitions, check_partitions, optimize_partitions, repair_partitions Since they are not longer needed. THIS ALTERS THE STORAGE ENGINE API mysql-test/r/handler_innodb.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added a note result row. mysql-test/r/innodb.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added a note result row. mysql-test/r/innodb_mysql.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added a note result row. mysql-test/r/partition.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned tables. mysql-test/r/trigger-trans.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added a note result row. mysql-test/suite/ndb/r/ndb_partition_key.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned tables. mysql-test/suite/ndb/t/ndb_partition_key.test: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned tables. mysql-test/suite/parts/inc/partition_alter4.inc: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned tables. mysql-test/suite/parts/r/partition_alter4_innodb.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned tables. mysql-test/suite/parts/r/partition_alter4_myisam.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned tables. mysql-test/suite/rpl/r/rpl_failed_optimize.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added a note result row. mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added a note result row. mysql-test/t/partition.test: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned tables. sql/ha_partition.cc: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added a function for returning admin commands result rows Updated handle_opt_partitions to handle admin commands result rows, and some error filtering (as mysql_admin_table do). Removed the functions analyze/check/optimize/repair_partitions since they have no longer any use. sql/ha_partition.h: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Removed analyze/check/optimize/repair_partitions since they are no longer are needed. sql/handler.cc: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Removed analyze/check/optimize/repair_partitions since they are no longer are needed. sql/handler.h: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Removed analyze/check/optimize/repair_partitions since they are no longer are needed. sql/mysql_priv.h: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added set_part_state for reuse of code in mysql_admin_table. (Originally fond in sql/sql_partition.cc:prep_alter_part_table) sql/protocol.cc: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added one assert and a debug print. sql/sql_partition.cc: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Refactored code for setting up partition state, set_part_state, now used in both prep_alter_part_table and sql_table.cc:mysql_admin_table. Removed code for handling ANALYZE/CHECK/OPTIMIZE/REPAIR partitions, since it is now handled by mysql_admin_table. sql/sql_table.cc: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Added functionality in mysql_admin_table to work with partitioned tables. Fixed a possible assertion bug for HA_ADMIN_TRY_ALTER (If analyze would output a row, it fails since the row was already started). sql/sql_yacc.yy: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION to use the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE instead of taking the ALTER TABLE path. Added reset of alter_info for ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE since it is now used by partitioned tables. storage/myisam/mi_check.c: Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that partition is corrupt Changed warning message from "Found X parts Should be: Y parts" to "Found X key parts. Should be Y", since it could be confusing with partitioned tables.
120 lines
6.7 KiB
PHP
120 lines
6.7 KiB
PHP
################################################################################
|
|
# inc/partition_alter1.inc #
|
|
# #
|
|
# Purpose: #
|
|
# Execute ALTER ... OPTIMIZE/CHECK/REBUID/ANALYZE statements (maintenance) #
|
|
# #
|
|
#------------------------------------------------------------------------------#
|
|
# Original Author: HH #
|
|
# Original Date: 2006-07-27 #
|
|
# Change Author: #
|
|
# Change Date: #
|
|
# Change: #
|
|
################################################################################
|
|
|
|
--echo
|
|
--echo #========================================================================
|
|
--echo # 1.1.1.12 ALTER TABLE <maintenance> PARTITION
|
|
--echo #========================================================================
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 1 ALTER ... ANALYZE PARTITION
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 1.1 ALTER ... ANALYZE PARTITION part_1;
|
|
let $alter= ALTER TABLE t1 ANALYZE PARTITION part_1;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 1.2 ALTER ... ANALYZE PARTITION part_1,part_2;
|
|
let $alter= ALTER TABLE t1 ANALYZE PARTITION part_1,part_2;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 1.3 ALTER ... ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
|
|
let $alter= ALTER TABLE t1 ANALYZE PARTITION part_1,part_2,part_5,part_6,part_10;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 1.4 ALTER ... ANALYZE PARTITION part_1,part_1,part_1;
|
|
let $alter= ALTER TABLE t1 ANALYZE PARTITION part_1,part_1,part_1;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 1.5 ALTER ... ANALYZE PARTITION ALL;
|
|
let $alter= ALTER TABLE t1 ANALYZE PARTITION ALL;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 2 ALTER ... CHECK PARTITION
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 2.1 ALTER ... CHECK PARTITION part_1;
|
|
let $alter= ALTER TABLE t1 CHECK PARTITION part_1;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 2.2 ALTER ... CHECK PARTITION part_1,part_2;
|
|
let $alter= ALTER TABLE t1 CHECK PARTITION part_1,part_2;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 2.3 ALTER ... CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
|
|
let $alter= ALTER TABLE t1 CHECK PARTITION part_1,part_2,part_5,part_6,part_10;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 2.4 ALTER ... CHECK PARTITION part_1,part_1,part_1;
|
|
let $alter= ALTER TABLE t1 CHECK PARTITION part_1,part_1,part_1;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 2.5 ALTER ... CHECK PARTITION ALL;
|
|
let $alter= ALTER TABLE t1 CHECK PARTITION ALL;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 3 ALTER ... OPTIMIZE PARTITION
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 3.1 ALTER ... OPTIMIZE PARTITION part_1;
|
|
let $alter= ALTER TABLE t1 OPTIMIZE PARTITION part_1;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 3.2 ALTER ... OPTIMIZE PARTITION part_1,part_2;
|
|
let $alter= ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 3.3 ALTER ... OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
|
|
let $alter= ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2,part_5,part_6,part_10;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 3.4 ALTER ... OPTIMIZE PARTITION part_1,part_1,part_1;
|
|
let $alter= ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_1,part_1;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 3.5 ALTER ... OPTIMIZE PARTITION ALL;
|
|
let $alter= ALTER TABLE t1 OPTIMIZE PARTITION ALL;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 4 ALTER ... REBUILD PARTITION
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 4.1 ALTER ... REBUILD PARTITION part_1;
|
|
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 4.2 ALTER ... REBUILD PARTITION part_1,part_2;
|
|
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_2;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 4.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;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 4.4 ALTER ... REBUILD PARTITION part_1,part_1,part_1;
|
|
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
--echo # 4.5 ALTER ... REBUILD PARTITION ALL;
|
|
let $alter= ALTER TABLE t1 REBUILD PARTITION ALL;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 5 ALTER ... REPAIR PARTITION
|
|
--echo #------------------------------------------------------------------------
|
|
--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 ... 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 ... 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 ... 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 # 5.5 ALTER ... REPAIR PARTITION ALL;
|
|
let $alter= ALTER TABLE t1 REPAIR PARTITION ALL;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 6 ALTER ... REMOVE PARTITIONING
|
|
--echo #------------------------------------------------------------------------
|
|
--echo # 6.1 ALTER ... REMOVE PARTITIONING;
|
|
let $alter= ALTER TABLE t1 REMOVE PARTITIONING;
|
|
--source suite/parts/inc/partition_alter_41.inc
|
|
|