Commit bf40e806 authored by Sergei Golubchik's avatar Sergei Golubchik

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
parent 31a5d721
......@@ -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()
......
......@@ -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)
{
......
......@@ -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}
......
......@@ -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>
......
......@@ -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)
......@@ -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)
[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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment