Skip to content

Commit 3a4242f

Browse files
vuvovasanja-byelkin
authored andcommitted
TokuDB: Don't free P_S instrumented mutexes after exit()
don't create static objects that destroy mutexes from destructors, and don't destroy mutexes from .so destructor (on-unload) function. if it happens after exit(), P_S will be long gone by that time this fixes tokudb tests crashing on quantal-amd64
1 parent d527bf5 commit 3a4242f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

storage/tokudb/PerconaFT/src/ydb_lib.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
4343
#include "ydb.h"
4444
#include <toku_assert.h>
4545

46-
#if defined(__GNUC__)
46+
#if 0 && defined(__GNUC__)
4747

4848
static void __attribute__((constructor)) libtokuft_init(void) {
4949
int r = toku_ydb_init();

storage/tokudb/hatoku_hton.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
2525
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
2626

2727
#include "hatoku_hton.h"
28+
#include "PerconaFT/src/ydb.h"
2829

2930
#define TOKU_METADB_NAME "tokudb_meta"
3031

3132
#if defined(HAVE_PSI_MUTEX_INTERFACE)
32-
static pfs_key_t tokudb_map_mutex_key;
33+
//static pfs_key_t tokudb_map_mutex_key;
3334

3435
static PSI_mutex_info all_tokudb_mutexes[] = {
35-
{&tokudb_map_mutex_key, "tokudb_map_mutex", 0},
36+
//{&tokudb_map_mutex_key, "tokudb_map_mutex", 0},
3637
{&ha_tokudb_mutex_key, "ha_tokudb_mutex", 0},
3738
};
3839

@@ -126,7 +127,7 @@ handlerton* tokudb_hton;
126127
const char* ha_tokudb_ext = ".tokudb";
127128
DB_ENV* db_env;
128129

129-
static tokudb::thread::mutex_t tokudb_map_mutex;
130+
//static tokudb::thread::mutex_t tokudb_map_mutex;
130131
#if defined(TOKU_THDVAR_MEMALLOC_BUG) && TOKU_THDVAR_MEMALLOC_BUG
131132
static TREE tokudb_map;
132133
struct tokudb_map_pair {
@@ -280,7 +281,9 @@ static int tokudb_set_product_name(void) {
280281

281282
static int tokudb_init_func(void *p) {
282283
TOKUDB_DBUG_ENTER("%p", p);
283-
int r;
284+
285+
int r = toku_ydb_init();
286+
assert(r==0);
284287

285288
// 3938: lock the handlerton's initialized status flag for writing
286289
rwlock_t_lock_write(tokudb_hton_initialized_lock);
@@ -295,7 +298,7 @@ static int tokudb_init_func(void *p) {
295298
count = array_elements(all_tokudb_rwlocks);
296299
mysql_rwlock_register("tokudb", all_tokudb_rwlocks, count);
297300

298-
tokudb_map_mutex.reinit(tokudb_map_mutex_key);
301+
//tokudb_map_mutex.reinit(tokudb_map_mutex_key);
299302
#endif /* HAVE_PSI_INTERFACE */
300303

301304
db_env = NULL;
@@ -682,6 +685,7 @@ static int tokudb_done_func(TOKUDB_UNUSED(void* p)) {
682685
toku_global_status_variables = NULL;
683686
tokudb::memory::free(toku_global_status_rows);
684687
toku_global_status_rows = NULL;
688+
toku_ydb_destroy();
685689
TOKUDB_DBUG_RETURN(0);
686690
}
687691

0 commit comments

Comments
 (0)