1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be86adbf67b8..59dc149410f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,6 +154,7 @@ INCLUDE(ssl)
INCLUDE(readline)
INCLUDE(libutils)
INCLUDE(dtrace)
+INCLUDE(jemalloc)
INCLUDE(pcre)
INCLUDE(ctest)
INCLUDE(plugin)
@@ -329,6 +328,7 @@ 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 e4ca562772e0..30db38ce35b5 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1071,7 +1071,6 @@ 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 814993355b0f..243468e095a3 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
+ mysys mysys_ssl dbug strings vio pcre ${LIBJEMALLOC}
${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
${WSREP_LIB}
${SSL_LIBRARIES}
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index d6b1c76ea004..fd724bc7dd16 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -3489,32 +3489,11 @@ 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(guess_malloc_library()));
+ IN_SYSTEM_CHARSET, DEFAULT(MALLOC_LIBRARY));
#ifdef HAVE_YASSL
#include <openssl/ssl.h>
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 4cfb177e495f..fd9a4790a7ea 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -5,8 +5,6 @@
RETURN()
ELSEIF(CMAKE_VERSION VERSION_LESS "2.8.9")
MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB")
-ELSEIF(NOT HAVE_DLOPEN)
- MESSAGE(STATUS "dlopen is required by TokuDB")
ELSEIF(PLUGIN_PERFSCHEMA MATCHES "^NO$")
MESSAGE(STATUS "Performance Schema is required by TokuDB")
RETURN()
@@ -37,8 +35,7 @@
tokudb_sysvars.cc
tokudb_thread.cc
tokudb_dir_cmd.cc)
-MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY
- COMPONENT tokudb-engine CONFIG ${CMAKE_CURRENT_BINARY_DIR}/tokudb.cnf)
+MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY COMPONENT Server)
IF(NOT TARGET tokudb)
RETURN()
@@ -57,27 +54,6 @@
GET_FILENAME_COMPONENT(LIBJEMALLOC_PATH ${LIBJEMALLOC_SO} REALPATH CACHE)
ENDIF()
-IF(LIBJEMALLOC_PATH AND (RPM OR DEB))
- 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-shadow")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
@@ -154,7 +130,7 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/${TOKU_FT_DIR_NAME}/portability)
TARGET_LINK_LIBRARIES(tokudb tokufractaltree_static tokuportability_static
- ${ZLIB_LIBRARY} ${LIBJEMALLOC} stdc++)
+ ${ZLIB_LIBRARY} 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")
diff --git a/storage/tokudb/PerconaFT/tools/CMakeLists.txt b/storage/tokudb/PerconaFT/tools/CMakeLists.txt
index f11b9f350d72..e62931524c9d 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 tokudb-engine)
-install(TARGETS tokuft_logprint DESTINATION ${INSTALL_BINDIR} COMPONENT tokudb-engine)
+install(TARGETS tokuftdump DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
+install(TARGETS tokuft_logprint DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
|