mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
don't compare table names to detect temporary tables
(also fixes a bug with unaccounted table names like #sql-123, see drop and alter_table tests)
This commit is contained in:
@ -2265,12 +2265,6 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
|
|||||||
}
|
}
|
||||||
delete file;
|
delete file;
|
||||||
|
|
||||||
if (likely(error == 0))
|
|
||||||
{
|
|
||||||
PSI_CALL_drop_table_share(is_prefix(alias, tmp_file_prefix),
|
|
||||||
db, strlen(db), alias, strlen(alias));
|
|
||||||
}
|
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2353,8 +2347,7 @@ void handler::rebind_psi()
|
|||||||
Notify the instrumentation that this table is now owned
|
Notify the instrumentation that this table is now owned
|
||||||
by this thread.
|
by this thread.
|
||||||
*/
|
*/
|
||||||
PSI_table_share *share_psi= ha_table_share_psi();
|
m_psi= PSI_CALL_rebind_table(ha_table_share_psi(), this, m_psi);
|
||||||
m_psi= PSI_CALL_rebind_table(share_psi, this, m_psi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4316,10 +4309,11 @@ int ha_create_table(THD *thd, const char *path,
|
|||||||
char name_buff[FN_REFLEN];
|
char name_buff[FN_REFLEN];
|
||||||
const char *name;
|
const char *name;
|
||||||
TABLE_SHARE share;
|
TABLE_SHARE share;
|
||||||
bool temp_table __attribute__((unused)) = create_info->tmp_table() ||
|
bool temp_table __attribute__((unused)) =
|
||||||
is_prefix(table_name, tmp_file_prefix);
|
create_info->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER);
|
||||||
|
|
||||||
DBUG_ENTER("ha_create_table");
|
DBUG_ENTER("ha_create_table");
|
||||||
|
|
||||||
init_tmp_table_share(thd, &share, db, 0, table_name, path);
|
init_tmp_table_share(thd, &share, db, 0, table_name, path);
|
||||||
|
|
||||||
if (frm)
|
if (frm)
|
||||||
|
@ -320,6 +320,7 @@
|
|||||||
#define HA_LEX_CREATE_TMP_TABLE 1
|
#define HA_LEX_CREATE_TMP_TABLE 1
|
||||||
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
|
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
|
||||||
#define HA_LEX_CREATE_TABLE_LIKE 4
|
#define HA_LEX_CREATE_TABLE_LIKE 4
|
||||||
|
#define HA_CREATE_TMP_ALTER 8
|
||||||
#define HA_MAX_REC_LENGTH 65535
|
#define HA_MAX_REC_LENGTH 65535
|
||||||
|
|
||||||
/* Table caching type */
|
/* Table caching type */
|
||||||
@ -1437,7 +1438,7 @@ struct HA_CREATE_INFO
|
|||||||
const char *alias;
|
const char *alias;
|
||||||
ulonglong max_rows,min_rows;
|
ulonglong max_rows,min_rows;
|
||||||
ulonglong auto_increment_value;
|
ulonglong auto_increment_value;
|
||||||
ulong table_options;
|
ulong table_options; ///< HA_OPTION_ values
|
||||||
ulong avg_row_length;
|
ulong avg_row_length;
|
||||||
ulong used_fields;
|
ulong used_fields;
|
||||||
ulong key_block_size;
|
ulong key_block_size;
|
||||||
|
@ -2374,6 +2374,13 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||||||
wrong_tables.append(',');
|
wrong_tables.append(',');
|
||||||
wrong_tables.append(String(table->table_name,system_charset_info));
|
wrong_tables.append(String(table->table_name,system_charset_info));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PSI_CALL_drop_table_share(table->internal_tmp_table,
|
||||||
|
table->db, table->db_length,
|
||||||
|
table->table_name, table->table_name_length);
|
||||||
|
}
|
||||||
|
|
||||||
DBUG_PRINT("table", ("table: 0x%lx s: 0x%lx", (long) table->table,
|
DBUG_PRINT("table", ("table: 0x%lx s: 0x%lx", (long) table->table,
|
||||||
table->table ? (long) table->table->s : (long) -1));
|
table->table ? (long) table->table->s : (long) -1));
|
||||||
|
|
||||||
@ -2510,6 +2517,11 @@ bool quick_rm_table(handlerton *base,const char *db,
|
|||||||
path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
|
path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
|
||||||
if (!(flags & FRM_ONLY))
|
if (!(flags & FRM_ONLY))
|
||||||
error|= ha_delete_table(current_thd, base, path, db, table_name, 0);
|
error|= ha_delete_table(current_thd, base, path, db, table_name, 0);
|
||||||
|
|
||||||
|
if (likely(error == 0))
|
||||||
|
PSI_CALL_drop_table_share(flags & FN_IS_TMP, db, strlen(db),
|
||||||
|
table_name, strlen(table_name));
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4674,7 +4686,7 @@ mysql_rename_table(handlerton *base, const char *old_db,
|
|||||||
*/
|
*/
|
||||||
if (likely(error == 0))
|
if (likely(error == 0))
|
||||||
{
|
{
|
||||||
PSI_CALL_drop_table_share(is_prefix(old_name, tmp_file_prefix),
|
PSI_CALL_drop_table_share(flags & FN_FROM_IS_TMP,
|
||||||
old_db, strlen(old_db),
|
old_db, strlen(old_db),
|
||||||
old_name, strlen(old_name));
|
old_name, strlen(old_name));
|
||||||
}
|
}
|
||||||
@ -7001,6 +7013,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
HA_OPTION_PACK_RECORD));
|
HA_OPTION_PACK_RECORD));
|
||||||
}
|
}
|
||||||
tmp_disable_binlog(thd);
|
tmp_disable_binlog(thd);
|
||||||
|
create_info->options|=HA_CREATE_TMP_ALTER;
|
||||||
error= mysql_create_table_no_lock(thd, new_db, tmp_name, create_info,
|
error= mysql_create_table_no_lock(thd, new_db, tmp_name, create_info,
|
||||||
alter_info, NULL, create_table_mode);
|
alter_info, NULL, create_table_mode);
|
||||||
reenable_binlog(thd);
|
reenable_binlog(thd);
|
||||||
|
Reference in New Issue
Block a user