diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-03-22 14:34:34 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-03-29 00:40:21 +0200 |
commit | bf40e8069cd695228f3ea5d1bb25938a72bcf45f (patch) | |
tree | db36d3c757f6f494dbe9d6850d3cd3c0b9cb0f01 | |
parent | 31a5d7212fcd40112cf357763d88c6d07d70271d (diff) | |
download | mariadb-git-bf40e8069cd695228f3ea5d1bb25938a72bcf45f.tar.gz |
MDEV-11059 don't build the server with jemalloc
don't build the server with jemalloc.
only build tokudb with it.
move tokudb into a separate package, because it brings a new dependency
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | include/my_global.h | 1 | ||||
-rw-r--r-- | sql/CMakeLists.txt | 2 | ||||
-rw-r--r-- | sql/sys_vars.cc | 23 | ||||
-rw-r--r-- | storage/tokudb/CMakeLists.txt | 14 | ||||
-rw-r--r-- | storage/tokudb/PerconaFT/tools/CMakeLists.txt | 4 | ||||
-rw-r--r-- | storage/tokudb/tokudb.cnf | 5 |
7 files changed, 36 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index be86adbf67b..59dc149410f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,7 +154,6 @@ INCLUDE(ssl) INCLUDE(readline) INCLUDE(libutils) INCLUDE(dtrace) -INCLUDE(jemalloc) INCLUDE(pcre) INCLUDE(ctest) INCLUDE(plugin) @@ -313,7 +312,7 @@ IF(NOT HAVE_CXX_NEW) ENDIF() # Find header files from the bundled libraries -# (jemalloc, yassl, readline, pcre, etc) +# (yassl, readline, pcre, etc) # before the ones installed in the system SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) @@ -329,7 +328,6 @@ MYSQL_CHECK_SSL() MYSQL_CHECK_READLINE() SET(MALLOC_LIBRARY "system") -CHECK_JEMALLOC() CHECK_PCRE() diff --git a/include/my_global.h b/include/my_global.h index e4ca562772e..30db38ce35b 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1071,6 +1071,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */ #ifdef _WIN32 #define dlsym(lib, name) (void*)GetProcAddress((HMODULE)lib, name) #define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0) +#define RTLD_DEFAULT GetModuleHandle(NULL) #define dlclose(lib) FreeLibrary((HMODULE)lib) static inline char *dlerror(void) { diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 814993355b0..243468e095a 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -170,7 +170,7 @@ ADD_DEPENDENCIES(sql GenServerSource) ADD_DEPENDENCIES(sql GenDigestServerSource) DTRACE_INSTRUMENT(sql) TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} - mysys mysys_ssl dbug strings vio pcre ${LIBJEMALLOC} + mysys mysys_ssl dbug strings vio pcre ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${WSREP_LIB} ${SSL_LIBRARIES} diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index d6b1c76ea00..fd724bc7dd1 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3489,11 +3489,32 @@ static Sys_var_charptr Sys_version_compile_os( CMD_LINE_HELP_ONLY, IN_SYSTEM_CHARSET, DEFAULT(SYSTEM_TYPE)); +static char *guess_malloc_library() +{ + if (strcmp(MALLOC_LIBRARY, "system") == 0) + { +#ifdef HAVE_DLOPEN + typedef int (*mallctl_type)(const char*, void*, size_t*, void*, size_t); + mallctl_type mallctl_func; + mallctl_func= (mallctl_type)dlsym(RTLD_DEFAULT, "mallctl"); + if (mallctl_func) + { + static char buf[128]; + char *ver; + size_t len = sizeof(ver); + mallctl_func("version", &ver, &len, NULL, 0); + strxnmov(buf, sizeof(buf)-1, "jemalloc ", ver, NULL); + return buf; + } +#endif + } + return const_cast<char*>(MALLOC_LIBRARY); +} static char *malloc_library; static Sys_var_charptr Sys_malloc_library( "version_malloc_library", "Version of the used malloc library", READ_ONLY GLOBAL_VAR(malloc_library), CMD_LINE_HELP_ONLY, - IN_SYSTEM_CHARSET, DEFAULT(MALLOC_LIBRARY)); + IN_SYSTEM_CHARSET, DEFAULT(guess_malloc_library())); #ifdef HAVE_YASSL #include <openssl/ssl.h> diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index 4cfb177e495..fd9a4790a7e 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -22,12 +22,16 @@ SET(TOKUDB_SOURCES tokudb_information_schema.cc tokudb_sysvars.cc tokudb_thread.cc) -MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY) +MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY + COMPONENT tokudb-engine) IF(NOT TARGET tokudb) RETURN() ENDIF() +INCLUDE(jemalloc) +CHECK_JEMALLOC() + IF(NOT LIBJEMALLOC) MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported") ENDIF() @@ -102,14 +106,12 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/${TOKU_FT_DIR_NAME}/buildheader) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/${TOKU_FT_DIR_NAME}/portability) TARGET_LINK_LIBRARIES(tokudb tokufractaltree_static tokuportability_static - ${ZLIB_LIBRARY} stdc++) + ${ZLIB_LIBRARY} ${LIBJEMALLOC} stdc++) SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -fuse-linker-plugin") SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} -flto -fuse-linker-plugin") -SET(CPACK_RPM_server_PACKAGE_OBSOLETES - "${CPACK_RPM_server_PACKAGE_OBSOLETES} MariaDB-tokudb-engine < 10.0.5" PARENT_SCOPE) - IF (INSTALL_SYSCONF2DIR) - INSTALL(FILES tokudb.cnf DESTINATION ${INSTALL_SYSCONF2DIR} COMPONENT Server) + INSTALL(FILES tokudb.cnf DESTINATION ${INSTALL_SYSCONF2DIR} + COMPONENT tokudb-engine) ENDIF(INSTALL_SYSCONF2DIR) diff --git a/storage/tokudb/PerconaFT/tools/CMakeLists.txt b/storage/tokudb/PerconaFT/tools/CMakeLists.txt index f11b9f350d7..e62931524c9 100644 --- a/storage/tokudb/PerconaFT/tools/CMakeLists.txt +++ b/storage/tokudb/PerconaFT/tools/CMakeLists.txt @@ -12,5 +12,5 @@ endforeach(tool) # link in math.h library just for this tool. target_link_libraries(ftverify m) -install(TARGETS tokuftdump DESTINATION ${INSTALL_BINDIR} COMPONENT Server) -install(TARGETS tokuft_logprint DESTINATION ${INSTALL_BINDIR} COMPONENT Server) +install(TARGETS tokuftdump DESTINATION ${INSTALL_BINDIR} COMPONENT tokudb-engine) +install(TARGETS tokuft_logprint DESTINATION ${INSTALL_BINDIR} COMPONENT tokudb-engine) diff --git a/storage/tokudb/tokudb.cnf b/storage/tokudb/tokudb.cnf index f94a128c02c..4def635ddf0 100644 --- a/storage/tokudb/tokudb.cnf +++ b/storage/tokudb/tokudb.cnf @@ -1,9 +1,6 @@ [mariadb] -# See https://mariadb.com/kb/en/how-to-enable-tokudb-in-mariadb/ -# for instructions how to enable TokuDB -# # 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 +plugin-load-add=ha_tokudb.so |