Commit 52dae7b3 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

refs #4363 hcr rename blob, text, enum, and time types

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@48714 c7de825b-a66e-492c-adef-691d508d4ae1
parent ab1e95f1
...@@ -147,6 +147,13 @@ fix_handler_flags(TABLE *table, TABLE *altered_table, Alter_inplace_info *ha_alt ...@@ -147,6 +147,13 @@ fix_handler_flags(TABLE *table, TABLE *altered_table, Alter_inplace_info *ha_alt
handler_flags &= ~Alter_inplace_info::TOKU_ALTER_RENAME; handler_flags &= ~Alter_inplace_info::TOKU_ALTER_RENAME;
} }
// ALTER_COLUMN_TYPE may be set when no columns have been changed, so turn off the flag
if (handler_flags & Alter_inplace_info::ALTER_COLUMN_TYPE) {
if (all_fields_are_same_type(table, altered_table)) {
handler_flags &= ~Alter_inplace_info::ALTER_COLUMN_TYPE;
}
}
return handler_flags; return handler_flags;
} }
...@@ -219,7 +226,8 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_ ...@@ -219,7 +226,8 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_
result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK; result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK;
} else } else
// column rename // column rename
if (only_flags(ctx->handler_flags, Alter_inplace_info::ALTER_COLUMN_NAME + Alter_inplace_info::ALTER_COLUMN_DEFAULT)) { if (ctx->handler_flags & Alter_inplace_info::ALTER_COLUMN_NAME &&
only_flags(ctx->handler_flags, Alter_inplace_info::ALTER_COLUMN_NAME + Alter_inplace_info::ALTER_COLUMN_DEFAULT)) {
// we have identified a possible column rename, // we have identified a possible column rename,
// but let's do some more checks // but let's do some more checks
...@@ -234,7 +242,8 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_ ...@@ -234,7 +242,8 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_
result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK; result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK;
} else } else
// add column // add column
if (only_flags(ctx->handler_flags, Alter_inplace_info::ADD_COLUMN + Alter_inplace_info::ALTER_COLUMN_ORDER)) { if (ctx->handler_flags & Alter_inplace_info::ADD_COLUMN &&
only_flags(ctx->handler_flags, Alter_inplace_info::ADD_COLUMN + Alter_inplace_info::ALTER_COLUMN_ORDER)) {
uint32_t added_columns[altered_table->s->fields]; uint32_t added_columns[altered_table->s->fields];
uint32_t num_added_columns = 0; uint32_t num_added_columns = 0;
int r = find_changed_columns(added_columns, &num_added_columns, table, altered_table); int r = find_changed_columns(added_columns, &num_added_columns, table, altered_table);
...@@ -250,7 +259,8 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_ ...@@ -250,7 +259,8 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_
} }
} else } else
// drop column // drop column
if (only_flags(ctx->handler_flags, Alter_inplace_info::DROP_COLUMN + Alter_inplace_info::ALTER_COLUMN_ORDER)) { if (ctx->handler_flags & Alter_inplace_info::DROP_COLUMN &&
only_flags(ctx->handler_flags, Alter_inplace_info::DROP_COLUMN + Alter_inplace_info::ALTER_COLUMN_ORDER)) {
uint32_t dropped_columns[table->s->fields]; uint32_t dropped_columns[table->s->fields];
uint32_t num_dropped_columns = 0; uint32_t num_dropped_columns = 0;
int r = find_changed_columns(dropped_columns, &num_dropped_columns, altered_table, table); int r = find_changed_columns(dropped_columns, &num_dropped_columns, altered_table, table);
......
...@@ -565,6 +565,19 @@ ha_tokudb::fill_row_mutator( ...@@ -565,6 +565,19 @@ ha_tokudb::fill_row_mutator(
return pos-buf; return pos-buf;
} }
static bool
all_fields_are_same_type(TABLE *table_a, TABLE *table_b) {
if (table_a->s->fields != table_b->s->fields)
return false;
for (uint i = 0; i < table_a->s->fields; i++) {
Field *field_a = table_a->field[i];
Field *field_b = table_b->field[i];
if (!fields_are_same_type(field_a, field_b))
return false;
}
return true;
}
static bool static bool
column_rename_supported( column_rename_supported(
TABLE* orig_table, TABLE* orig_table,
...@@ -584,13 +597,13 @@ column_rename_supported( ...@@ -584,13 +597,13 @@ column_rename_supported(
retval = false; retval = false;
goto cleanup; goto cleanup;
} }
for (uint i = 0; i < orig_table->s->fields; i++) { if (!all_fields_are_same_type(orig_table, new_table)) {
Field* orig_field = orig_table->field[i];
Field* new_field = new_table->field[i];
if (!fields_are_same_type(orig_field, new_field)) {
retval = false; retval = false;
goto cleanup; goto cleanup;
} }
for (uint i = 0; i < orig_table->s->fields; i++) {
Field* orig_field = orig_table->field[i];
Field* new_field = new_table->field[i];
if (!fields_have_same_name(orig_field, new_field)) { if (!fields_have_same_name(orig_field, new_field)) {
num_fields_with_different_names++; num_fields_with_different_names++;
field_with_different_name = i; field_with_different_name = i;
......
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