Skip to content

Commit 3f24cf2

Browse files
committed
Don't delete non existing .TMD and .OLD files for Aria internal temporary tables
(Simple speedup)
1 parent 65151e0 commit 3f24cf2

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

storage/maria/ha_maria.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2655,7 +2655,7 @@ void ha_maria::drop_table(const char *name)
26552655
{
26562656
DBUG_ASSERT(file->s->temporary);
26572657
(void) ha_close();
2658-
(void) maria_delete_table_files(name, 0);
2658+
(void) maria_delete_table_files(name, 1, 0);
26592659
}
26602660

26612661

storage/maria/ma_delete_table.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ int maria_delete_table(const char *name)
7878
DBUG_RETURN(1);
7979
}
8080

81-
DBUG_RETURN(maria_delete_table_files(name, sync_dir));
81+
DBUG_RETURN(maria_delete_table_files(name, 0, sync_dir));
8282
}
8383

8484

85-
int maria_delete_table_files(const char *name, myf sync_dir)
85+
int maria_delete_table_files(const char *name, my_bool temporary, myf sync_dir)
8686
{
8787
char from[FN_REFLEN];
8888
DBUG_ENTER("maria_delete_table_files");
@@ -97,9 +97,12 @@ int maria_delete_table_files(const char *name, myf sync_dir)
9797
DBUG_RETURN(my_errno);
9898

9999
// optional files from maria_pack:
100-
fn_format(from,name,"",".TMD",MY_UNPACK_FILENAME|MY_APPEND_EXT);
101-
mysql_file_delete_with_symlink(key_file_dfile, from, MYF(0));
102-
fn_format(from,name,"",".OLD",MY_UNPACK_FILENAME|MY_APPEND_EXT);
103-
mysql_file_delete_with_symlink(key_file_dfile, from, MYF(0));
100+
if (!temporary)
101+
{
102+
fn_format(from,name,"",".TMD",MY_UNPACK_FILENAME|MY_APPEND_EXT);
103+
mysql_file_delete_with_symlink(key_file_dfile, from, MYF(0));
104+
fn_format(from,name,"",".OLD",MY_UNPACK_FILENAME|MY_APPEND_EXT);
105+
mysql_file_delete_with_symlink(key_file_dfile, from, MYF(0));
106+
}
104107
DBUG_RETURN(0);
105108
}

storage/maria/maria_def.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,8 @@ void _ma_remap_file(MARIA_HA *info, my_off_t size);
13511351

13521352
MARIA_RECORD_POS _ma_write_init_default(MARIA_HA *info, const uchar *record);
13531353
my_bool _ma_write_abort_default(MARIA_HA *info);
1354-
int maria_delete_table_files(const char *name, myf sync_dir);
1354+
int maria_delete_table_files(const char *name, my_bool temporary,
1355+
myf sync_dir);
13551356

13561357
/*
13571358
This cannot be in my_base.h as it clashes with HA_SPATIAL.

0 commit comments

Comments
 (0)