#At file:///G:/bzr/mysql-5.1-rpl/
2705 Vladislav Vaintroub 2008-12-08
Bug#39750 -cannot create temp file on Windows.
The problem appears often in conjuction with temp files, when temp-pool is used, so that names of temp files are not unique.
The reason is that rapid deletiion and creation of files with the same name on Windows is not guaranteed to succeed. File disappears from the file system only when the last handle to it is closed. If for example a virus scanner, a backup or indexing application opens the temp file just before MySQL deletes it, the file will enter "delete pending" state and will remain in this state until the handle to file is closed. In this state,it is not possible to open the file , or create a file with the same name (CreateFile returns ERROR_ACCESS_DENED, posix open returns EACESS)
Fix (rather a cheap workaround) is not to use temp-pool when working with temporary files- this will make filenames unique.
With this patch , temp- pool setting will be ignored on anything but Linux(the option only made sense for Linux since its invention anyway).
modified:
sql/mysqld.cc
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2008-11-04 10:00:26 +0000
+++ b/sql/mysqld.cc 2008-12-08 14:38:36 +0000
@@ -227,6 +227,12 @@ extern "C" int gethostname(char *name, i
extern "C" sig_handler handle_segfault(int sig);
+#if defined(__linux__)
+#define ENABLE_TEMP_POOL 1
+#else
+#define ENABLE_TEMP_TOOL 0
+#endif
+
/* Constants */
const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"};
@@ -3405,8 +3411,13 @@ static int init_common_variables(const c
sys_var_slow_log_path.value= my_strdup(s, MYF(0));
sys_var_slow_log_path.value_length= strlen(s);
+#if (ENABLE_TEMP_POOL)
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1;
+#else
+ use_temp_pool= 0;
+#endif
+
if (my_database_names_init())
return 1;
@@ -6309,9 +6320,14 @@ log and this option does nothing anymore
(uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"temp-pool", OPT_TEMP_POOL,
+#if (ENABLE_TEMP_POOL)
"Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.",
+#else
+ "This option is ignored on this OS.",
+#endif
(uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
+
{"timed_mutexes", OPT_TIMED_MUTEXES,
"Specify whether to time mutexes (only InnoDB mutexes are currently supported)",
(uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (vvaintroub:2705) Bug#39750 | Vladislav Vaintroub | 8 Dec |