summaryrefslogtreecommitdiff
path: root/storage/tokudb/hatoku_hton.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-10-22 13:55:55 +0200
committerSergei Golubchik <serg@mariadb.org>2015-10-22 13:55:55 +0200
commit581d85259d2669f5951b2d918ccdf10c0f93a184 (patch)
treebddd274bff097434c50bfc38799c009bfe724051 /storage/tokudb/hatoku_hton.cc
parent6f0754789ca7eee969da84ba3e98d023d7ca812b (diff)
downloadmariadb-git-581d85259d2669f5951b2d918ccdf10c0f93a184.tar.gz
MDEV-8868 Consider adding a check for libjemalloc version in cmake and/or at runtime
add a run-time check for jemalloc >= 2.3
Diffstat (limited to 'storage/tokudb/hatoku_hton.cc')
-rw-r--r--storage/tokudb/hatoku_hton.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index a804fc80489..f1a2426c0e3 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -356,9 +356,23 @@ static int tokudb_init_func(void *p) {
tokudb_hton = (handlerton *) p;
#if TOKUDB_CHECK_JEMALLOC
- if (tokudb_check_jemalloc && dlsym(RTLD_DEFAULT, "mallctl") == NULL) {
- sql_print_error("%s is not initialized because jemalloc is not loaded", tokudb_hton_name);
- goto error;
+ if (tokudb_check_jemalloc) {
+ 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) {
+ sql_print_error("%s is not initialized because jemalloc is not loaded", tokudb_hton_name);
+ goto error;
+ }
+ char *ver;
+ size_t len= sizeof(ver);
+ mallctl_func("version", &ver, &len, NULL, 0);
+ /* jemalloc 2.2.5 crashes mysql-test */
+ if (strcmp(ver, "2.3.") < 0) {
+ sql_print_error("%s is not initialized because jemalloc is older than 2.3.0", tokudb_hton_name);
+ goto error;
+ }
+
}
#endif