mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Fix for bug#16532 mysql server assert in debug if table definition is removed
Emit an error instead of doing ASSERT mysql-test/r/create_not_windows.result: update result mysql-test/t/create_not_windows.test: Add test case for bug #16532: mysql server assert in debug if table definition is removed sql/sql_table.cc: it could happen that an user deletes the frm file on OS level. In addition if the table was already opened, the file system level check for existance of table.frm will pass but get_cached_table_share() will return non-NULL value. In this case we will emit the standard error that the table exist. The error case is quite obscure but error message is better than a sigabort.
This commit is contained in:
@@ -3321,7 +3321,19 @@ bool mysql_create_table_internal(THD *thd,
|
||||
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
|
||||
goto unlock_and_end;
|
||||
}
|
||||
DBUG_ASSERT(get_cached_table_share(db, alias) == 0);
|
||||
/*
|
||||
We don't assert here, but check the result, because the table could be
|
||||
in the table definition cache and in the same time the .frm could be
|
||||
missing from the disk, in case of manual intervention which deletes
|
||||
the .frm file. The user has to use FLUSH TABLES; to clear the cache.
|
||||
Then she could create the table. This case is pretty obscure and
|
||||
therefore we don't introduce a new error message only for it.
|
||||
*/
|
||||
if (get_cached_table_share(db, alias))
|
||||
{
|
||||
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
|
||||
goto unlock_and_end;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user