summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2003-09-25 01:25:54 +0400
committerunknown <dlenev@mysql.com>2003-09-25 01:25:54 +0400
commite373f3cccff790fda329de9de13555ef472c86d1 (patch)
treed6f819ddc915bb3d662a67a5c91b769d123b4c62 /sql
parent699f3175fe5e28b5e017dbd73a6dafa21d8a410b (diff)
parentb608c790918f0f95f5e2db69d2ee287bd1678ccc (diff)
downloadmariadb-git-e373f3cccff790fda329de9de13555ef472c86d1.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/dlenev/src/mysql-4.0-bgrn sql/log_event.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/log_event.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 5c76bf3d055..189c4f37252 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -140,11 +140,6 @@ Log_event::Log_event()
/*
Delete all temporary files used for SQL_LOAD.
-
- TODO
- - When we get a 'server start' event, we should only remove
- the files associated with the server id that just started.
- Easily fixable by adding server_id as a prefix to the log files.
*/
static void cleanup_load_tmpdir()
@@ -152,13 +147,30 @@ static void cleanup_load_tmpdir()
MY_DIR *dirp;
FILEINFO *file;
uint i;
+ char fname[FN_REFLEN];
+ char prefbuf[31];
+ char *p;
+
if (!(dirp=my_dir(slave_load_tmpdir,MYF(MY_WME))))
return;
- char fname[FN_REFLEN];
+
+ /*
+ When we are deleting temporary files, we should only remove
+ the files associated with the server id of our server.
+ We don't use event_server_id here because since we've disabled
+ direct binlogging of Create_file/Append_file/Exec_load events
+ we cannot meet Start_log event in the middle of events from one
+ LOAD DATA.
+ */
+ p= strmake(prefbuf,"SQL_LOAD-",9);
+ p= int10_to_str(::server_id, p, 10);
+ *(p++)= '-';
+ *p= 0;
+
for (i=0 ; i < (uint)dirp->number_off_files; i++)
{
file=dirp->dir_entry+i;
- if (is_prefix(file->name,"SQL_LOAD-"))
+ if (is_prefix(file->name, prefbuf))
{
fn_format(fname,file->name,slave_load_tmpdir,"",MY_UNPACK_FILENAME);
my_delete(fname, MYF(0));