Commit a6ebed7c authored by mskold@mysql.com's avatar mskold@mysql.com

Added flag to detect renaming of fields (not supported as fast alter table for ndbcluster)

parent 95d61f64
...@@ -99,6 +99,7 @@ enum enum_server_command ...@@ -99,6 +99,7 @@ enum enum_server_command
#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */ #define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */ #define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */ #define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
#define REFRESH_GRANT 1 /* Refresh grant tables */ #define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */ #define REFRESH_LOG 2 /* Start on new log file */
......
...@@ -9833,8 +9833,8 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *info, ...@@ -9833,8 +9833,8 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *info,
for (i= 0; i < table->s->fields; i++) for (i= 0; i < table->s->fields; i++)
{ {
Field *field= table->field[i]; Field *field= table->field[i];
const NDBCOL *col= tab->getColumn(field->field_name); const NDBCOL *col= tab->getColumn(i);
if (!col) if (field->flags & FIELD_IS_RENAMED)
{ {
DBUG_PRINT("info", ("Field has been renamed, copy table")); DBUG_PRINT("info", ("Field has been renamed, copy table"));
DBUG_RETURN(COMPATIBLE_DATA_NO); DBUG_RETURN(COMPATIBLE_DATA_NO);
......
...@@ -4744,6 +4744,11 @@ static uint compare_tables(TABLE *table, List<create_field> *create_list, ...@@ -4744,6 +4744,11 @@ static uint compare_tables(TABLE *table, List<create_field> *create_list,
create_info->row_type != ROW_TYPE_FIXED) create_info->row_type != ROW_TYPE_FIXED)
create_info->table_options|= HA_OPTION_PACK_RECORD; create_info->table_options|= HA_OPTION_PACK_RECORD;
/* Check if field was renamed */
if (my_strcasecmp(system_charset_info,
field->field_name,
new_field->field_name))
field->flags|= FIELD_IS_RENAMED;
/* Evaluate changes bitmap and send to check_if_incompatible_data() */ /* Evaluate changes bitmap and send to check_if_incompatible_data() */
if (!(tmp= field->is_equal(new_field))) if (!(tmp= field->is_equal(new_field)))
DBUG_RETURN(ALTER_TABLE_DATA_CHANGED); DBUG_RETURN(ALTER_TABLE_DATA_CHANGED);
......
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