3396 Jon Olav Hauglid 2011-09-21
WL#5534 Online ALTER, Phase 1.
Patch #25:
- Moved key parts initialization to compare_tables().
- Removed unneeded TABLE_LIST parameter from
handler::inplace_alter_table().
modified:
sql/handler.cc
sql/handler.h
sql/sql_table.cc
3395 Jon Olav Hauglid 2011-09-16
WL#5534 Online ALTER, Phase 1.
Patch #24:
- Changed index_drop_buffer from uint* to KEY** to simplify
implementation.
- Removed a few unused parameters.
modified:
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.cc
sql/handler.h
sql/sql_table.cc
storage/innobase/handler/ha_innodb.h
storage/innobase/handler/handler0alter.cc
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-09-16 07:46:40 +0000
+++ b/sql/handler.cc 2011-09-21 08:17:09 +0000
@@ -3881,8 +3881,7 @@ handler::check_if_supported_inplace_alte
/*
Default implementation to support old online add/drop index
*/
-int handler::inplace_alter_table(TABLE_LIST *table_list,
- HA_CREATE_INFO *create_info,
+int handler::inplace_alter_table(HA_CREATE_INFO *create_info,
Alter_inplace_information *ha_alter_info,
HA_ALTER_FLAGS *alter_flags)
{
@@ -3902,8 +3901,6 @@ int handler::inplace_alter_table(TABLE_L
KEY *key;
uint *idx_p;
uint *idx_end_p;
- KEY_PART_INFO *key_part;
- KEY_PART_INFO *part_end;
key_info= (KEY*) ha_thd()->alloc(sizeof(KEY) * ha_alter_info->index_add_count);
key= key_info;
for (idx_p= ha_alter_info->index_add_buffer,
@@ -3913,10 +3910,6 @@ int handler::inplace_alter_table(TABLE_L
{
/* Copy the KEY struct. */
*key= ha_alter_info->key_info_buffer[*idx_p];
- /* Fix the key parts. */
- part_end= key->key_part + key->key_parts;
- for (key_part= key->key_part; key_part < part_end; key_part++)
- key_part->field= table->field[key_part->fieldnr];
}
/* Add the indexes. */
if ((error= add_index(table, key_info,
@@ -3943,8 +3936,8 @@ int handler::inplace_alter_table(TABLE_L
{
/* Committing index changes needs exclusive metadata lock. */
DBUG_ASSERT(ha_thd()->mdl_context.is_lock_owner(MDL_key::TABLE,
- table_list->db,
- table_list->table_name,
+ table->s->db.str,
+ table->s->table_name.str,
MDL_EXCLUSIVE));
if ((error= final_add_index(ha_alter_info->handler_ctx, true)))
{
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2011-09-16 07:46:40 +0000
+++ b/sql/handler.h 2011-09-21 08:17:09 +0000
@@ -2320,7 +2320,6 @@ public:
and Alter_inplace_information. The level of concurrency allowed during this
operation depends on the return value from check_if_supported_inplace_alter().
- @param table_list TABLE_LIST object for the altered table.
@param create_info Information from the parsing phase about new
table properties.
@param ha_alter_info Structure holding data used during in-place alter.
@@ -2329,8 +2328,7 @@ public:
@retval != 0 Error
@retval 0 Success
*/
- virtual int inplace_alter_table(TABLE_LIST *table_list,
- HA_CREATE_INFO *create_info,
+ virtual int inplace_alter_table(HA_CREATE_INFO *create_info,
Alter_inplace_information *ha_alter_info,
HA_ALTER_FLAGS *alter_flags);
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-09-16 07:46:40 +0000
+++ b/sql/sql_table.cc 2011-09-21 08:17:09 +0000
@@ -5562,6 +5562,8 @@ compare_tables(THD *thd,
is_not_null=
(is_not_null && (new_field->flags & NOT_NULL_FLAG));
}
+ /* Fix the key parts. */
+ key_part->field= table->field[key_part->fieldnr];
}
if (new_key->flags & HA_NOSAME)
{
@@ -6120,7 +6122,6 @@ static bool create_altered_table(THD *th
the table.
*/
static bool mysql_inplace_alter_table(THD *thd,
- TABLE_LIST *table_list,
TABLE *table,
char *new_alias,
char *tmp_name,
@@ -6170,8 +6171,7 @@ static bool mysql_inplace_alter_table(TH
goto err;
}
- if ((error= table->file->inplace_alter_table(table_list,
- create_info,
+ if ((error= table->file->inplace_alter_table(create_info,
ha_alter_info,
ha_alter_flags)))
{
@@ -7325,7 +7325,6 @@ bool mysql_alter_table(THD *thd,char *ne
}
if (mysql_inplace_alter_table(thd,
- table_list,
table,
new_alias,
tmp_name,
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl5534 branch (jon.hauglid:3395 to 3396) WL#5534 | Jon Olav Hauglid | 22 Sep |