Skip to content

Commit 077f29a

Browse files
committed
Merge branch 'merge/merge-tokudb-5.6' into 10.0
5.6.31-77.0
2 parents 3863e72 + 4f2d214 commit 077f29a

35 files changed

+153
-79
lines changed

storage/tokudb/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SET(TOKUDB_VERSION 5.6.30-76.3)
1+
SET(TOKUDB_VERSION 5.6.31-77.0)
22
# PerconaFT only supports x86-64 and cmake-2.8.9+
33
IF(CMAKE_VERSION VERSION_LESS "2.8.9")
44
MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB")
@@ -82,10 +82,6 @@ IF(DEFINED TOKUDB_NOPATCH_CONFIG)
8282
ADD_DEFINITIONS("-DTOKUDB_NOPATCH_CONFIG=${TOKUDB_NOPATCH_CONFIG}")
8383
ENDIF()
8484

85-
IF(DEFINED TOKUDB_CHECK_JEMALLOC)
86-
ADD_DEFINITIONS("-DTOKUDB_CHECK_JEMALLOC=${TOKUDB_CHECK_JEMALLOC}")
87-
ENDIF()
88-
8985
macro(set_cflags_if_supported)
9086
foreach(flag ${ARGN})
9187
string(REGEX REPLACE "-" "_" temp_flag ${flag})

storage/tokudb/PerconaFT/buildheader/make_tdb.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ static void print_db_env_struct (void) {
420420
"int (*set_client_pool_threads)(DB_ENV *, uint32_t)",
421421
"int (*set_cachetable_pool_threads)(DB_ENV *, uint32_t)",
422422
"int (*set_checkpoint_pool_threads)(DB_ENV *, uint32_t)",
423+
"void (*set_check_thp)(DB_ENV *, bool new_val)",
424+
"bool (*get_check_thp)(DB_ENV *)",
423425
NULL};
424426

425427
sort_and_dump_fields("db_env", true, extra);

storage/tokudb/PerconaFT/src/ydb-internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ struct __toku_db_env_internal {
132132
int datadir_lockfd;
133133
int logdir_lockfd;
134134
int tmpdir_lockfd;
135+
bool check_thp; // if set check if transparent huge pages are disables
135136
uint64_t (*get_loader_memory_size_callback)(void);
136137
uint64_t default_lock_timeout_msec;
137138
uint64_t (*get_lock_timeout_callback)(uint64_t default_lock_timeout_msec);

storage/tokudb/PerconaFT/src/ydb.cc

Lines changed: 110 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -623,56 +623,80 @@ ydb_recover_log_exists(DB_ENV *env) {
623623
}
624624

625625
// Validate that all required files are present, no side effects.
626-
// Return 0 if all is well, ENOENT if some files are present but at least one is missing,
626+
// Return 0 if all is well, ENOENT if some files are present but at least one is
627+
// missing,
627628
// other non-zero value if some other error occurs.
628629
// Set *valid_newenv if creating a new environment (all files missing).
629-
// (Note, if special dictionaries exist, then they were created transactionally and log should exist.)
630-
static int
631-
validate_env(DB_ENV * env, bool * valid_newenv, bool need_rollback_cachefile) {
630+
// (Note, if special dictionaries exist, then they were created transactionally
631+
// and log should exist.)
632+
static int validate_env(DB_ENV *env,
633+
bool *valid_newenv,
634+
bool need_rollback_cachefile) {
632635
int r;
633-
bool expect_newenv = false; // set true if we expect to create a new env
636+
bool expect_newenv = false; // set true if we expect to create a new env
634637
toku_struct_stat buf;
635-
char* path = NULL;
638+
char *path = NULL;
636639

637640
// Test for persistent environment
638-
path = toku_construct_full_name(2, env->i->dir, toku_product_name_strings.environmentdictionary);
641+
path = toku_construct_full_name(
642+
2, env->i->dir, toku_product_name_strings.environmentdictionary);
639643
assert(path);
640644
r = toku_stat(path, &buf);
641645
if (r == 0) {
642646
expect_newenv = false; // persistent info exists
643-
}
644-
else {
647+
} else {
645648
int stat_errno = get_error_errno();
646649
if (stat_errno == ENOENT) {
647650
expect_newenv = true;
648651
r = 0;
649-
}
650-
else {
651-
r = toku_ydb_do_error(env, stat_errno, "Unable to access persistent environment\n");
652+
} else {
653+
r = toku_ydb_do_error(
654+
env,
655+
stat_errno,
656+
"Unable to access persistent environment [%s] in [%s]\n",
657+
toku_product_name_strings.environmentdictionary,
658+
env->i->dir);
652659
assert(r);
653660
}
654661
}
655662
toku_free(path);
656663

657664
// Test for existence of rollback cachefile if it is expected to exist
658665
if (r == 0 && need_rollback_cachefile) {
659-
path = toku_construct_full_name(2, env->i->dir, toku_product_name_strings.rollback_cachefile);
666+
path = toku_construct_full_name(
667+
2, env->i->dir, toku_product_name_strings.rollback_cachefile);
660668
assert(path);
661669
r = toku_stat(path, &buf);
662-
if (r == 0) {
663-
if (expect_newenv) // rollback cachefile exists, but persistent env is missing
664-
r = toku_ydb_do_error(env, ENOENT, "Persistent environment is missing\n");
665-
}
666-
else {
670+
if (r == 0) {
671+
if (expect_newenv) // rollback cachefile exists, but persistent env
672+
// is missing
673+
r = toku_ydb_do_error(
674+
env,
675+
ENOENT,
676+
"Persistent environment is missing while looking for "
677+
"rollback cachefile [%s] in [%s]\n",
678+
toku_product_name_strings.rollback_cachefile, env->i->dir);
679+
} else {
667680
int stat_errno = get_error_errno();
668681
if (stat_errno == ENOENT) {
669-
if (!expect_newenv) // rollback cachefile is missing but persistent env exists
670-
r = toku_ydb_do_error(env, ENOENT, "rollback cachefile directory is missing\n");
671-
else
672-
r = 0; // both rollback cachefile and persistent env are missing
673-
}
674-
else {
675-
r = toku_ydb_do_error(env, stat_errno, "Unable to access rollback cachefile\n");
682+
if (!expect_newenv) // rollback cachefile is missing but
683+
// persistent env exists
684+
r = toku_ydb_do_error(
685+
env,
686+
ENOENT,
687+
"rollback cachefile [%s] is missing from [%s]\n",
688+
toku_product_name_strings.rollback_cachefile,
689+
env->i->dir);
690+
else
691+
r = 0; // both rollback cachefile and persistent env are
692+
// missing
693+
} else {
694+
r = toku_ydb_do_error(
695+
env,
696+
stat_errno,
697+
"Unable to access rollback cachefile [%s] in [%s]\n",
698+
toku_product_name_strings.rollback_cachefile,
699+
env->i->dir);
676700
assert(r);
677701
}
678702
}
@@ -681,23 +705,41 @@ validate_env(DB_ENV * env, bool * valid_newenv, bool need_rollback_cachefile) {
681705

682706
// Test for fileops directory
683707
if (r == 0) {
684-
path = toku_construct_full_name(2, env->i->dir, toku_product_name_strings.fileopsdirectory);
708+
path = toku_construct_full_name(
709+
2, env->i->dir, toku_product_name_strings.fileopsdirectory);
685710
assert(path);
686711
r = toku_stat(path, &buf);
687-
if (r == 0) {
688-
if (expect_newenv) // fileops directory exists, but persistent env is missing
689-
r = toku_ydb_do_error(env, ENOENT, "Persistent environment is missing\n");
690-
}
691-
else {
712+
if (r == 0) {
713+
if (expect_newenv) // fileops directory exists, but persistent env
714+
// is missing
715+
r = toku_ydb_do_error(
716+
env,
717+
ENOENT,
718+
"Persistent environment is missing while looking for "
719+
"fileops directory [%s] in [%s]\n",
720+
toku_product_name_strings.fileopsdirectory,
721+
env->i->dir);
722+
} else {
692723
int stat_errno = get_error_errno();
693724
if (stat_errno == ENOENT) {
694-
if (!expect_newenv) // fileops directory is missing but persistent env exists
695-
r = toku_ydb_do_error(env, ENOENT, "Fileops directory is missing\n");
696-
else
697-
r = 0; // both fileops directory and persistent env are missing
698-
}
699-
else {
700-
r = toku_ydb_do_error(env, stat_errno, "Unable to access fileops directory\n");
725+
if (!expect_newenv) // fileops directory is missing but
726+
// persistent env exists
727+
r = toku_ydb_do_error(
728+
env,
729+
ENOENT,
730+
"Fileops directory [%s] is missing from [%s]\n",
731+
toku_product_name_strings.fileopsdirectory,
732+
env->i->dir);
733+
else
734+
r = 0; // both fileops directory and persistent env are
735+
// missing
736+
} else {
737+
r = toku_ydb_do_error(
738+
env,
739+
stat_errno,
740+
"Unable to access fileops directory [%s] in [%s]\n",
741+
toku_product_name_strings.fileopsdirectory,
742+
env->i->dir);
701743
assert(r);
702744
}
703745
}
@@ -709,16 +751,26 @@ validate_env(DB_ENV * env, bool * valid_newenv, bool need_rollback_cachefile) {
709751
// if using transactions, test for existence of log
710752
r = ydb_recover_log_exists(env); // return 0 or ENOENT
711753
if (expect_newenv && (r != ENOENT))
712-
r = toku_ydb_do_error(env, ENOENT, "Persistent environment information is missing (but log exists)\n");
754+
r = toku_ydb_do_error(env,
755+
ENOENT,
756+
"Persistent environment information is "
757+
"missing (but log exists) while looking for "
758+
"recovery log files in [%s]\n",
759+
env->i->real_log_dir);
713760
else if (!expect_newenv && r == ENOENT)
714-
r = toku_ydb_do_error(env, ENOENT, "Recovery log is missing (persistent environment information is present)\n");
761+
r = toku_ydb_do_error(env,
762+
ENOENT,
763+
"Recovery log is missing (persistent "
764+
"environment information is present) while "
765+
"looking for recovery log files in [%s]\n",
766+
env->i->real_log_dir);
715767
else
716768
r = 0;
717769
}
718770

719771
if (r == 0)
720772
*valid_newenv = expect_newenv;
721-
else
773+
else
722774
*valid_newenv = false;
723775
return r;
724776
}
@@ -768,7 +820,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
768820
goto cleanup;
769821
}
770822

771-
if (toku_os_huge_pages_enabled()) {
823+
if (env->get_check_thp(env) && toku_os_huge_pages_enabled()) {
772824
r = toku_ydb_do_error(env, TOKUDB_HUGE_PAGES_ENABLED,
773825
"Huge pages are enabled, disable them before continuing\n");
774826
goto cleanup;
@@ -1234,6 +1286,18 @@ env_set_checkpoint_pool_threads(DB_ENV * env, uint32_t threads) {
12341286
return 0;
12351287
}
12361288

1289+
static void
1290+
env_set_check_thp(DB_ENV * env, bool new_val) {
1291+
assert(env);
1292+
env->i->check_thp = new_val;
1293+
}
1294+
1295+
static bool
1296+
env_get_check_thp(DB_ENV * env) {
1297+
assert(env);
1298+
return env->i->check_thp;
1299+
}
1300+
12371301
static int env_dbremove(DB_ENV * env, DB_TXN *txn, const char *fname, const char *dbname, uint32_t flags);
12381302

12391303
static int
@@ -2634,6 +2698,8 @@ toku_env_create(DB_ENV ** envp, uint32_t flags) {
26342698
USENV(get_loader_memory_size);
26352699
USENV(set_killed_callback);
26362700
USENV(do_backtrace);
2701+
USENV(set_check_thp);
2702+
USENV(get_check_thp);
26372703
#undef USENV
26382704

26392705
// unlocked methods
@@ -2659,6 +2725,8 @@ toku_env_create(DB_ENV ** envp, uint32_t flags) {
26592725
env_fs_init(result);
26602726
env_fsync_log_init(result);
26612727

2728+
result->i->check_thp = true;
2729+
26622730
result->i->bt_compare = toku_builtin_compare_fun;
26632731

26642732
r = toku_logger_create(&result->i->logger);

storage/tokudb/hatoku_defines.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
6969
#pragma interface /* gcc class implementation */
7070
#endif
7171

72-
#if !defined(TOKUDB_CHECK_JEMALLOC)
73-
#define TOKUDB_CHECK_JEMALLOC 1
74-
#endif
75-
7672
#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099
7773
// mariadb 10.0
7874
#define TOKU_USE_DB_TYPE_TOKUDB 1

storage/tokudb/hatoku_hton.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ static int tokudb_init_func(void *p) {
266266
db_env = NULL;
267267
tokudb_hton = (handlerton *) p;
268268

269-
#if TOKUDB_CHECK_JEMALLOC
270269
if (tokudb::sysvars::check_jemalloc) {
271270
typedef int (*mallctl_type)(
272271
const char*,
@@ -293,7 +292,6 @@ static int tokudb_init_func(void *p) {
293292
goto error;
294293
}
295294
}
296-
#endif
297295

298296
r = tokudb_set_product_name();
299297
if (r) {
@@ -538,6 +536,8 @@ static int tokudb_init_func(void *p) {
538536
db_env,
539537
tokudb_get_loader_memory_size_callback);
540538

539+
db_env->set_check_thp(db_env, tokudb::sysvars::check_jemalloc);
540+
541541
r = db_env->open(
542542
db_env,
543543
tokudb_home,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0
1+
$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M

storage/tokudb/mysql-test/tokudb/bulk-fetch-gen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def sqlgen_range_query_full(table):
7171
]
7272

7373
# Code generation stats here
74+
print "source include/have_tokudb.inc;"
7475
print "# Tokutek"
7576
print "# Test that bulk fetch works with various table types"
7677
print ""

storage/tokudb/mysql-test/tokudb/locks-blocking-row-locks-testgen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def mysqlgen_cleanup():
5656
timeouts = [0, 500]
5757

5858
# Here's where all the magic happens
59+
print "source include/have_tokudb.inc;"
5960
print "# Tokutek"
6061
print "# Blocking row lock tests;"
6162
print "# Generated by %s on %s;" % (__file__, datetime.date.today())

storage/tokudb/mysql-test/tokudb/replace-ignore-gen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def sqlgen_explain_and_do(query):
2323
def sqlgen_drop_table():
2424
print "drop table t;"
2525

26+
print "source include/have_tokudb.inc;"
2627
print "# Tokutek"
2728
print "# Test that replace into and insert ignore insertions "
2829
print "# work under various index schemas. "

0 commit comments

Comments
 (0)