Commit 878f8315 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Simplified dd_recreate_table()

It is used only with persistent tables, so remove path argument, which
was introduced in 9594107f and became useless after ce6a63ec.

Part of MDEV-17805 - Remove InnoDB cache for temporary tables.
parent 1dac55cf
......@@ -181,39 +181,24 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
@param thd Thread context.
@param db Name of the database to which the table belongs to.
@param name Table name.
@param path For temporary tables only - path to table files.
Otherwise NULL (the path is calculated from db and table names).
@retval FALSE Success.
@retval TRUE Error.
*/
bool dd_recreate_table(THD *thd, const char *db, const char *table_name,
const char *path)
bool dd_recreate_table(THD *thd, const char *db, const char *table_name)
{
bool error= TRUE;
HA_CREATE_INFO create_info;
char path_buf[FN_REFLEN + 1];
DBUG_ENTER("dd_recreate_table");
create_info.init();
if (path)
create_info.options|= HA_LEX_CREATE_TMP_TABLE;
else
{
build_table_filename(path_buf, sizeof(path_buf) - 1,
db, table_name, "", 0);
path= path_buf;
/* There should be a exclusive metadata lock on the table. */
DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name,
MDL_EXCLUSIVE));
}
create_info.init();
build_table_filename(path_buf, sizeof(path_buf) - 1,
db, table_name, "", 0);
/* Attempt to reconstruct the table. */
error= ha_create_table(thd, path, db, table_name, &create_info, NULL);
DBUG_RETURN(error);
DBUG_RETURN(ha_create_table(thd, path_buf, db, table_name, &create_info, 0));
}
......@@ -47,7 +47,6 @@ static inline bool dd_frm_is_view(THD *thd, char *path)
return dd_frm_type(thd, path, NULL, &not_used2) == TABLE_TYPE_VIEW;
}
bool dd_recreate_table(THD *thd, const char *db, const char *table_name,
const char *path = NULL);
bool dd_recreate_table(THD *thd, const char *db, const char *table_name);
#endif // DATADICT_INCLUDED
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