diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index e18f3ed5a92..20678ba21a4 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -398,23 +398,6 @@ static int poll_fun(void *extra, float progress) { return 0; } -struct hot_poll_fun_extra { - uint current_table; - uint num_tables; -}; - -static int hot_poll_fun(void *extra, float progress) { - HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra; - if (context->thd->killed) { - sprintf(context->write_status_msg, "The process has been killed, aborting hot optimize."); - return ER_ABORTING_CONNECTION; - } - sprintf(context->write_status_msg, "Optimization of index %u of %u about %.lf%% done", context->current_table + 1, context->num_tables, progress*100); - thd_proc_info(context->thd, context->write_status_msg); - return 0; -} - - static void loader_ai_err_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) { LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra; assert(context->ha); diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc index 167b1b1c484..484ff417ac6 100644 --- a/storage/tokudb/ha_tokudb_admin.cc +++ b/storage/tokudb/ha_tokudb_admin.cc @@ -44,6 +44,22 @@ int ha_tokudb::analyze(THD * thd, HA_CHECK_OPT * check_opt) { } #endif +struct hot_poll_fun_extra { + uint current_table; + uint num_tables; +}; + +static int hot_poll_fun(void *extra, float progress) { + HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra; + if (context->thd->killed) { + sprintf(context->write_status_msg, "The process has been killed, aborting hot optimize."); + return ER_ABORTING_CONNECTION; + } + sprintf(context->write_status_msg, "Optimization of index %u of %u about %.lf%% done", context->current_table + 1, context->num_tables, progress*100); + thd_proc_info(context->thd, context->write_status_msg); + return 0; +} + volatile int ha_tokudb_optimize_wait = 0; // debug // flatten all DB's in this table, to do so, just do a full scan on every DB diff --git a/storage/tokudb/ha_tokudb_alter_56.cc b/storage/tokudb/ha_tokudb_alter_56.cc index 80d19f3bfd0..f37836b0f60 100644 --- a/storage/tokudb/ha_tokudb_alter_56.cc +++ b/storage/tokudb/ha_tokudb_alter_56.cc @@ -1161,7 +1161,7 @@ cleanup: static bool column_rename_supported( - Alter_info* alter_info, + Alter_inplace_info *ha_alter_info, TABLE* orig_table, TABLE* new_table ) @@ -1174,12 +1174,10 @@ column_rename_supported( retval = false; goto cleanup; } -#if 0 // TODO - if (alter_info->contains_first_or_after) { + if (ha_alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_ORDER) { retval = false; goto cleanup; } -#endif for (uint i = 0; i < orig_table->s->fields; i++) { Field* orig_field = orig_table->field[i]; Field* new_field = new_table->field[i]; @@ -1311,7 +1309,7 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_ // now need to verify that one and only one column // has changed only its name. If we find anything to // the contrary, we don't allow it, also check indexes - bool cr_supported = column_rename_supported(ha_alter_info->alter_info, table, altered_table); + bool cr_supported = column_rename_supported(ha_alter_info, table, altered_table); if (cr_supported) result = HA_ALTER_INPLACE_NO_LOCK; } @@ -1332,7 +1330,8 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_ result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK;; } else // add column - if (ha_alter_info->handler_flags == Alter_inplace_info::ADD_COLUMN) { + if (ha_alter_info->handler_flags == Alter_inplace_info::ADD_COLUMN || + ha_alter_info->handler_flags == Alter_inplace_info::ADD_COLUMN + Alter_inplace_info::ALTER_COLUMN_ORDER) { u_int32_t added_columns[altered_table->s->fields]; u_int32_t num_added_columns = 0; int r = find_changed_columns(added_columns, &num_added_columns, table, altered_table); @@ -1348,7 +1347,8 @@ ha_tokudb::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_ } } else // drop column - if (ha_alter_info->handler_flags == Alter_inplace_info::DROP_COLUMN) { + if (ha_alter_info->handler_flags == Alter_inplace_info::DROP_COLUMN || + ha_alter_info->handler_flags == Alter_inplace_info::DROP_COLUMN + Alter_inplace_info::ALTER_COLUMN_ORDER) { u_int32_t dropped_columns[table->s->fields]; u_int32_t num_dropped_columns = 0; int r = find_changed_columns(dropped_columns, &num_dropped_columns, altered_table, table); @@ -1395,8 +1395,8 @@ ha_tokudb::inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alte ha_alter_info->handler_flags == Alter_inplace_info::DROP_UNIQUE_INDEX) { error = alter_table_drop_index(altered_table, ha_alter_info); } else - if (ha_alter_info->handler_flags == Alter_inplace_info::ADD_COLUMN || - ha_alter_info->handler_flags == Alter_inplace_info::DROP_COLUMN) { + if (ha_alter_info->handler_flags & Alter_inplace_info::ADD_COLUMN || + ha_alter_info->handler_flags & Alter_inplace_info::DROP_COLUMN) { error = alter_table_add_or_drop_column(altered_table, ha_alter_info); } diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc index ebec8ee5052..658eb5d8619 100644 --- a/storage/tokudb/hatoku_cmp.cc +++ b/storage/tokudb/hatoku_cmp.cc @@ -51,8 +51,8 @@ void get_var_field_info( } *start_offset = data_start_offset; + assert(data_end_offset >= data_start_offset); *field_len = data_end_offset - data_start_offset; - } void get_blob_field_info(