Commit af1fbde5 authored by Rich Prohaska's avatar Rich Prohaska

#224 fail tokudb init if jemalloc is not loaded

parent 12f56b69
...@@ -27,6 +27,10 @@ IF(DEFINED TOKUDB_NOPATCH_CONFIG) ...@@ -27,6 +27,10 @@ IF(DEFINED TOKUDB_NOPATCH_CONFIG)
ADD_DEFINITIONS("-DTOKUDB_NOPATCH_CONFIG=${TOKUDB_NOPATCH_CONFIG}") ADD_DEFINITIONS("-DTOKUDB_NOPATCH_CONFIG=${TOKUDB_NOPATCH_CONFIG}")
ENDIF() ENDIF()
IF(DEFINED TOKUDB_CHECK_JEMALLOC)
ADD_DEFINITIONS("-DTOKUDB_CHECK_JEMALLOC=${TOKUDB_CHECK_JEMALLOC}")
ENDIF()
ADD_SUBDIRECTORY(ft-index) ADD_SUBDIRECTORY(ft-index)
INCLUDE_DIRECTORIES(ft-index) INCLUDE_DIRECTORIES(ft-index)
......
...@@ -301,50 +301,46 @@ static TOKU_ENGINE_STATUS_ROW_S* toku_global_status_rows = NULL; ...@@ -301,50 +301,46 @@ static TOKU_ENGINE_STATUS_ROW_S* toku_global_status_rows = NULL;
static void handle_ydb_error(int error) { static void handle_ydb_error(int error) {
switch (error) { switch (error) {
case TOKUDB_HUGE_PAGES_ENABLED: case TOKUDB_HUGE_PAGES_ENABLED:
fprintf(stderr, "************************************************************\n"); sql_print_error("************************************************************");
fprintf(stderr, " \n"); sql_print_error(" ");
fprintf(stderr, " @@@@@@@@@@@ \n"); sql_print_error(" @@@@@@@@@@@ ");
fprintf(stderr, " @@' '@@ \n"); sql_print_error(" @@' '@@ ");
fprintf(stderr, " @@ _ _ @@ \n"); sql_print_error(" @@ _ _ @@ ");
fprintf(stderr, " | (.) (.) | \n"); sql_print_error(" | (.) (.) | ");
fprintf(stderr, " | ` | \n"); sql_print_error(" | ` | ");
fprintf(stderr, " | > ' | \n"); sql_print_error(" | > ' | ");
fprintf(stderr, " | .----. | \n"); sql_print_error(" | .----. | ");
fprintf(stderr, " .. |.----.| .. \n"); sql_print_error(" .. |.----.| .. ");
fprintf(stderr, " .. ' ' .. \n"); sql_print_error(" .. ' ' .. ");
fprintf(stderr, " .._______,. \n"); sql_print_error(" .._______,. ");
fprintf(stderr, " \n"); sql_print_error(" ");
fprintf(stderr, " %s will not run with transparent huge pages enabled. \n", tokudb_hton_name); sql_print_error("%s will not run with transparent huge pages enabled. ", tokudb_hton_name);
fprintf(stderr, " Please disable them to continue. \n"); sql_print_error("Please disable them to continue. ");
fprintf(stderr, " (echo never > /sys/kernel/mm/transparent_hugepage/enabled) \n"); sql_print_error("(echo never > /sys/kernel/mm/transparent_hugepage/enabled) ");
fprintf(stderr, " \n"); sql_print_error(" ");
fprintf(stderr, "************************************************************\n"); sql_print_error("************************************************************");
fflush(stderr);
break; break;
} }
} }
static int tokudb_init_func(void *p) { static int tokudb_init_func(void *p) {
TOKUDB_DBUG_ENTER(""); TOKUDB_DBUG_ENTER("%p", p);
int r; int r;
#if defined(_WIN64)
r = toku_ydb_init();
if (r) {
fprintf(stderr, "got error %d\n", r);
goto error;
}
#endif
// 3938: lock the handlerton's initialized status flag for writing // 3938: lock the handlerton's initialized status flag for writing
r = rw_wrlock(&tokudb_hton_initialized_lock); r = rw_wrlock(&tokudb_hton_initialized_lock);
assert(r == 0); assert(r == 0);
db_env = NULL; db_env = NULL;
tokudb_hton = (handlerton *) p; tokudb_hton = (handlerton *) p;
#if TOKUDB_CHECK_JEMALLOC
if (tokudb_check_jemalloc && dlsym(RTLD_DEFAULT, "mallctl") == NULL) {
sql_print_error("%s not initialized because jemalloc is not loaded", tokudb_hton_name);
goto error;
}
#endif
tokudb_pthread_mutex_init(&tokudb_mutex, MY_MUTEX_INIT_FAST); tokudb_pthread_mutex_init(&tokudb_mutex, MY_MUTEX_INIT_FAST);
(void) my_hash_init(&tokudb_open_tables, table_alias_charset, 32, 0, 0, (my_hash_get_key) tokudb_get_key, 0, 0); (void) my_hash_init(&tokudb_open_tables, table_alias_charset, 32, 0, 0, (my_hash_get_key) tokudb_get_key, 0, 0);
...@@ -452,7 +448,6 @@ static int tokudb_init_func(void *p) { ...@@ -452,7 +448,6 @@ static int tokudb_init_func(void *p) {
} }
DBUG_PRINT("info", ("tokudb_data_dir: %s\n", data_dir)); DBUG_PRINT("info", ("tokudb_data_dir: %s\n", data_dir));
db_env->set_data_dir(db_env, data_dir); db_env->set_data_dir(db_env, data_dir);
DBUG_PRINT("info", ("tokudb_tmp_dir: %s\n", tmp_dir)); DBUG_PRINT("info", ("tokudb_tmp_dir: %s\n", tmp_dir));
db_env->set_tmp_dir(db_env, tmp_dir); db_env->set_tmp_dir(db_env, tmp_dir);
} }
...@@ -1339,7 +1334,6 @@ static void tokudb_fsync_log_period_update(THD *thd, struct st_mysql_sys_var *sy ...@@ -1339,7 +1334,6 @@ static void tokudb_fsync_log_period_update(THD *thd, struct st_mysql_sys_var *sy
static MYSQL_SYSVAR_UINT(fsync_log_period, tokudb_fsync_log_period, 0, "TokuDB fsync log period", NULL, tokudb_fsync_log_period_update, 0, 0, ~0U, 0); static MYSQL_SYSVAR_UINT(fsync_log_period, tokudb_fsync_log_period, 0, "TokuDB fsync log period", NULL, tokudb_fsync_log_period_update, 0, 0, ~0U, 0);
static struct st_mysql_sys_var *tokudb_system_variables[] = { static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(cache_size), MYSQL_SYSVAR(cache_size),
MYSQL_SYSVAR(max_lock_memory), MYSQL_SYSVAR(max_lock_memory),
...@@ -1388,6 +1382,9 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = { ...@@ -1388,6 +1382,9 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(hide_default_row_format), MYSQL_SYSVAR(hide_default_row_format),
MYSQL_SYSVAR(killed_time), MYSQL_SYSVAR(killed_time),
MYSQL_SYSVAR(empty_scan), MYSQL_SYSVAR(empty_scan),
#if TOKUDB_CHECK_JEMALLOC
MYSQL_SYSVAR(check_jemalloc),
#endif
NULL NULL
}; };
......
...@@ -510,6 +510,11 @@ static MYSQL_THDVAR_ENUM(empty_scan, ...@@ -510,6 +510,11 @@ static MYSQL_THDVAR_ENUM(empty_scan,
NULL, NULL, TOKUDB_EMPTY_SCAN_RL, &tokudb_empty_scan_typelib NULL, NULL, TOKUDB_EMPTY_SCAN_RL, &tokudb_empty_scan_typelib
); );
#if TOKUDB_CHECK_JEMALLOC
static uint tokudb_check_jemalloc;
static MYSQL_SYSVAR_UINT(check_jemalloc, tokudb_check_jemalloc, 0, "Check if jemalloc is linked", NULL, NULL, 1, 0, 1, 0);
#endif
extern HASH tokudb_open_tables; extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex; extern pthread_mutex_t tokudb_mutex;
extern uint32_t tokudb_write_status_frequency; extern uint32_t tokudb_write_status_frequency;
......
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