Skip to content

Commit

Permalink
Merge branch 'merge-tokudb-5.6' into 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Oct 30, 2019
2 parents d03a59c + a3553a1 commit b58c38a
Show file tree
Hide file tree
Showing 19 changed files with 232 additions and 133 deletions.
1 change: 1 addition & 0 deletions storage/tokudb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ 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")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-cpp" DEBUG)

############################################
SET(TOKUDB_DEB_FILES "usr/lib/mysql/plugin/ha_tokudb.so\netc/mysql/conf.d/tokudb.cnf\nusr/bin/tokuftdump" PARENT_SCOPE)
Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FUNCTION(TOKU_GET_DEPENDEND_OS_LIBS target result)
IF(deps)
FOREACH(lib ${deps})
# Filter out keywords for used for debug vs optimized builds
IF(NOT lib MATCHES "general" AND NOT lib MATCHES "debug" AND NOT lib MATCHES "optimized")
IF(TARGET ${lib})
GET_TARGET_PROPERTY(lib_location ${lib} LOCATION)
IF(NOT lib_location)
SET(ret ${ret} ${lib})
Expand Down
34 changes: 0 additions & 34 deletions storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
Original file line number Diff line number Diff line change
@@ -1,39 +1,5 @@
include(ExternalProject)

if (CMAKE_PROJECT_NAME STREQUAL TokuDB)
## add jemalloc with an external project
set(JEMALLOC_SOURCE_DIR "${TokuDB_SOURCE_DIR}/third_party/jemalloc" CACHE FILEPATH "Where to find jemalloc sources.")
if (EXISTS "${JEMALLOC_SOURCE_DIR}/configure")
set(jemalloc_configure_opts "CC=${CMAKE_C_COMPILER}" "--with-jemalloc-prefix=" "--with-private-namespace=tokudb_jemalloc_internal_" "--enable-cc-silence")
option(JEMALLOC_DEBUG "Build jemalloc with --enable-debug." OFF)
if (JEMALLOC_DEBUG)
list(APPEND jemalloc_configure_opts --enable-debug)
endif ()
ExternalProject_Add(build_jemalloc
PREFIX jemalloc
SOURCE_DIR "${JEMALLOC_SOURCE_DIR}"
CONFIGURE_COMMAND
"${JEMALLOC_SOURCE_DIR}/configure" ${jemalloc_configure_opts}
"--prefix=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc"
)

add_library(jemalloc STATIC IMPORTED GLOBAL)
set_target_properties(jemalloc PROPERTIES IMPORTED_LOCATION
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc_pic.a")
add_dependencies(jemalloc build_jemalloc)
add_library(jemalloc_nopic STATIC IMPORTED GLOBAL)
set_target_properties(jemalloc_nopic PROPERTIES IMPORTED_LOCATION
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc.a")
add_dependencies(jemalloc_nopic build_jemalloc)

# detect when we are being built as a subproject
if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib" DESTINATION .
COMPONENT tokukv_libs_extra)
endif ()
endif ()
endif ()

## add lzma with an external project
set(xz_configure_opts --with-pic --enable-static)
if (APPLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
ninja build_jemalloc build_lzma build_snappy
ninja build_lzma build_snappy
popd
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
ninja build_jemalloc build_lzma build_snappy
ninja build_lzma build_snappy
popd
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
ninja build_jemalloc build_lzma build_snappy
ninja build_lzma build_snappy
popd
fi

Expand Down
3 changes: 2 additions & 1 deletion storage/tokudb/ha_tokudb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,8 @@ static inline int tokudb_generate_row(DB* dest_db,
}

buff = (uchar *)dest_key->data;
assert_always(buff != NULL && max_key_len > 0);
assert_always(buff != nullptr);
assert_always(max_key_len > 0);
} else {
assert_unreachable();
}
Expand Down
3 changes: 2 additions & 1 deletion storage/tokudb/ha_tokudb.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ inline void TOKUDB_SHARE::init_cardinality_counts(

assert_debug(_mutex.is_owned_by_me());
// can not change number of keys live
assert_always(_rec_per_key == NULL && _rec_per_keys == 0);
assert_always(_rec_per_key == nullptr);
assert_always(_rec_per_keys == 0);
_rec_per_keys = rec_per_keys;
_rec_per_key = rec_per_key;
}
Expand Down
8 changes: 4 additions & 4 deletions storage/tokudb/hatoku_cmp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,8 @@ static inline int tokudb_compare_two_hidden_keys(
const void* saved_key_data,
const uint32_t saved_key_size
) {
assert_always(
(new_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH) &&
(saved_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH));
assert_always(new_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH);
assert_always(saved_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH);
ulonglong a = hpk_char_to_num((uchar *) new_key_data);
ulonglong b = hpk_char_to_num((uchar *) saved_key_data);
return a < b ? -1 : (a > b ? 1 : 0);
Expand Down Expand Up @@ -2534,7 +2533,8 @@ static uint32_t create_toku_secondary_key_pack_descriptor (
bool is_col_in_pk = false;

if (bitmap_is_set(&kc_info->key_filters[pk_index],field_index)) {
assert_always(!has_hpk && prim_key != NULL);
assert_always(!has_hpk);
assert_always(prim_key != nullptr);
is_col_in_pk = true;
}
else {
Expand Down
162 changes: 118 additions & 44 deletions storage/tokudb/tests/math_test_int.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ static void test_int8() {
assert(over);
else if (m < -max)
assert(over);
else
assert(!over && n == m);
else {
assert(!over);
assert(n == m);
}
n = int_sub(x, y, 8, &over);
m = x - y;
if (m > max-1)
assert(over);
else if (m < -max)
assert(over);
else
assert(!over && n == m);
else {
assert(!over);
asset(n == m);
}
}
}
}
Expand All @@ -82,16 +86,20 @@ static void test_int16() {
assert(over);
else if (m < -max)
assert(over);
else
assert(!over && n == m);
else {
assert(!over);
assert(n == m);
}
n = int_sub(x, y, 16, &over);
m = x - y;
if (m > max-1)
assert(over);
else if (m < -max)
assert(over);
else
assert(!over && n == m);
else {
assert(!over);
assert(n == m);
}
}
}
}
Expand All @@ -104,20 +112,42 @@ static void test_int24() {

s = int_add(1, (1ULL<<23)-1, 24, &over); assert(over);
s = int_add((1ULL<<23)-1, 1, 24, &over); assert(over);
s = int_sub(-1, (1ULL<<23), 24, &over); assert(!over && s == (1ULL<<23)-1);
s = int_sub(-1, (1ULL<<23), 24, &over);
assert(!over);
assert(s == (1ULL<<23)-1);
s = int_sub((1ULL<<23), 1, 24, &over); assert(over);

s = int_add(0, 0, 24, &over); assert(!over && s == 0);
s = int_sub(0, 0, 24, &over); assert(!over && s == 0);
s = int_add(0, -1, 24, &over); assert(!over && s == -1);
s = int_sub(0, 1, 24, &over); assert(!over && s == -1);
s = int_add(0, (1ULL<<23), 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23));
s = int_sub(0, (1ULL<<23)-1, 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23)+1);

s = int_add(-1, 0, 24, &over); assert(!over && s == -1);
s = int_add(-1, 1, 24, &over); assert(!over && s == 0);
s = int_sub(-1, -1, 24, &over); assert(!over && s == 0);
s = int_sub(-1, (1ULL<<23)-1, 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23));
s = int_add(0, 0, 24, &over);
assert(!over);
assert(s == 0);
s = int_sub(0, 0, 24, &over);
assert(!over);
assert(s == 0);
s = int_add(0, -1, 24, &over);
assert(!over);
assert(s == -1);
s = int_sub(0, 1, 24, &over);
assert(!over);
assert(s == -1);
s = int_add(0, (1ULL<<23), 24, &over);
assert(!over);
assert((s & ((1ULL<<24)-1)) == (1ULL<<23));
s = int_sub(0, (1ULL<<23)-1, 24, &over);
assert(!over);
assert((s & ((1ULL<<24)-1)) == (1ULL<<23)+1);

s = int_add(-1, 0, 24, &over);
assert(!over);
assert(s == -1);
s = int_add(-1, 1, 24, &over);
assert(!over);
assert(s == 0);
s = int_sub(-1, -1, 24, &over);
assert(!over);
assert(s == 0);
s = int_sub(-1, (1ULL<<23)-1, 24, &over);
assert(!over);
assert((s & ((1ULL<<24)-1)) == (1ULL<<23));
}

static void test_int32() {
Expand All @@ -128,20 +158,42 @@ static void test_int32() {

s = int_add(1, (1ULL<<31)-1, 32, &over); assert(over);
s = int_add((1ULL<<31)-1, 1, 32, &over); assert(over);
s = int_sub(-1, (1ULL<<31), 32, &over); assert(s == (1ULL<<31)-1 && !over);
s = int_sub(-1, (1ULL<<31), 32, &over);
assert(s == (1ULL<<31)-1);
assert(!over);
s = int_sub((1ULL<<31), 1, 32, &over); assert(over);

s = int_add(0, 0, 32, &over); assert(s == 0 && !over);
s = int_sub(0, 0, 32, &over); assert(s == 0 && !over);
s = int_add(0, -1, 32, &over); assert(s == -1 && !over);
s = int_sub(0, 1, 32, &over); assert(s == -1 && !over);
s = int_add(0, (1ULL<<31), 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31) && !over);
s = int_sub(0, (1ULL<<31)-1, 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31)+1 && !over);

s = int_add(-1, 0, 32, &over); assert(s == -1 && !over);
s = int_add(-1, 1, 32, &over); assert(s == 0 && !over);
s = int_sub(-1, -1, 32, &over); assert(s == 0 && !over);
s = int_sub(-1, (1ULL<<31)-1, 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31) && !over);
s = int_add(0, 0, 32, &over);
assert(s == 0);
assert(!over);
s = int_sub(0, 0, 32, &over);
assert(s == 0);
assert(!over);
s = int_add(0, -1, 32, &over);
assert(s == -1);
assert(!over);
s = int_sub(0, 1, 32, &over);
assert(s == -1);
assert(!over);
s = int_add(0, (1ULL<<31), 32, &over);
assert((s & ((1ULL<<32)-1)) == (1ULL<<31));
assert(!over);
s = int_sub(0, (1ULL<<31)-1, 32, &over);
assert((s & ((1ULL<<32)-1)) == (1ULL<<31)+1);
assert(!over);

s = int_add(-1, 0, 32, &over);
assert(s == -1);
assert(!over);
s = int_add(-1, 1, 32, &over);
assert(s == 0);
assert(!over);
s = int_sub(-1, -1, 32, &over);
assert(s == 0);
assert(!over);
s = int_sub(-1, (1ULL<<31)-1, 32, &over);
assert((s & ((1ULL<<32)-1)) == (1ULL<<31));
assert(!over);
}

static void test_int64() {
Expand All @@ -152,20 +204,42 @@ static void test_int64() {

s = int_add(1, (1ULL<<63)-1, 64, &over); assert(over);
s = int_add((1ULL<<63)-1, 1, 64, &over); assert(over);
s = int_sub(-1, (1ULL<<63), 64, &over); assert(s == (1ULL<<63)-1 && !over);
s = int_sub(-1, (1ULL<<63), 64, &over);
assert(s == (1ULL<<63)-1);
assert(!over);
s = int_sub((1ULL<<63), 1, 64, &over); assert(over);

s = int_add(0, 0, 64, &over); assert(s == 0 && !over);
s = int_sub(0, 0, 64, &over); assert(s == 0 && !over);
s = int_add(0, -1, 64, &over); assert(s == -1 && !over);
s = int_sub(0, 1, 64, &over); assert(s == -1 && !over);
s = int_add(0, (1ULL<<63), 64, &over); assert(s == (int64_t)(1ULL<<63) && !over);
s = int_sub(0, (1ULL<<63)-1, 64, &over); assert(s == (int64_t)((1ULL<<63)+1) && !over);

s = int_add(-1, 0, 64, &over); assert(s == -1 && !over);
s = int_add(-1, 1, 64, &over); assert(s == 0 && !over);
s = int_sub(-1, -1, 64, &over); assert(s == 0 && !over);
s = int_sub(-1, (1ULL<<63)-1, 64, &over); assert(s == (int64_t)(1ULL<<63) && !over);
s = int_add(0, 0, 64, &over);
assert(s == 0);
assert(!over);
s = int_sub(0, 0, 64, &over);
assert(s == 0);
assert(!over);
s = int_add(0, -1, 64, &over);
assert(s == -1);
assert(!over);
s = int_sub(0, 1, 64, &over);
assert(s == -1);
assert(!over);
s = int_add(0, (1ULL<<63), 64, &over);
assert(s == (int64_t)(1ULL<<63));
assert(!over);
s = int_sub(0, (1ULL<<63)-1, 64, &over);
assert(s == (int64_t)((1ULL<<63)+1));
assert(!over);

s = int_add(-1, 0, 64, &over);
assert(s == -1);
assert(!over);
s = int_add(-1, 1, 64, &over);
assert(s == 0);
assert(!over);
s = int_sub(-1, -1, 64, &over);
assert(s == 0);
assert(!over);
s = int_sub(-1, (1ULL<<63)-1, 64, &over);
assert(s == (int64_t)(1ULL<<63));
assert(!over);
}

static void test_int_sign(uint length_bits) {
Expand Down
Loading

0 comments on commit b58c38a

Please sign in to comment.