summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2008-12-05 19:20:05 +0100
committerVladislav Vaintroub <vvaintroub@mysql.com>2008-12-05 19:20:05 +0100
commit20cec8bf8aa3798dede3cd18ba8e06777101eef5 (patch)
tree050636aff107b52a6c8d872aa4ed909fe55e0494 /sql/mysqld.cc
parent8f500c522b5b38b55204031a90977c2c087ffd5c (diff)
downloadmariadb-git-20cec8bf8aa3798dede3cd18ba8e06777101eef5.tar.gz
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 fiiles 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. 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 workarounf) 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).
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7ff2b9e7dff..32e0dd1542c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -227,6 +227,12 @@ extern "C" int gethostname(char *name, int namelen);
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"};
@@ -3398,8 +3404,13 @@ static int init_common_variables(const char *conf_file_name, int argc,
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;
@@ -6297,9 +6308,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,