summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-09-24 22:55:04 +0200
committerunknown <guilhem@mysql.com>2003-09-24 22:55:04 +0200
commit874783abb23c366b1c90c9bd3bb6d3fc10da289c (patch)
tree81fee78d6026c6ab21b0a61a1b4bc4c354f7896d /sql
parentf46ca5fbe905caa7efb3f3cafdbdcc7c0f83a2b0 (diff)
downloadmariadb-git-874783abb23c366b1c90c9bd3bb6d3fc10da289c.tar.gz
Fix for
Bug #1392 "On Win, slave leaves one temp file after successf. replicating LOAD DATA INFILE" Windows-specific bug (we forgot to close a file before deleting it). Patch written by me, tested by Miguel (thanks!) and it works. sql/log.cc: changed the comment to mean the truth sql/log_event.cc: When you finish replicating LOAD DATA INFILE, close the SQL_LOADxxx.data file before deleting it, or Windows will refuse to delete. No need to do the same thing for the SQL_LOADxxx.data file, it's not opened at this moment.
Diffstat (limited to 'sql')
-rw-r--r--sql/log.cc2
-rw-r--r--sql/log_event.cc10
2 files changed, 11 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc
index bd5aeb02121..6307ac0c11e 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -870,7 +870,7 @@ void MYSQL_LOG::new_file(bool need_lock)
close(LOG_CLOSE_TO_BE_OPENED);
/*
- Note that at this point, log_type == LOG_CLOSED (important for is_open()).
+ Note that at this point, log_type != LOG_CLOSED (important for is_open()).
*/
open(old_name, save_log_type, new_name_ptr, index_file_name, io_cache_type,
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 82e9c5950a7..5c76bf3d055 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2382,6 +2382,16 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
}
goto err;
}
+ /*
+ We have an open file descriptor to the .info file; we need to close it
+ or Windows will refuse to delete the file in my_delete().
+ */
+ if (fd >= 0)
+ {
+ my_close(fd, MYF(0));
+ end_io_cache(&file);
+ fd= -1;
+ }
(void) my_delete(fname, MYF(MY_WME));
memcpy(p, ".data", 6);
(void) my_delete(fname, MYF(MY_WME));