From 65811a336dbde9d09b6ed0b470fa37bd488a7a74 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Sun, 5 Oct 2008 00:40:30 +0200 Subject: Bug#37453: Dropping/creating index on partitioned table with InnoDB Plugin locks table The fast/on-line add/drop index handler calls was not implemented whithin the partitioning. This implements it in the partitioning handler. Since this is only used by the not included InnoDB plugin, there is no test case. (Have tested it manually with the plugin, and it does not allow unique indexes not including partitioning function, or removal of pk, which in innodb generates a new pk, which is not in the partitioning function.) NOTE: This introduces a new handler method, and because of that changes the storage engine api. (One cannot use a handlerton to see the capabilities of a table's handler if it is partitioned. So I added a wrapper function in the handler that defaults to the handlerton function, which the partitioning handler overrides. sql/ha_partition.cc: Bug#37453: Dropping/creating index on partitioned table with InnoDB Plugin locks table Added support for fast/on-line add/drop index. Implemented alter_table_flags as bit-or of the partitioned hton and the first partitions alter_table_flags. It is only to forward the calls for the other functions: check_if_incompatible_data add_index prepare_drop_index final_drop_index to all parts handler sql/ha_partition.h: Bug#37453: Dropping/creating index on partitioned table with InnoDB Plugin locks table Added support for fast/on-line add/drop index. sql/handler.h: Bug#37453: Dropping/creating index on partitioned table with InnoDB Plugin locks table Added the function on handler level, defaulting to use the handlerton function, but a handler can override it. Needed for partitioned tables. NOTE: Change of storage engine api. sql/sql_partition.cc: Bug#37453: Dropping/creating index on partitioned table with InnoDB Plugin locks table Using the new handler function, instead of the handlerton function. This works better with the partitioning handler. sql/sql_table.cc: Bug#37453: Dropping/creating index on partitioned table with InnoDB Plugin locks table Using the new handler function, instead of the handlerton function. This works better with the partitioning handler. Also using new process info for 'manage keys' (kind of fix for bug-37550). --- sql/ha_partition.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'sql/ha_partition.h') diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 97f5624608f..4e4b746d611 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -210,6 +210,8 @@ public: DBUG_RETURN(0); } virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share); + virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info, + uint table_changes); private: int prepare_for_rename(); int copy_partitions(ulonglong *copied, ulonglong *deleted); @@ -762,6 +764,11 @@ public: return m_file[0]->index_flags(inx, part, all_parts); } + /** + wrapper function for handlerton alter_table_flags, since + the ha_partition_hton cannot know all its capabilities + */ + virtual uint alter_table_flags(uint flags); /* extensions of table handler files */ @@ -898,13 +905,14 @@ public: ------------------------------------------------------------------------- MODULE on-line ALTER TABLE ------------------------------------------------------------------------- - These methods are in the handler interface but never used (yet) - They are to be used by on-line alter table add/drop index: + These methods are in the handler interface. (used by innodb-plugin) + They are used for on-line/fast alter table add/drop index: ------------------------------------------------------------------------- - virtual ulong index_ddl_flags(KEY *wanted_index) const - virtual int add_index(TABLE *table_arg,KEY *key_info,uint num_of_keys); - virtual int drop_index(TABLE *table_arg,uint *key_num,uint num_of_keys); */ + virtual int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); + virtual int prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys); + virtual int final_drop_index(TABLE *table_arg); /* ------------------------------------------------------------------------- -- cgit v1.2.1