diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-10-30 11:15:05 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-10-30 11:15:05 +0100 |
commit | a3553a1387315f69551793b9baec4d8f91f51fcf (patch) | |
tree | 285920e7a4c2320a2b4a7f7af4cc3f26cfb2b7c0 /storage/tokudb | |
parent | 24a0d7c5070b53d2495d7ced459cc9a68c43408f (diff) | |
download | mariadb-git-a3553a1387315f69551793b9baec4d8f91f51fcf.tar.gz |
5.6.45-86.1
Diffstat (limited to 'storage/tokudb')
19 files changed, 231 insertions, 134 deletions
diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake index e1da095fc00..f2462afdb45 100644 --- a/storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake +++ b/storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake @@ -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}) diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake index b707f368431..b312111a3a2 100644 --- a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake +++ b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake @@ -1,39 +1,5 @@ include(ExternalProject) -if (NOT DEFINED LIBJEMALLOC) - ## 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) diff --git a/storage/tokudb/PerconaFT/portability/CMakeLists.txt b/storage/tokudb/PerconaFT/portability/CMakeLists.txt index f24cf84a829..f7a731bfb5a 100644 --- a/storage/tokudb/PerconaFT/portability/CMakeLists.txt +++ b/storage/tokudb/PerconaFT/portability/CMakeLists.txt @@ -20,7 +20,6 @@ target_link_libraries(${LIBTOKUPORTABILITY} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT add_library(tokuportability_static_conv STATIC ${tokuportability_srcs}) set_target_properties(tokuportability_static_conv PROPERTIES POSITION_INDEPENDENT_CODE ON) -add_dependencies(tokuportability_static_conv build_jemalloc) set(tokuportability_source_libs tokuportability_static_conv ${LIBJEMALLOC} ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS}) toku_merge_static_libs(${LIBTOKUPORTABILITY}_static ${LIBTOKUPORTABILITY}_static "${tokuportability_source_libs}") diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash index cd5743cddf2..3daa87ce03c 100755 --- a/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash +++ b/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash @@ -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 diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash index 3c688581385..1ef819d8e37 100755 --- a/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash +++ b/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash @@ -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 diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash index 80938bad8a6..c1039a0b28f 100755 --- a/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash +++ b/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash @@ -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 diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index 251b8183ae5..32f3e77cf13 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -1075,7 +1075,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(); } diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h index 6257583e754..1d1ea92868d 100644 --- a/storage/tokudb/ha_tokudb.h +++ b/storage/tokudb/ha_tokudb.h @@ -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; } diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc index f064a125649..16393aa43b6 100644 --- a/storage/tokudb/hatoku_cmp.cc +++ b/storage/tokudb/hatoku_cmp.cc @@ -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); @@ -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 { diff --git a/storage/tokudb/tests/math_test_int.cc b/storage/tokudb/tests/math_test_int.cc index 10085dbd704..3313bdf5895 100644 --- a/storage/tokudb/tests/math_test_int.cc +++ b/storage/tokudb/tests/math_test_int.cc @@ -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); + } } } } @@ -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); + } } } } @@ -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() { @@ -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() { @@ -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) { diff --git a/storage/tokudb/tests/math_test_uint.cc b/storage/tokudb/tests/math_test_uint.cc index 2fc8de8e093..2c5c9261c89 100644 --- a/storage/tokudb/tests/math_test_uint.cc +++ b/storage/tokudb/tests/math_test_uint.cc @@ -51,14 +51,18 @@ static void test_uint8() { m = x + y; if (m > (1ULL<<8)-1) assert(over); - else - assert(!over && n == (m % 256)); + else { + assert(!over); + assert(n == (m % 256)); + } n = uint_sub(x, y, 8, &over); m = x - y; if (m > x) assert(over); - else - assert(!over && n == (m % 256)); + else { + assert(!over); + assert(n == (m % 256)); + } } } } @@ -75,14 +79,18 @@ static void test_uint16() { m = x + y; if (m > (1ULL<<16)-1) assert(over); - else - assert(!over && n == (m % (1ULL<<16))); + else { + assert(!over); + assert(n == (m % (1ULL<<16))); + } n = uint_sub(x, y, 16, &over); m = x - y; if (m > x) assert(over); - else - assert(!over && n == (m % (1ULL<<16))); + else { + assert(!over); + assert(n == (m % (1ULL<<16))); + } } } } @@ -95,13 +103,23 @@ static void test_uint24() { s = uint_add((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); assert(over); s = uint_add((1ULL<<24)-1, 1, 24, &over); assert(over); - s = uint_add((1ULL<<24)-1, 0, 24, &over); assert(!over && s == (1ULL<<24)-1); - s = uint_add(0, 1, 24, &over); assert(!over && s == 1); - s = uint_add(0, 0, 24, &over); assert(!over && s == 0); - s = uint_sub(0, 0, 24, &over); assert(!over && s == 0); + s = uint_add((1ULL<<24)-1, 0, 24, &over); + assert(!over); + assert(s == (1ULL<<24)-1); + s = uint_add(0, 1, 24, &over); + assert(!over); + assert(s == 1); + s = uint_add(0, 0, 24, &over); + assert(!over); + assert(s == 0); + s = uint_sub(0, 0, 24, &over); + assert(!over); + assert(s == 0); s = uint_sub(0, 1, 24, &over); assert(over); s = uint_sub(0, (1ULL<<24)-1, 24, &over); assert(over); - s = uint_sub((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); assert(!over && s == 0); + s = uint_sub((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); + assert(!over); + assert(s == 0); } static void test_uint32() { @@ -112,13 +130,23 @@ static void test_uint32() { s = uint_add((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); assert(over); s = uint_add((1ULL<<32)-1, 1, 32, &over); assert(over); - s = uint_add((1ULL<<32)-1, 0, 32, &over); assert(!over && s == (1ULL<<32)-1); - s = uint_add(0, 1, 32, &over); assert(!over && s == 1); - s = uint_add(0, 0, 32, &over); assert(!over && s == 0); - s = uint_sub(0, 0, 32, &over); assert(!over && s == 0); + s = uint_add((1ULL<<32)-1, 0, 32, &over); + assert(!over); + assert(s == (1ULL<<32)-1); + s = uint_add(0, 1, 32, &over); + assert(!over); + assert(s == 1); + s = uint_add(0, 0, 32, &over); + assert(!over); + assert(s == 0); + s = uint_sub(0, 0, 32, &over); + assert(!over); + assert(s == 0); s = uint_sub(0, 1, 32, &over); assert(over); s = uint_sub(0, (1ULL<<32)-1, 32, &over); assert(over); - s = uint_sub((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); assert(!over && s == 0); + s = uint_sub((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); + assert(!over); + assert(s == 0); } static void test_uint64() { @@ -129,13 +157,23 @@ static void test_uint64() { s = uint_add(~0ULL, ~0ULL, 64, &over); assert(over); s = uint_add(~0ULL, 1, 64, &over); assert(over); - s = uint_add(~0ULL, 0, 64, &over); assert(!over && s == ~0ULL); - s = uint_add(0, 1, 64, &over); assert(!over && s == 1); - s = uint_add(0, 0, 64, &over); assert(!over && s == 0); - s = uint_sub(0, 0, 64, &over); assert(!over && s == 0); + s = uint_add(~0ULL, 0, 64, &over); + assert(!over); + assert(s == ~0ULL); + s = uint_add(0, 1, 64, &over); + assert(!over); + assert(s == 1); + s = uint_add(0, 0, 64, &over); + assert(!over); + assert(s == 0); + s = uint_sub(0, 0, 64, &over); + assert(!over); + assert(s == 0); s = uint_sub(0, 1, 64, &over); assert(over); s = uint_sub(0, ~0ULL, 64, &over); assert(over); - s = uint_sub(~0ULL, ~0ULL, 64, &over); assert(!over && s == 0); + s = uint_sub(~0ULL, ~0ULL, 64, &over); + assert(!over); + assert(s == 0); } int main() { diff --git a/storage/tokudb/tests/sint_test.cc b/storage/tokudb/tests/sint_test.cc index 9078ae87281..7823ee5a692 100644 --- a/storage/tokudb/tests/sint_test.cc +++ b/storage/tokudb/tests/sint_test.cc @@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include <stdint.h> #include <inttypes.h> #include <stdlib.h> -#include <assert.h> #include <sys/types.h> #include <tokudb_math.h> diff --git a/storage/tokudb/tests/tokudb_buffer_test.cc b/storage/tokudb/tests/tokudb_buffer_test.cc index a786cdf4592..7e296790d39 100644 --- a/storage/tokudb/tests/tokudb_buffer_test.cc +++ b/storage/tokudb/tests/tokudb_buffer_test.cc @@ -32,9 +32,13 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. static void test_null() { tokudb::buffer b; - assert(b.data() == NULL && b.size() == 0 && b.limit() == 0); + assert(b.data() == nullptr); + assert(b.size() == 0); + assert(b.limit() == 0); b.append(NULL, 0); - assert(b.data() == NULL && b.size() == 0 && b.limit() == 0); + assert(b.data() == nullptr); + assert(b.size() == 0); + assert(b.limit() == 0); } static void append_az(tokudb::buffer &b) { @@ -132,7 +136,8 @@ static void test_replace_grow() { } for (size_t i = 0; i < a.size()/2; i++) { unsigned char *cp = (unsigned char *) a.data() + 2*i; - assert(cp[0] == 'a'+i && cp[1] == 'a'+i); + assert(cp[0] == 'a'+i); + assert(cp[1] == 'a'+i); } } diff --git a/storage/tokudb/tests/uint_test.cc b/storage/tokudb/tests/uint_test.cc index b2c653b8fdd..e3aa1a6fe2f 100644 --- a/storage/tokudb/tests/uint_test.cc +++ b/storage/tokudb/tests/uint_test.cc @@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include <stdint.h> #include <inttypes.h> #include <stdlib.h> -#include <assert.h> #include <sys/types.h> #include <tokudb_math.h> diff --git a/storage/tokudb/tests/vlq_test.cc b/storage/tokudb/tests/vlq_test.cc index 80d797339b4..12b222f06c1 100644 --- a/storage/tokudb/tests/vlq_test.cc +++ b/storage/tokudb/tests/vlq_test.cc @@ -52,7 +52,8 @@ static void test_vlq_uint32_error(void) { in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, 1); assert(in_s == 0); in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, 2); - assert(in_s == 2 && n == 128); + assert(in_s == 2); + assert(n == 128); } static void test_80000000(void) { @@ -63,7 +64,8 @@ static void test_80000000(void) { out_s = tokudb::vlq_encode_ui<uint64_t>(v, b, sizeof b); assert(out_s == 5); in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 5 && n == v); + assert(in_s == 5); + assert(n == v); } static void test_100000000(void) { @@ -74,7 +76,8 @@ static void test_100000000(void) { out_s = tokudb::vlq_encode_ui<uint64_t>(v, b, sizeof b); assert(out_s == 5); in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 5 && n == v); + assert(in_s == 5); + assert(n == v); } int main(void) { diff --git a/storage/tokudb/tests/vlq_test_uint32.cc b/storage/tokudb/tests/vlq_test_uint32.cc index c5661b33ab5..3cc8af771a9 100644 --- a/storage/tokudb/tests/vlq_test_uint32.cc +++ b/storage/tokudb/tests/vlq_test_uint32.cc @@ -44,7 +44,8 @@ static void test_vlq_uint32(void) { assert(out_s == 1); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 1 && n == v); + assert(in_s == 1); + assert(n == v); } printf("%u\n", 1<<7); @@ -54,7 +55,8 @@ static void test_vlq_uint32(void) { assert(out_s == 2); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 2 && n == v); + assert(in_s == 2); + assert(n == v); } printf("%u\n", 1<<14); @@ -64,7 +66,8 @@ static void test_vlq_uint32(void) { assert(out_s == 3); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 3 && n == v); + assert(in_s == 3); + assert(n == v); } printf("%u\n", 1<<21); @@ -74,7 +77,8 @@ static void test_vlq_uint32(void) { assert(out_s == 4); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 4 && n == v); + assert(in_s == 4); + assert(n == v); } printf("%u\n", 1<<28); @@ -84,7 +88,8 @@ static void test_vlq_uint32(void) { assert(out_s == 5); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 5 && n == v); + assert(in_s == 5); + assert(n == v); } } diff --git a/storage/tokudb/tests/vlq_test_uint64.cc b/storage/tokudb/tests/vlq_test_uint64.cc index a626db69487..697c597756c 100644 --- a/storage/tokudb/tests/vlq_test_uint64.cc +++ b/storage/tokudb/tests/vlq_test_uint64.cc @@ -46,7 +46,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 1); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 1 && n == v); + assert(in_s == 1); + assert(n == v); } printf("%u\n", 1<<7); @@ -56,7 +57,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 2); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 2 && n == v); + assert(in_s == 2); + assert(n == v); } printf("%u\n", 1<<14); @@ -66,7 +68,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 3); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 3 && n == v); + assert(in_s == 3); + assert(n == v); } printf("%u\n", 1<<21); @@ -76,7 +79,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 4); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 4 && n == v); + assert(in_s == 4); + assert(n == v); } printf("%u\n", 1<<28); @@ -90,7 +94,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 5); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 5 && n == v); + assert(in_s == 5); + assert(n == v); } } diff --git a/storage/tokudb/tokudb_buffer.h b/storage/tokudb/tokudb_buffer.h index 022f1b49643..1605543c378 100644 --- a/storage/tokudb/tokudb_buffer.h +++ b/storage/tokudb/tokudb_buffer.h @@ -134,8 +134,8 @@ public: char* data_offset = (char*)m_data + offset; if (new_s != old_s) { size_t n = m_size - (offset + old_s); - assert_always( - offset + new_s + n <= m_limit && offset + old_s + n <= m_limit); + assert_always(offset + new_s + n <= m_limit); + assert_always(offset + old_s + n <= m_limit); memmove(data_offset + new_s, data_offset + old_s, n); if (new_s > old_s) m_size += new_s - old_s; diff --git a/storage/tokudb/tokudb_math.h b/storage/tokudb/tokudb_math.h index 0338bf3871e..99cebd5b1d1 100644 --- a/storage/tokudb/tokudb_math.h +++ b/storage/tokudb/tokudb_math.h @@ -59,7 +59,8 @@ TOKUDB_UNUSED(static uint64_t uint_add( bool* over)); static uint64_t uint_add(uint64_t x, uint64_t y, uint length_bits, bool *over) { uint64_t mask = uint_mask(length_bits); - assert_always((x & ~mask) == 0 && (y & ~mask) == 0); + assert_always((x & ~mask) == 0); + assert_always((y & ~mask) == 0); uint64_t s = (x + y) & mask; *over = s < x; // check for overflow return s; @@ -75,7 +76,8 @@ TOKUDB_UNUSED(static uint64_t uint_sub( bool* over)); static uint64_t uint_sub(uint64_t x, uint64_t y, uint length_bits, bool *over) { uint64_t mask = uint_mask(length_bits); - assert_always((x & ~mask) == 0 && (y & ~mask) == 0); + assert_always((x & ~mask) == 0); + assert_always((y & ~mask) == 0); uint64_t s = (x - y) & mask; *over = s > x; // check for overflow return s; |