summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-06-13 21:23:19 +0200
committerSergei Golubchik <serg@mariadb.org>2020-07-04 01:44:46 +0200
commitc55c292832e2776d37e06c43174ac006e00143a2 (patch)
treee83cc7fd44b132de7a4c33975737825ccd18907e /sql/sql_base.cc
parentf17f7a43ba7da44608618f9e612f9808d363da23 (diff)
downloadmariadb-git-c55c292832e2776d37e06c43174ac006e00143a2.tar.gz
introduce hton->drop_table() method
first step in moving drop table out of the handler. todo: other methods that don't need an open table for now hton->drop_table is optional, for backward compatibility reasons
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 88a28c470c0..6d53a8ee6e3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -8794,7 +8794,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, Field **ptr,
my_bool mysql_rm_tmp_tables(void)
{
uint i, idx;
- char filePath[FN_REFLEN], *tmpdir, filePathCopy[FN_REFLEN];
+ char path[FN_REFLEN], *tmpdir, path_copy[FN_REFLEN];
MY_DIR *dirp;
FILEINFO *file;
TABLE_SHARE share;
@@ -8823,23 +8823,17 @@ my_bool mysql_rm_tmp_tables(void)
{
char *ext= fn_ext(file->name);
size_t ext_len= strlen(ext);
- size_t filePath_len= my_snprintf(filePath, sizeof(filePath),
+ size_t path_len= my_snprintf(path, sizeof(path),
"%s%c%s", tmpdir, FN_LIBCHAR,
file->name);
if (!strcmp(reg_ext, ext))
{
- handler *handler_file= 0;
/* We should cut file extention before deleting of table */
- memcpy(filePathCopy, filePath, filePath_len - ext_len);
- filePathCopy[filePath_len - ext_len]= 0;
- init_tmp_table_share(thd, &share, "", 0, "", filePathCopy);
- if (!open_table_def(thd, &share) &&
- ((handler_file= get_new_handler(&share, thd->mem_root,
- share.db_type()))))
- {
- handler_file->ha_delete_table(filePathCopy);
- delete handler_file;
- }
+ memcpy(path_copy, path, path_len - ext_len);
+ path_copy[path_len - ext_len]= 0;
+ init_tmp_table_share(thd, &share, "", 0, "", path_copy);
+ if (!open_table_def(thd, &share))
+ share.db_type()->drop_table(share.db_type(), path_copy);
free_table_share(&share);
}
/*
@@ -8847,7 +8841,7 @@ my_bool mysql_rm_tmp_tables(void)
So we hide error messages which happnes during deleting of these
files(MYF(0)).
*/
- (void) mysql_file_delete(key_file_misc, filePath, MYF(0));
+ (void) mysql_file_delete(key_file_misc, path, MYF(0));
}
}
my_dirend(dirp);