Skip to content

Commit 9d25580

Browse files
author
Dmitry Lenev
committed
Fix for bug#25487493 "TABLE DEFINITION MARKED AS HIDDEN IN HA_RENAME_TABLE".
There was a mismatch in "hidden" attribute between dd::Table object for new table version which is passed to handler::rename_table() method and stored in DD during last phases of ALTER TABLE COPY. This mismatch was caused by the fact that correct value of this attribute for the dd::Table object was set too late, after the call to handler::rename_table(), but before object was stored in DD. This patch fixes the problem by setting the "hidden" attribute value before handler::rename_table() is called. This bug was causing issues only in MySQL Cluster tree, so proper test coverage for it will be provided there.
1 parent 28c3531 commit 9d25580

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

sql/dd/dd_table.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,13 +2653,10 @@ bool rename_table(THD *thd,
26532653

26542654
bool rename_table(THD *thd, const char *from_table_name,
26552655
dd::Table *to_table_def,
2656-
bool mark_as_hidden, bool commit_dd_changes)
2656+
bool commit_dd_changes)
26572657
{
26582658
Disable_gtid_state_update_guard disabler(thd);
26592659

2660-
// Mark the hidden flag.
2661-
to_table_def->set_hidden(mark_as_hidden);
2662-
26632660
if (rename_foreign_keys(from_table_name, to_table_def))
26642661
return true;
26652662

sql/dd/dd_table.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ bool rename_table(THD *thd,
309309
@param thd The dictionary client.
310310
@param from_table_name The table name we are renaming from.
311311
@param to_table_def dd::Table for table after rename.
312-
@param mark_as_hidden Mark the new table as hidden, if true.
313312
@param commit_dd_changes Indicates whether change to the data
314313
dictionary needs to be committed.
315314
@@ -326,7 +325,7 @@ bool rename_table(THD *thd,
326325
*/
327326
bool rename_table(THD *thd, const char *from_table_name,
328327
dd::Table *to_table_def,
329-
bool mark_as_hidden, bool commit_dd_changes);
328+
bool commit_dd_changes);
330329

331330
/**
332331
Rename a view in the data-dictionary.

sql/sql_table.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7700,9 +7700,10 @@ mysql_rename_table(THD *thd, handlerton *base, const char *old_db,
77007700
old_name, &to_table_def))
77017701
DBUG_RETURN(true);
77027702

7703-
// Set schema id and table name.
7703+
// Set schema id, table name and hidden attribute.
77047704
to_table_def->set_schema_id(to_sch->id());
77057705
to_table_def->set_name(new_name);
7706+
to_table_def->set_hidden(flags & FN_TO_IS_TMP);
77067707

77077708
// Get the handler for the table, and issue an error if we cannot load it.
77087709
handler *file= (base == NULL ? 0 :
@@ -7784,8 +7785,7 @@ mysql_rename_table(THD *thd, handlerton *base, const char *old_db,
77847785
supporting atomic DDL. And for engines which can't do atomic DDL in
77857786
either case there are scenarios in which DD and SE get out of sync.
77867787
*/
7787-
if (dd::rename_table(thd, old_name, to_table_def, (flags & FN_TO_IS_TMP),
7788-
!(flags & NO_DD_COMMIT)))
7788+
if (dd::rename_table(thd, old_name, to_table_def, !(flags & NO_DD_COMMIT)))
77897789
{
77907790
/*
77917791
In cases when we are executing atomic DDL it is responsibility of the

0 commit comments

Comments
 (0)