MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys

lowercase db and table names before prelocking.

Post-fix for 9180e8666b8

This fixes failures on main.lowercase_table4 on Windows
This commit is contained in:
Sergei Golubchik 2018-09-05 19:47:37 +02:00
parent 4cf75706b3
commit 0ccba62db3
2 changed files with 12 additions and 1 deletions

View File

@ -24577,7 +24577,7 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str,
const char *t_alias= alias;
str->append(' ');
if (lower_case_table_names== 1)
if (lower_case_table_names == 1)
{
if (alias && alias[0])
{

View File

@ -9095,6 +9095,17 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
new_table->file->get_foreign_key_list(thd, &fk_list);
while ((fk= fk_list_it++))
{
if (lower_case_table_names)
{
char buf[NAME_LEN];
uint len;
strmake_buf(buf, fk->referenced_db->str);
len = my_casedn_str(files_charset_info, buf);
thd->make_lex_string(fk->referenced_db, buf, len);
strmake_buf(buf, fk->referenced_table->str);
len = my_casedn_str(files_charset_info, buf);
thd->make_lex_string(fk->referenced_table, buf, len);
}
if (table_already_fk_prelocked(table_list, fk->referenced_db,
fk->referenced_table, TL_READ_NO_INSERT))
continue;