From bb045e7931c451b228ffc5bcdb1791a31eb0c852 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 16 May 2018 11:15:08 +0200 Subject: MDEV-16183 TokuDB tests fail on Fedora 28 jemalloc > 5.0.0 doesn't like to be linked with a dlopen-ed module. Don't link tokudb with jemalloc on Fedora 28, LD_PRELOAD it instead with mysqld_safe and with systemd. --- storage/tokudb/CMakeLists.txt | 29 ++++++++++++++++++++++++++++- storage/tokudb/tokudb.cnf | 6 ------ storage/tokudb/tokudb.cnf.in | 9 +++++++++ storage/tokudb/tokudb.conf.in | 3 +++ 4 files changed, 40 insertions(+), 7 deletions(-) delete mode 100644 storage/tokudb/tokudb.cnf create mode 100644 storage/tokudb/tokudb.cnf.in create mode 100644 storage/tokudb/tokudb.conf.in diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index a0abee09727..16f7ab4ce75 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -35,7 +35,7 @@ SET(TOKUDB_SOURCES tokudb_thread.cc tokudb_dir_cmd.cc) MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY - COMPONENT tokudb-engine CONFIG tokudb.cnf) + COMPONENT tokudb-engine CONFIG ${CMAKE_CURRENT_BINARY_DIR}/tokudb.cnf) IF(NOT TARGET tokudb) RETURN() @@ -46,6 +46,33 @@ CHECK_JEMALLOC() IF(NOT LIBJEMALLOC) MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported") +ELSEIF(LIBJEMALLOC STREQUAL jemalloc) + FIND_LIBRARY(LIBJEMALLOC_SO jemalloc) + IF(NOT LIBJEMALLOC_SO) + MESSAGE(FATAL_ERROR "jemalloc is present, but cannot be found?") + ENDIF() + GET_FILENAME_COMPONENT(LIBJEMALLOC_PATH ${LIBJEMALLOC_SO} REALPATH CACHE) +ENDIF() + +IF(LIBJEMALLOC_PATH AND RPM MATCHES fedora28) # TODO check for jemalloc version + UNSET(LIBJEMALLOC) + GET_DIRECTORY_PROPERTY(V DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITION CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES) + SET(CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES "${V} jemalloc" PARENT_SCOPE) + SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #" + SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}") +ELSEIF(LIBJEMALLOC_PATH) + SET(systemd_env "#Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #" + SET(cnf_malloc_lib "#malloc-lib=${LIBJEMALLOC_PATH}") +ELSE() + SET(systemd_env "#Environment=\"LD_PRELOAD=/path/to/libjemalloc.so\"") #" + SET(cnf_malloc_lib "#malloc-lib=/path/to/libjemalloc.so") +ENDIF() +CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY) +CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY) +IF(INSTALL_SYSCONFDIR) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf + DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/ + COMPONENT tokudb-engine) ENDIF() MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG) diff --git a/storage/tokudb/tokudb.cnf b/storage/tokudb/tokudb.cnf deleted file mode 100644 index 4def635ddf0..00000000000 --- a/storage/tokudb/tokudb.cnf +++ /dev/null @@ -1,6 +0,0 @@ -[mariadb] -# See https://mariadb.com/kb/en/tokudb-differences/ for differences -# between TokuDB in MariaDB and TokuDB from http://www.tokutek.com/ - -plugin-load-add=ha_tokudb.so - diff --git a/storage/tokudb/tokudb.cnf.in b/storage/tokudb/tokudb.cnf.in new file mode 100644 index 00000000000..de9b5b711ee --- /dev/null +++ b/storage/tokudb/tokudb.cnf.in @@ -0,0 +1,9 @@ +[mariadb] +# See https://mariadb.com/kb/en/tokudb-differences/ for differences +# between TokuDB in MariaDB and TokuDB from http://www.tokutek.com/ + +plugin-load-add=ha_tokudb.so + +[mysqld_safe] +# it might be necessary to uncomment the following line if jemalloc >= 5.0.0 +@cnf_malloc_lib@ diff --git a/storage/tokudb/tokudb.conf.in b/storage/tokudb/tokudb.conf.in new file mode 100644 index 00000000000..d22f6686d91 --- /dev/null +++ b/storage/tokudb/tokudb.conf.in @@ -0,0 +1,3 @@ +[Service] +# it might be necessary to uncomment the following line if jemalloc >= 5.0.0 +@systemd_env@ -- cgit v1.2.1