mariadb/mariadb-tmpdir.patch

88 lines
3.5 KiB
Diff
Raw Normal View History

Directory /tmp is now on tmpfs, which can cause problems with limitted space
or replication. It's documented here:
http://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_tmpdir
"If the MySQL server is acting as a replication slave, you should not set --tmpdir
to point to a directory on a memory-based file system or to a directory that is
cleared when the server host restarts."
RHBZ#962087
Upstream bug report: https://mariadb.atlassian.net/browse/MDEV-4165
MySQL bug report: http://bugs.mysql.com/bug.php?id=68338
diff -up mariadb-5.5.31/CMakeLists.txt.tmpdir mariadb-5.5.31/CMakeLists.txt
--- mariadb-5.5.31/CMakeLists.txt.tmpdir 2013-05-22 00:09:51.000000000 +0200
+++ mariadb-5.5.31/CMakeLists.txt 2013-05-24 13:28:47.830720926 +0200
@@ -246,6 +246,9 @@ IF(INSTALL_SYSCONFDIR)
SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}")
ENDIF()
+IF(TMPDIR)
+ SET(DEFAULT_TMPDIR "${TMPDIR}")
+ENDIF()
# Run platform tests
INCLUDE(configure.cmake)
diff -up mariadb-5.5.31/config.h.cmake.tmpdir mariadb-5.5.31/config.h.cmake
--- mariadb-5.5.31/config.h.cmake.tmpdir 2013-05-22 00:09:48.000000000 +0200
+++ mariadb-5.5.31/config.h.cmake 2013-05-24 13:27:38.828722133 +0200
@@ -618,6 +618,7 @@
#cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@"
#cmakedefine PLUGINDIR "@PLUGINDIR@"
#cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@"
+#cmakedefine DEFAULT_TMPDIR "@DEFAULT_TMPDIR@"
#cmakedefine SO_EXT "@CMAKE_SHARED_MODULE_SUFFIX@"
diff -up mariadb-5.5.31/include/my_global.h.tmpdir mariadb-5.5.31/include/my_global.h
--- mariadb-5.5.31/include/my_global.h.tmpdir 2013-05-22 00:09:48.000000000 +0200
+++ mariadb-5.5.31/include/my_global.h 2013-05-24 13:27:38.829722133 +0200
@@ -1513,4 +1513,11 @@ static inline double rint(double x)
#endif /* EMBEDDED_LIBRARY */
+/*
+ Define default tmpdir if not already set.
+*/
+#if !defined(DEFAULT_TMPDIR)
+#define DEFAULT_TMPDIR P_tmpdir
+#endif
+
#endif /* my_global_h */
diff -up mariadb-5.5.31/libmysqld/lib_sql.cc.tmpdir mariadb-5.5.31/libmysqld/lib_sql.cc
--- mariadb-5.5.31/libmysqld/lib_sql.cc.tmpdir 2013-05-22 00:09:48.000000000 +0200
+++ mariadb-5.5.31/libmysqld/lib_sql.cc 2013-05-24 13:27:38.830722133 +0200
@@ -559,7 +559,7 @@ int init_embedded_server(int argc, char
opt_mysql_tmpdir=getenv("TMP");
#endif
if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0])
- opt_mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */
+ opt_mysql_tmpdir=(char*) DEFAULT_TMPDIR; /* purecov: inspected */
init_ssl();
umask(((~my_umask) & 0666));
diff -up mariadb-5.5.31/mysys/mf_tempdir.c.tmpdir mariadb-5.5.31/mysys/mf_tempdir.c
--- mariadb-5.5.31/mysys/mf_tempdir.c.tmpdir 2013-05-22 00:09:51.000000000 +0200
+++ mariadb-5.5.31/mysys/mf_tempdir.c 2013-05-24 13:27:38.831722133 +0200
@@ -43,7 +43,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, c
pathlist=getenv("TMP");
#endif
if (!pathlist || !pathlist[0])
- pathlist=(char*) P_tmpdir;
+ pathlist=(char*) DEFAULT_TMPDIR;
}
do
{
diff -up mariadb-5.5.31/mysys/mf_tempfile.c.tmpdir mariadb-5.5.31/mysys/mf_tempfile.c
--- mariadb-5.5.31/mysys/mf_tempfile.c.tmpdir 2013-05-22 00:09:51.000000000 +0200
+++ mariadb-5.5.31/mysys/mf_tempfile.c 2013-05-24 13:27:38.832722133 +0200
@@ -111,7 +111,7 @@ File create_temp_file(char *to, const ch
sizeof(prefix_buff)-7),"XXXXXX") -
prefix_buff);
if (!dir && ! (dir =getenv("TMPDIR")))
- dir=P_tmpdir;
+ dir=DEFAULT_TMPDIR;
if (strlen(dir)+ pfx_len > FN_REFLEN-2)
{
errno=my_errno= ENAMETOOLONG;