Commit 8bcf6c53 authored by Rich Prohaska's avatar Rich Prohaska

add a session variable that controls whether or not alter table errors are printed to stderr

parent 2b6da0f2
...@@ -216,7 +216,7 @@ static bool change_length_is_supported(TABLE *table, TABLE *altered_table, Alter ...@@ -216,7 +216,7 @@ static bool change_length_is_supported(TABLE *table, TABLE *altered_table, Alter
static bool change_type_is_supported(TABLE *table, TABLE *altered_table, Alter_inplace_info *ha_alter_info, tokudb_alter_ctx *ctx); static bool change_type_is_supported(TABLE *table, TABLE *altered_table, Alter_inplace_info *ha_alter_info, tokudb_alter_ctx *ctx);
// The ha_alter_info->handler_flags can not be trusted. This function maps the bogus handler flags to something we like. // The ha_alter_info->handler_flags can not be trusted. This function maps the bogus handler flags to something we like.
static ulong fix_handler_flags(TABLE *table, TABLE *altered_table, Alter_inplace_info *ha_alter_info) { static ulong fix_handler_flags(THD *thd, TABLE *table, TABLE *altered_table, Alter_inplace_info *ha_alter_info) {
ulong handler_flags = ha_alter_info->handler_flags; ulong handler_flags = ha_alter_info->handler_flags;
// workaround for fill_alter_inplace_info bug (#5193) // workaround for fill_alter_inplace_info bug (#5193)
...@@ -225,7 +225,7 @@ static ulong fix_handler_flags(TABLE *table, TABLE *altered_table, Alter_inplace ...@@ -225,7 +225,7 @@ static ulong fix_handler_flags(TABLE *table, TABLE *altered_table, Alter_inplace
// column addition later. // column addition later.
if (handler_flags & (Alter_inplace_info::ADD_COLUMN + Alter_inplace_info::DROP_COLUMN)) { if (handler_flags & (Alter_inplace_info::ADD_COLUMN + Alter_inplace_info::DROP_COLUMN)) {
if (handler_flags & (Alter_inplace_info::ADD_INDEX + Alter_inplace_info::DROP_INDEX)) { if (handler_flags & (Alter_inplace_info::ADD_INDEX + Alter_inplace_info::DROP_INDEX)) {
if (tables_have_same_keys(table, altered_table, false, false)) { if (tables_have_same_keys(table, altered_table, THDVAR(thd, alter_print_error) != 0, false)) {
handler_flags &= ~(Alter_inplace_info::ADD_INDEX + Alter_inplace_info::DROP_INDEX); handler_flags &= ~(Alter_inplace_info::ADD_INDEX + Alter_inplace_info::DROP_INDEX);
} }
} }
...@@ -294,7 +294,7 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt ...@@ -294,7 +294,7 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt
// setup context // setup context
tokudb_alter_ctx *ctx = new tokudb_alter_ctx; tokudb_alter_ctx *ctx = new tokudb_alter_ctx;
ha_alter_info->handler_ctx = ctx; ha_alter_info->handler_ctx = ctx;
ctx->handler_flags = fix_handler_flags(table, altered_table, ha_alter_info); ctx->handler_flags = fix_handler_flags(thd, table, altered_table, ha_alter_info);
ctx->table_kc_info = &share->kc_info; ctx->table_kc_info = &share->kc_info;
ctx->altered_table_kc_info = &ctx->altered_table_kc_info_base; ctx->altered_table_kc_info = &ctx->altered_table_kc_info_base;
memset(ctx->altered_table_kc_info, 0, sizeof (KEY_AND_COL_INFO)); memset(ctx->altered_table_kc_info, 0, sizeof (KEY_AND_COL_INFO));
...@@ -306,7 +306,7 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt ...@@ -306,7 +306,7 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt
if (only_flags(ctx->handler_flags, Alter_inplace_info::DROP_INDEX + Alter_inplace_info::DROP_UNIQUE_INDEX + if (only_flags(ctx->handler_flags, Alter_inplace_info::DROP_INDEX + Alter_inplace_info::DROP_UNIQUE_INDEX +
Alter_inplace_info::ADD_INDEX + Alter_inplace_info::ADD_UNIQUE_INDEX)) { Alter_inplace_info::ADD_INDEX + Alter_inplace_info::ADD_UNIQUE_INDEX)) {
if ((ha_alter_info->index_add_count > 0 || ha_alter_info->index_drop_count > 0) && if ((ha_alter_info->index_add_count > 0 || ha_alter_info->index_drop_count > 0) &&
!tables_have_same_keys(table, altered_table, false, false) && !tables_have_same_keys(table, altered_table, THDVAR(thd, alter_print_error) != 0, false) &&
is_disjoint_add_drop(ha_alter_info)) { is_disjoint_add_drop(ha_alter_info)) {
if (ctx->handler_flags & (Alter_inplace_info::DROP_INDEX + Alter_inplace_info::DROP_UNIQUE_INDEX)) { if (ctx->handler_flags & (Alter_inplace_info::DROP_INDEX + Alter_inplace_info::DROP_UNIQUE_INDEX)) {
...@@ -413,14 +413,14 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt ...@@ -413,14 +413,14 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt
// alter auto_increment // alter auto_increment
if (only_flags(create_info->used_fields, HA_CREATE_USED_AUTO)) { if (only_flags(create_info->used_fields, HA_CREATE_USED_AUTO)) {
// do a sanity check that the table is what we think it is // do a sanity check that the table is what we think it is
if (tables_have_same_keys_and_columns(table, altered_table, true)) { if (tables_have_same_keys_and_columns(table, altered_table, THDVAR(thd, alter_print_error) != 0)) {
result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK; result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK;
} }
} }
// alter row_format // alter row_format
else if (only_flags(create_info->used_fields, HA_CREATE_USED_ROW_FORMAT)) { else if (only_flags(create_info->used_fields, HA_CREATE_USED_ROW_FORMAT)) {
// do a sanity check that the table is what we think it is // do a sanity check that the table is what we think it is
if (tables_have_same_keys_and_columns(table, altered_table, true)) { if (tables_have_same_keys_and_columns(table, altered_table, THDVAR(thd, alter_print_error) != 0)) {
result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK; result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK;
} }
} }
......
...@@ -181,6 +181,14 @@ static bool get_create_index_online(THD* thd) { ...@@ -181,6 +181,14 @@ static bool get_create_index_online(THD* thd) {
return (THDVAR(thd, create_index_online) != 0); return (THDVAR(thd, create_index_online) != 0);
} }
static MYSQL_THDVAR_BOOL(alter_print_error,
0,
"Print errors for alter table operations",
NULL,
NULL,
false
);
static MYSQL_THDVAR_BOOL(disable_prefetching, static MYSQL_THDVAR_BOOL(disable_prefetching,
0, 0,
"if on, prefetching disabled", "if on, prefetching disabled",
......
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