Skip to content

Commit

Permalink
MDEV-11059 don't build the server with jemalloc
Browse files Browse the repository at this point in the history
don't build the server with jemalloc.
only build tokudb with it.
move tokudb into a separate package, because it brings a new dependency
  • Loading branch information
vuvova committed Mar 28, 2017
1 parent 31a5d72 commit bf40e80
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 17 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ INCLUDE(ssl)
INCLUDE(readline)
INCLUDE(libutils)
INCLUDE(dtrace)
INCLUDE(jemalloc)
INCLUDE(pcre)
INCLUDE(ctest)
INCLUDE(plugin)
Expand Down Expand Up @@ -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)

Expand All @@ -329,7 +328,6 @@ MYSQL_CHECK_SSL()
MYSQL_CHECK_READLINE()

SET(MALLOC_LIBRARY "system")
CHECK_JEMALLOC()

CHECK_PCRE()

Expand Down
1 change: 1 addition & 0 deletions include/my_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
23 changes: 22 additions & 1 deletion sql/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
14 changes: 8 additions & 6 deletions storage/tokudb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions storage/tokudb/PerconaFT/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 1 addition & 4 deletions storage/tokudb/tokudb.cnf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bf40e80

Please sign in to comment.