Fixed issue with LOCK TABLE + ALTER TABLE ENABLE KEYS + SHOW commands.
sql/sql_table.cc: Remove version protection from share when repair has been done. Without this one can't run SHOW commands on the table if it was locked until it's unlocked. sql/table.h: Allow one to remove version protection with allow_access_to_protected_table()
This commit is contained in:
parent
9b993fda63
commit
e2a72fefb4
@ -6264,12 +6264,14 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
goto err;
|
goto err;
|
||||||
DEBUG_SYNC(thd,"alter_table_enable_indexes");
|
DEBUG_SYNC(thd,"alter_table_enable_indexes");
|
||||||
error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||||
|
table->s->allow_access_to_protected_table();
|
||||||
break;
|
break;
|
||||||
case DISABLE:
|
case DISABLE:
|
||||||
if (wait_while_table_is_used(thd, table, extra_func,
|
if (wait_while_table_is_used(thd, table, extra_func,
|
||||||
TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
|
TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
|
||||||
goto err;
|
goto err;
|
||||||
error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||||
|
table->s->allow_access_to_protected_table();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBUG_ASSERT(FALSE);
|
DBUG_ASSERT(FALSE);
|
||||||
@ -6812,6 +6814,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
error= trans_commit_stmt(thd);
|
error= trans_commit_stmt(thd);
|
||||||
if (trans_commit_implicit(thd))
|
if (trans_commit_implicit(thd))
|
||||||
error= 1;
|
error= 1;
|
||||||
|
table->s->allow_access_to_protected_table();
|
||||||
}
|
}
|
||||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
||||||
|
|
||||||
|
@ -806,6 +806,15 @@ struct TABLE_SHARE
|
|||||||
{
|
{
|
||||||
version= 0;
|
version= 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
This is used only for the case of locked tables, as we want to
|
||||||
|
allow one to do SHOW commands on them even after ALTER or REPAIR
|
||||||
|
*/
|
||||||
|
inline void allow_access_to_protected_table()
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(version == 0);
|
||||||
|
version= 1;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Remove from table definition cache at close.
|
Remove from table definition cache at close.
|
||||||
Table can still be opened by SHOW
|
Table can still be opened by SHOW
|
||||||
|
Loading…
x
Reference in New Issue
Block a user