mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-27753 Incorrect ENGINE type of table after crash for CONNECT table
whenever possible, partitioning should use the full partition plugin name, not the one byte legacy code. Normally, ha_partition can get the engine plugin from table_share->default_part_plugin. But in some cases, e.g. in DROP TABLE, the table isn't opened, table_share is NULL, and ha_partition has to parse the frm, much like dd_frm_type() does. temporary_tables.cc, sql_table.cc: When dropping a table, it must be deleted in the engine first, then frm file. Because frm can be the only true source of metadata that the engine might need for DROP. table.cc: when opening a partitioned table, if the engine for partitions is not found, do not fallback to MyISAM.
This commit is contained in:
@ -2802,15 +2802,13 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
|
||||
const LEX_CSTRING *table_name, uint flags, const char *table_path)
|
||||
{
|
||||
char path[FN_REFLEN + 1];
|
||||
const size_t pathmax = sizeof(path) - 1 - reg_ext_length;
|
||||
int error= 0;
|
||||
DBUG_ENTER("quick_rm_table");
|
||||
|
||||
size_t path_length= table_path ?
|
||||
(strxnmov(path, sizeof(path) - 1, table_path, reg_ext, NullS) - path) :
|
||||
build_table_filename(path, sizeof(path)-1, db->str, table_name->str, reg_ext, flags);
|
||||
if (mysql_file_delete(key_file_frm, path, MYF(0)))
|
||||
error= 1; /* purecov: inspected */
|
||||
path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
|
||||
(strxnmov(path, pathmax, table_path, NullS) - path) :
|
||||
build_table_filename(path, pathmax, db->str, table_name->str, "", flags);
|
||||
if (flags & NO_HA_TABLE)
|
||||
{
|
||||
handler *file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base);
|
||||
@ -2822,6 +2820,10 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
|
||||
if (!(flags & (FRM_ONLY|NO_HA_TABLE)))
|
||||
error|= ha_delete_table(current_thd, base, path, db, table_name, 0);
|
||||
|
||||
memcpy(path + path_length, reg_ext, reg_ext_length + 1);
|
||||
if (mysql_file_delete(key_file_frm, path, MYF(0)))
|
||||
error= 1;
|
||||
|
||||
if (likely(error == 0))
|
||||
{
|
||||
PSI_CALL_drop_table_share(flags & FN_IS_TMP, db->str, (uint)db->length,
|
||||
|
Reference in New Issue
Block a user