diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-09-14 08:47:22 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-09-14 08:47:22 +0200 |
commit | 28f08d3753eb10a1393a63e6c581d43aad9f93b9 (patch) | |
tree | 86c9df8c3fb6d4ebd99d431697c84f06ef242989 /storage/tokudb/PerconaFT | |
parent | 38665893087e20c3ad65d5b0e227a75185a4865e (diff) | |
parent | f1bcfbb4373e40dda2c18c137f76fc6ff32e1a45 (diff) | |
download | mariadb-git-28f08d3753eb10a1393a63e6c581d43aad9f93b9.tar.gz |
Merge branch '10.1' into 10.2
Diffstat (limited to 'storage/tokudb/PerconaFT')
85 files changed, 704 insertions, 344 deletions
diff --git a/storage/tokudb/PerconaFT/CMakeLists.txt b/storage/tokudb/PerconaFT/CMakeLists.txt index 90ad3f2b1af..672e4b107f9 100644 --- a/storage/tokudb/PerconaFT/CMakeLists.txt +++ b/storage/tokudb/PerconaFT/CMakeLists.txt @@ -10,14 +10,12 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") # See: https://jira.percona.com/browse/TDB-93 -IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-address-of-packed-member") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-address-of-packed-member") -ENDIF() +MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-address-of-packed-member") # detect when we are being built as a subproject if (DEFINED MYSQL_PROJECT_NAME_DOCSTRING) - add_definitions( -DMYSQL_TOKUDB_ENGINE=1) + add_definitions(-DMYSQL_TOKUDB_ENGINE=1) + add_definitions(-DMYSQL_VERSION_ID=${MYSQL_VERSION_ID}) # Extended PFS instrumentation: # -DTOKU_PFS_MUTEX_EXTENDED_CACHETABLEMMUTEX=1 if (WITH_PERFSCHEMA_STORAGE_ENGINE) diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake index 50d35ee4906..8f65895cc9c 100644 --- a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake +++ b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake @@ -107,6 +107,9 @@ set_cflags_if_supported( -Wno-error=strict-overflow ) +# new flag sets in MySQL 8.0 seem to explicitly disable this +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") + ## set extra debugging flags and preprocessor definitions set(CMAKE_C_FLAGS_DEBUG "-g3 -O0 ${CMAKE_C_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0 ${CMAKE_CXX_FLAGS_DEBUG}") diff --git a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc index b72edc8d231..5467bef43b4 100644 --- a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc +++ b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc @@ -1291,7 +1291,6 @@ int toku_cachetable_get_and_pin ( CACHEKEY key, uint32_t fullhash, void**value, - long *sizep, CACHETABLE_WRITE_CALLBACK write_callback, CACHETABLE_FETCH_CALLBACK fetch_callback, CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback, @@ -1312,7 +1311,6 @@ int toku_cachetable_get_and_pin ( key, fullhash, value, - sizep, write_callback, fetch_callback, pf_req_callback, @@ -1560,7 +1558,6 @@ int toku_cachetable_get_and_pin_with_dep_pairs ( CACHEKEY key, uint32_t fullhash, void**value, - long *sizep, CACHETABLE_WRITE_CALLBACK write_callback, CACHETABLE_FETCH_CALLBACK fetch_callback, CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback, @@ -1744,7 +1741,6 @@ beginning: } got_value: *value = p->value_data; - if (sizep) *sizep = p->attr.size; return 0; } @@ -1857,6 +1853,22 @@ int toku_cachetable_maybe_get_and_pin_clean (CACHEFILE cachefile, CACHEKEY key, return r; } +int toku_cachetable_get_attr (CACHEFILE cachefile, CACHEKEY key, uint32_t fullhash, PAIR_ATTR *attr) { + CACHETABLE ct = cachefile->cachetable; + int r; + ct->list.pair_lock_by_fullhash(fullhash); + PAIR p = ct->list.find_pair(cachefile, key, fullhash); + if (p) { + // Assumes pair lock and full hash lock are the same mutex + *attr = p->attr; + r = 0; + } else { + r = -1; + } + ct->list.pair_unlock_by_fullhash(fullhash); + return r; +} + // // internal function to unpin a PAIR. // As of Clayface, this is may be called in two ways: @@ -1998,7 +2010,6 @@ int toku_cachetable_get_and_pin_nonblocking( CACHEKEY key, uint32_t fullhash, void**value, - long* UU(sizep), CACHETABLE_WRITE_CALLBACK write_callback, CACHETABLE_FETCH_CALLBACK fetch_callback, CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.h b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.h index b9851f33e20..c5c21b49f94 100644 --- a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.h +++ b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.h @@ -352,7 +352,6 @@ int toku_cachetable_get_and_pin_with_dep_pairs ( CACHEKEY key, uint32_t fullhash, void**value, - long *sizep, CACHETABLE_WRITE_CALLBACK write_callback, CACHETABLE_FETCH_CALLBACK fetch_callback, CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback, @@ -374,7 +373,6 @@ int toku_cachetable_get_and_pin ( CACHEKEY key, uint32_t fullhash, void**value, - long *sizep, CACHETABLE_WRITE_CALLBACK write_callback, CACHETABLE_FETCH_CALLBACK fetch_callback, CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback, @@ -408,7 +406,6 @@ int toku_cachetable_get_and_pin_nonblocking ( CACHEKEY key, uint32_t fullhash, void**value, - long *sizep, CACHETABLE_WRITE_CALLBACK write_callback, CACHETABLE_FETCH_CALLBACK fetch_callback, CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback, @@ -428,6 +425,11 @@ int toku_cachetable_maybe_get_and_pin (CACHEFILE, CACHEKEY, uint32_t /*fullhash* int toku_cachetable_maybe_get_and_pin_clean (CACHEFILE, CACHEKEY, uint32_t /*fullhash*/, pair_lock_type, void**); // Effect: Like maybe get and pin, but may pin a clean pair. +int toku_cachetable_get_attr(CACHEFILE, CACHEKEY, uint32_t /*fullhash*/, PAIR_ATTR *); +// Effect: get the attributes for cachekey +// Returns: 0 if success, non-zero if cachekey is not cached +// Notes: this function exists for tests + int toku_cachetable_unpin(CACHEFILE, PAIR, enum cachetable_dirty dirty, PAIR_ATTR size); // Effect: Unpin a memory object // Modifies: If the memory object is in the cachetable, then OR the dirty flag, diff --git a/storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc b/storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc index 3623847c6f8..6b6ff1e323f 100644 --- a/storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc +++ b/storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc @@ -179,7 +179,6 @@ toku_pin_ftnode_for_query( blocknum, fullhash, &node_v, - NULL, get_write_callbacks_for_node(ft_handle->ft), toku_ftnode_fetch_callback, toku_ftnode_pf_req_callback, @@ -210,7 +209,6 @@ toku_pin_ftnode_for_query( blocknum, fullhash, &node_v, - NULL, get_write_callbacks_for_node(ft_handle->ft), toku_ftnode_fetch_callback, toku_ftnode_pf_req_callback, @@ -290,7 +288,6 @@ toku_pin_ftnode_with_dep_nodes( blocknum, fullhash, &node_v, - NULL, get_write_callbacks_for_node(ft), toku_ftnode_fetch_callback, toku_ftnode_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/ft-test-helpers.cc b/storage/tokudb/PerconaFT/ft/ft-test-helpers.cc index 7cd896a5bf4..a82d8a80718 100644 --- a/storage/tokudb/PerconaFT/ft/ft-test-helpers.cc +++ b/storage/tokudb/PerconaFT/ft/ft-test-helpers.cc @@ -131,7 +131,6 @@ int toku_testsetup_get_sersize(FT_HANDLE ft_handle, BLOCKNUM diskoff) // Return ft_handle->ft->cf, diskoff, toku_cachetable_hash(ft_handle->ft->cf, diskoff), &node_v, - NULL, get_write_callbacks_for_node(ft_handle->ft), toku_ftnode_fetch_callback, toku_ftnode_pf_req_callback, @@ -159,7 +158,6 @@ int toku_testsetup_insert_to_leaf (FT_HANDLE ft_handle, BLOCKNUM blocknum, const blocknum, toku_cachetable_hash(ft_handle->ft->cf, blocknum), &node_v, - NULL, get_write_callbacks_for_node(ft_handle->ft), toku_ftnode_fetch_callback, toku_ftnode_pf_req_callback, @@ -237,7 +235,6 @@ int toku_testsetup_insert_to_nonleaf (FT_HANDLE ft_handle, BLOCKNUM blocknum, en blocknum, toku_cachetable_hash(ft_handle->ft->cf, blocknum), &node_v, - NULL, get_write_callbacks_for_node(ft_handle->ft), toku_ftnode_fetch_callback, toku_ftnode_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/ft.h b/storage/tokudb/PerconaFT/ft/ft.h index 7a3c4fa783c..ff0b63b2b12 100644 --- a/storage/tokudb/PerconaFT/ft/ft.h +++ b/storage/tokudb/PerconaFT/ft/ft.h @@ -44,6 +44,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "ft/ft-ops.h" #include "ft/logger/log.h" #include "util/dbt.h" +#ifndef TOKU_MYSQL_WITH_PFS +#include <my_global.h> +#endif typedef struct ft *FT; typedef struct ft_options *FT_OPTIONS; diff --git a/storage/tokudb/PerconaFT/ft/node.cc b/storage/tokudb/PerconaFT/ft/node.cc index ddc850632bf..8db2f895033 100644 --- a/storage/tokudb/PerconaFT/ft/node.cc +++ b/storage/tokudb/PerconaFT/ft/node.cc @@ -157,6 +157,8 @@ void toku_evict_bn_from_memory(FTNODE node, int childnum, FT ft) { assert(!node->dirty); BASEMENTNODE bn = BLB(node, childnum); toku_ft_decrease_stats(&ft->in_memory_stats, bn->stat64_delta); + toku_ft_adjust_logical_row_count(ft, -BLB_LRD(node, childnum)); + BLB_LRD(node, childnum) = 0; destroy_basement_node(bn); set_BNULL(node, childnum); BP_STATE(node, childnum) = PT_ON_DISK; diff --git a/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc b/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc index 29f6daa293a..e64139f0eca 100644 --- a/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc +++ b/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc @@ -49,7 +49,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "ft/serialize/block_allocator.h" #include "ft/serialize/rbtree_mhs.h" -#if TOKU_DEBUG_PARANOID +#if defined(TOKU_DEBUG_PARANOID) && TOKU_DEBUG_PARANOID #define VALIDATE() Validate() #else #define VALIDATE() diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-4357.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-4357.cc index 0af5c8185a9..dd76b7fbc08 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-4357.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-4357.cc @@ -42,13 +42,11 @@ CACHEFILE f1; static void *pin_nonblocking(void *arg) { void* v1; - long s1; int r = toku_cachetable_get_and_pin_nonblocking( f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, - &s1, def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, @@ -70,12 +68,10 @@ cachetable_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, - &s1, def_write_callback(NULL), def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-4365.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-4365.cc index 7bee0b80770..75b6eb3fcea 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-4365.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-4365.cc @@ -42,13 +42,11 @@ CACHEFILE f1; static void *pin_nonblocking(void *arg) { void* v1; - long s1; int r = toku_cachetable_get_and_pin_nonblocking( f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, - &s1, def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, @@ -92,12 +90,10 @@ cachetable_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, - &s1, def_write_callback(nullptr), def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-5097.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-5097.cc index 5ab0df88e08..b9c299eb762 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-5097.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-5097.cc @@ -88,7 +88,6 @@ flush (CACHEFILE f __attribute__((__unused__)), static void *f2_pin(void *arg) { int r; void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); // // these booleans for pe_callback just ensure that the @@ -98,7 +97,7 @@ static void *f2_pin(void *arg) { // This is just to ensure that the bug is being exercised // check_pe_callback = true; - r = toku_cachetable_get_and_pin(f2, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f2, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert(r == 0); ct->ev.signal_eviction_thread(); usleep(1*1024*1024); @@ -141,13 +140,12 @@ cachetable_test (void) { assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.pe_callback = pe_callback; wc.flush_callback = flush; // pin and unpin a node 20 times, just to get clock count up for (int i = 0; i < 20; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert(r == 0); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8)); assert(r == 0); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc index 0b5110ddd99..183c2c8bc44 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc @@ -131,13 +131,11 @@ static void *repin_one(void *UU(arg)) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); struct unlockers unlockers = {true, unpin_two, NULL, NULL}; void* v1; - long s1; int r = toku_cachetable_get_and_pin_nonblocking( f1, make_blocknum(1), 1, &v1, - &s1, wc, def_fetch, def_pf_req_callback, @@ -164,13 +162,12 @@ cachetable_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); // bring pairs 1 and 2 into memory, then unpin - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch_one, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch_one, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v1, &s1, wc, fetch_two, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v1, wc, fetch_two, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); toku_pthread_t tid1; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-5978.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-5978.cc index a4ff6c33e6a..c8a6f366ce3 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-5978.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-5978.cc @@ -125,13 +125,11 @@ static void *repin_one(void *UU(arg)) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); struct unlockers unlockers = {true, unpin_four, NULL, NULL}; void* v1; - long s1; int r = toku_cachetable_get_and_pin_nonblocking( f1, make_blocknum(1), 1, &v1, - &s1, wc, def_fetch, def_pf_req_callback, @@ -149,13 +147,11 @@ static void *repin_two(void *UU(arg)) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); struct unlockers unlockers = {true, unpin_three, NULL, NULL}; void* v1; - long s1; int r = toku_cachetable_get_and_pin_nonblocking( f1, make_blocknum(2), 2, &v1, - &s1, wc, def_fetch, def_pf_req_callback, @@ -181,20 +177,19 @@ cachetable_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); // bring pairs 1 and 2 into memory, then unpin - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); // now pin pairs 3 and 4 - r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v1, &s1, wc, fetch_three, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v1, wc, fetch_three, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v1, &s1, wc, fetch_four, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v1, wc, fetch_four, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); toku_pthread_t tid1; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-all-write.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-all-write.cc index bc08bab944e..efc844d53a9 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-all-write.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-all-write.cc @@ -73,12 +73,11 @@ cachetable_test (void) { void* v1; void* v2; - long s1, s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8)); - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(8)); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pending.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pending.cc index 5e87fed740d..024e2f5d221 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pending.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pending.cc @@ -99,13 +99,15 @@ do_update (void *UU(ignore)) CACHEKEY key = make_blocknum(i); uint32_t hi = toku_cachetable_hash(cf, key); void *vv; - long size; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; - int r = toku_cachetable_get_and_pin(cf, key, hi, &vv, &size, wc, fetch_die, def_pf_req_callback, def_pf_callback, true, 0); + int r = toku_cachetable_get_and_pin(cf, key, hi, &vv, wc, fetch_die, def_pf_req_callback, def_pf_callback, true, 0); //printf("g"); assert(r==0); - assert(size==sizeof(int)); + PAIR_ATTR attr; + r = toku_cachetable_get_attr(cf, key, hi, &attr); + assert(r==0); + assert(attr.size==sizeof(int)); int *CAST_FROM_VOIDP(v, vv); assert(*v==42); *v = 43; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pinned-nodes.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pinned-nodes.cc index 7f30305d673..0846974d3ef 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pinned-nodes.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pinned-nodes.cc @@ -110,13 +110,11 @@ cachetable_test (void) { void* v1; void* v2; - long s1; - long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(&dirty_val); wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch, def_pf_req_callback, def_pf_callback, true, &dirty_val); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch, def_pf_req_callback, def_pf_callback, true, &dirty_val); wc.write_extraargs = NULL; - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); // // Here is the test, we have two pairs, v1 is dirty, v2 is clean, but both are currently pinned diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-checkpoint.cc index caa366e23d3..5afc1230e77 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-checkpoint.cc @@ -103,13 +103,10 @@ cachetable_test (void) { create_dummy_functions(f1); void* v1; - //void* v2; - long s1; - //long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.cleaner_callback = cleaner_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); PAIR_ATTR attr = make_pair_attr(8); attr.cache_pressure_size = 8; r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, attr); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-checkpoint2.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-checkpoint2.cc index 63f383b64b0..16e6102a234 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-checkpoint2.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-checkpoint2.cc @@ -103,13 +103,10 @@ cachetable_test (void) { create_dummy_functions(f1); void* v1; - //void* v2; - long s1; - //long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.cleaner_callback = cleaner_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); PAIR_ATTR attr = make_pair_attr(8); attr.cache_pressure_size = 8; r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, attr); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-attrs-accumulate.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-attrs-accumulate.cc index dd6c674af24..c3125d0ce57 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-attrs-accumulate.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-attrs-accumulate.cc @@ -107,15 +107,12 @@ run_test (void) { assert(STATUS_VALUE(CT_SIZE_CACHEPRESSURE) == 0); void* vs[n_pairs]; - //void* v2; - long ss[n_pairs]; - //long s2; PAIR_ATTR expect = { .size = 0, .nonleaf_size = 0, .leaf_size = 0, .rollback_size = 0, .cache_pressure_size = 0 }; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.write_extraargs = &expect; for (int i = 0; i < n_pairs; ++i) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(i+1), i+1, &vs[i], &ss[i], + r = toku_cachetable_get_and_pin(f1, make_blocknum(i+1), i+1, &vs[i], wc, def_fetch, def_pf_req_callback, @@ -139,8 +136,7 @@ run_test (void) { assert(STATUS_VALUE(CT_SIZE_CACHEPRESSURE) == (uint64_t) expect.cache_pressure_size); void *big_v; - long big_s; - r = toku_cachetable_get_and_pin(f1, make_blocknum(n_pairs + 1), n_pairs + 1, &big_v, &big_s, + r = toku_cachetable_get_and_pin(f1, make_blocknum(n_pairs + 1), n_pairs + 1, &big_v, wc, def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-everything-pinned.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-everything-pinned.cc index c518f9285d6..e643f7395a4 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-everything-pinned.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-everything-pinned.cc @@ -71,13 +71,10 @@ run_test (void) { assert(r==0); void* vs[8]; - //void* v2; - long ss[8]; - //long s2; for (int i = 0; i < 8; ++i) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.cleaner_callback = everything_pinned_cleaner_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(i+1), i+1, &vs[i], &ss[i], + r = toku_cachetable_get_and_pin(f1, make_blocknum(i+1), i+1, &vs[i], wc, def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-nothing-needs-flushing.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-nothing-needs-flushing.cc index 63b2fd9a2b7..1dd2a8e0678 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-nothing-needs-flushing.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-nothing-needs-flushing.cc @@ -69,13 +69,10 @@ run_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* vs[8]; - //void* v2; - long ss[8]; - //long s2; for (int i = 0; i < 8; ++i) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.cleaner_callback = everything_pinned_cleaner_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(i+1), i+1, &vs[i], &ss[i], + r = toku_cachetable_get_and_pin(f1, make_blocknum(i+1), i+1, &vs[i], wc, def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-same-fullhash.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-same-fullhash.cc index c38483c8e46..af519d83d6f 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-same-fullhash.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-same-fullhash.cc @@ -76,12 +76,9 @@ run_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* vs[5]; - //void* v2; - long ss[5]; - //long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.cleaner_callback = my_cleaner_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &vs[0], &ss[0], + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &vs[0], wc, def_fetch, def_pf_req_callback, @@ -92,7 +89,7 @@ run_test (void) { attr.cache_pressure_size = 100; r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, attr); - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 1, &vs[1], &ss[1], + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 1, &vs[1], wc, def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-simple.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-simple.cc index 8a5aa983f63..363b2d30935 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-simple.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-simple.cc @@ -77,12 +77,9 @@ run_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* vs[5]; - //void* v2; - long ss[5]; - //long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.cleaner_callback = my_cleaner_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(100), 100, &vs[4], &ss[4], + r = toku_cachetable_get_and_pin(f1, make_blocknum(100), 100, &vs[4], wc, def_fetch, def_pf_req_callback, @@ -94,7 +91,7 @@ run_test (void) { r = toku_test_cachetable_unpin(f1, make_blocknum(100), 100, CACHETABLE_CLEAN, attr); for (int i = 0; i < 4; ++i) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(i+1), i+1, &vs[i], &ss[i], + r = toku_cachetable_get_and_pin(f1, make_blocknum(i+1), i+1, &vs[i], wc, def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction.cc index 4f8516008ee..855a7154c1d 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction.cc @@ -99,25 +99,24 @@ cachetable_test (void) { void* v1; void* v2; - long s1, s2; flush_may_occur = false; check_flush = true; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; for (int i = 0; i < 100000; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(1)); } for (int i = 0; i < 8; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(1)); } for (int i = 0; i < 4; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(3), 3, CACHETABLE_CLEAN, make_pair_attr(1)); } for (int i = 0; i < 2; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(4), 4, CACHETABLE_CLEAN, make_pair_attr(1)); } flush_may_occur = true; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction2.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction2.cc index d35705002df..89b1fba5013 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction2.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction2.cc @@ -142,34 +142,33 @@ cachetable_test (void) { void* v1; void* v2; - long s1, s2; flush_may_occur = false; for (int i = 0; i < 100000; i++) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.pe_callback = pe_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(4)); } for (int i = 0; i < 8; i++) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.pe_callback = pe_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(4)); } for (int i = 0; i < 4; i++) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.pe_callback = pe_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(3), 3, CACHETABLE_CLEAN, make_pair_attr(4)); } for (int i = 0; i < 2; i++) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.pe_callback = pe_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(4), 4, CACHETABLE_CLEAN, make_pair_attr(4)); } flush_may_occur = false; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction3.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction3.cc index 97ae526a6b8..a6c8d2fdf72 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction3.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction3.cc @@ -159,14 +159,13 @@ cachetable_test (void) { void* v1; void* v2; - long s1, s2; flush_may_occur = false; for (int i = 0; i < 100000; i++) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.pe_est_callback = pe_est_callback; wc.pe_callback = pe_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(4)); } for (int i = 0; i < 8; i++) { @@ -174,7 +173,7 @@ cachetable_test (void) { wc.flush_callback = flush; wc.pe_est_callback = pe_est_callback; wc.pe_callback = pe_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(4)); } for (int i = 0; i < 4; i++) { @@ -182,7 +181,7 @@ cachetable_test (void) { wc.flush_callback = flush; wc.pe_est_callback = pe_est_callback; wc.pe_callback = pe_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(3), 3, CACHETABLE_CLEAN, make_pair_attr(4)); } for (int i = 0; i < 2; i++) { @@ -190,7 +189,7 @@ cachetable_test (void) { wc.flush_callback = flush; wc.pe_est_callback = pe_est_callback; wc.pe_callback = pe_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(4), 4, CACHETABLE_CLEAN, make_pair_attr(4)); } flush_may_occur = false; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction4.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction4.cc index 9982bec26bd..8537a5a0d3d 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction4.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clock-eviction4.cc @@ -137,7 +137,6 @@ cachetable_test (void) { void* v1; void* v2; - long s1, s2; flush_may_occur = false; check_flush = true; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); @@ -145,19 +144,19 @@ cachetable_test (void) { wc.pe_est_callback = pe_est_callback; wc.pe_callback = pe_callback; for (int i = 0; i < 100000; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(1)); } for (int i = 0; i < 8; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(1)); } for (int i = 0; i < 4; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(3), 3, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(3), 3, CACHETABLE_CLEAN, make_pair_attr(1)); } for (int i = 0; i < 2; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(4), 4, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(4), 4, CACHETABLE_CLEAN, make_pair_attr(1)); } flush_may_occur = true; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-checkpoint.cc index 99d595b1ff1..e9571dfd0ee 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-checkpoint.cc @@ -101,11 +101,10 @@ cachetable_test (void) { create_dummy_functions(f1); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; wc.clone_callback = clone_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8)); assert_zero(r); @@ -124,7 +123,7 @@ cachetable_test (void) { usleep(1 * 1024 * 1024); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); assert(clone_flush_started && !clone_flush_completed); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-partial-fetch-pinned-node.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-partial-fetch-pinned-node.cc index 3361faa071e..42faa8ade86 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-partial-fetch-pinned-node.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-partial-fetch-pinned-node.cc @@ -95,12 +95,11 @@ cachetable_test (void) { create_dummy_functions(f1); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.clone_callback = clone_callback; wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8)); assert_zero(r); @@ -109,13 +108,13 @@ cachetable_test (void) { CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert_zero(r); pf_called = false; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); assert(!pf_called); toku_cachetable_pf_pinned_pair(v1, true_pf_callback, NULL, f1, make_blocknum(1), 1); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-partial-fetch.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-partial-fetch.cc index 2b0b828b63c..912cd0df84f 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-partial-fetch.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-partial-fetch.cc @@ -100,12 +100,11 @@ cachetable_test (void) { create_dummy_functions(f1); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.clone_callback = clone_callback; wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8)); assert_zero(r); @@ -114,13 +113,13 @@ cachetable_test (void) { CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert_zero(r); pf_called = false; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, true_pf_req_callback, true_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, true_pf_req_callback, true_pf_callback, true, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert_zero(r); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-pin-nonblocking.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-pin-nonblocking.cc index c66de89fbcf..81c6cecc3df 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-pin-nonblocking.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-pin-nonblocking.cc @@ -82,23 +82,22 @@ cachetable_test (enum cachetable_dirty dirty, bool cloneable) { create_dummy_functions(f1); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.clone_callback = cloneable ? clone_callback : NULL; wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, dirty, make_pair_attr(8)); // test that having a pin that passes false for may_modify_value does not stall behind checkpoint CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_READ, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_READ, NULL, NULL); assert(r == 0); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r == 0); - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r == 0); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-unpin-remove.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-unpin-remove.cc index a4198217c11..625718f97cc 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-unpin-remove.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-unpin-remove.cc @@ -93,12 +93,11 @@ cachetable_test (void) { create_dummy_functions(f1); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.clone_callback = clone_callback; wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), CACHETABLE_DIRTY, make_pair_attr(8)); assert_zero(r); @@ -108,7 +107,7 @@ cachetable_test (void) { CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); r = toku_test_cachetable_unpin_and_remove(f1, make_blocknum(1), NULL, NULL); assert_zero(r); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-close-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-close-test.cc index 84c507f489a..787353e679c 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-close-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-close-test.cc @@ -113,9 +113,7 @@ static void cachetable_eviction_full_test (void) { uint32_t fullhash = toku_cachetable_hash(f1, make_blocknum(0)); void* value1; - long size1; void* value2; - long size2; // // let's pin a node multiple times // and really bring up its clock count @@ -129,7 +127,6 @@ static void cachetable_eviction_full_test (void) { key, fullhash, &value1, - &size1, wc, fetch, def_pf_req_callback, @@ -150,7 +147,6 @@ static void cachetable_eviction_full_test (void) { make_blocknum(1), 1, &value2, - &size2, wc, fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-close-test2.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-close-test2.cc index ba99815eec0..6fb5311c72f 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-close-test2.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-close-test2.cc @@ -126,9 +126,7 @@ static void cachetable_eviction_full_test (void) { uint32_t fullhash = toku_cachetable_hash(f1, make_blocknum(0)); void* value1; - long size1; void* value2; - long size2; // // let's pin a node multiple times // and really bring up its clock count @@ -143,7 +141,6 @@ static void cachetable_eviction_full_test (void) { key, fullhash, &value1, - &size1, wc, fetch, def_pf_req_callback, @@ -165,7 +162,6 @@ static void cachetable_eviction_full_test (void) { make_blocknum(1), 1, &value2, - &size2, wc, fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-getandpin-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-getandpin-test.cc index cb448b88b24..61ba1e65a4d 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-getandpin-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-getandpin-test.cc @@ -83,7 +83,6 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) { // let's get and pin this node a bunch of times to drive up the clock count for (int i = 0; i < 20; i++) { void* value; - long size; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; r = toku_cachetable_get_and_pin( @@ -91,7 +90,6 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) { key, fullhash, &value, - &size, wc, def_fetch, def_pf_req_callback, @@ -109,14 +107,12 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) { // def_fetch another block, causing an eviction of the first block we made above do_sleep = true; void* value2; - long size2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); r = toku_cachetable_get_and_pin( f1, make_blocknum(1), 1, &value2, - &size2, wc, def_fetch, def_pf_req_callback, @@ -131,14 +127,16 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) { toku_cachetable_verify(ct); void *v = 0; - long size = 0; // now verify that the block we are trying to evict is gone wc = def_write_callback(NULL); wc.flush_callback = flush; - r = toku_cachetable_get_and_pin_nonblocking(f1, key, fullhash, &v, &size, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, key, fullhash, &v, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r == TOKUDB_TRY_AGAIN); - r = toku_cachetable_get_and_pin(f1, key, fullhash, &v, &size, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); - assert(r == 0 && v == 0 && size == 8); + r = toku_cachetable_get_and_pin(f1, key, fullhash, &v, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + assert(r == 0 && v == 0); + PAIR_ATTR attr; + r = toku_cachetable_get_attr(f1, key, fullhash, &attr); + assert(r == 0 && attr.size == 8); do_sleep = false; struct timeval tend; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-getandpin-test2.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-getandpin-test2.cc index 37ec203299e..f6dd04f322f 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-getandpin-test2.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-eviction-getandpin-test2.cc @@ -93,13 +93,11 @@ static void cachetable_prefetch_maybegetandpin_test (void) { wc.pe_callback = pe_callback; for (int i = 0; i < 20; i++) { void* value; - long size; r = toku_cachetable_get_and_pin( f1, key, fullhash, &value, - &size, wc, def_fetch, def_pf_req_callback, @@ -116,13 +114,11 @@ static void cachetable_prefetch_maybegetandpin_test (void) { // fetch another block, causing an eviction of the first block we made above void* value2; - long size2; r = toku_cachetable_get_and_pin( f1, make_blocknum(1), 1, &value2, - &size2, wc, def_fetch, def_pf_req_callback, @@ -139,14 +135,12 @@ static void cachetable_prefetch_maybegetandpin_test (void) { toku_cachetable_verify(ct); void *v = 0; - long size = 0; // now verify that the block we are trying to evict may be pinned r = toku_cachetable_get_and_pin_nonblocking( f1, key, fullhash, &v, - &size, wc, def_fetch, def_pf_req_callback, @@ -161,7 +155,6 @@ static void cachetable_prefetch_maybegetandpin_test (void) { key, fullhash, &v, - &size, wc, def_fetch, def_pf_req_callback, @@ -169,7 +162,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) { true, NULL ); - assert(r == 0 && v == 0 && size == 1); + assert(r == 0 && v == 0); + PAIR_ATTR attr; + r = toku_cachetable_get_attr(f1, key, fullhash, &attr); + assert(r == 0 && attr.size == 1); struct timeval tend; gettimeofday(&tend, NULL); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-fetch-inducing-evictor.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-fetch-inducing-evictor.cc index f330a6f20af..ff72e660bb5 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-fetch-inducing-evictor.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-fetch-inducing-evictor.cc @@ -70,9 +70,8 @@ cachetable_test (enum pin_evictor_test_type test_type, bool nonblocking) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); // at this point, we should have 8 bytes of data in a cachetable that supports 7 @@ -82,11 +81,11 @@ cachetable_test (enum pin_evictor_test_type test_type, bool nonblocking) { if (test_type == pin_in_memory) { old_num_ev_runs = evictor_test_helpers::get_num_eviction_runs(&ct->ev); if (nonblocking) { - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert_zero(r); } else { - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); } new_num_ev_runs = evictor_test_helpers::get_num_eviction_runs(&ct->ev); @@ -97,13 +96,13 @@ cachetable_test (enum pin_evictor_test_type test_type, bool nonblocking) { else if (test_type == pin_fetch) { old_num_ev_runs = evictor_test_helpers::get_num_eviction_runs(&ct->ev); if (nonblocking) { - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(2), 2, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(2), 2, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r == TOKUDB_TRY_AGAIN); new_num_ev_runs = evictor_test_helpers::get_num_eviction_runs(&ct->ev); assert(new_num_ev_runs > old_num_ev_runs); } else { - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); new_num_ev_runs = evictor_test_helpers::get_num_eviction_runs(&ct->ev); assert(new_num_ev_runs > old_num_ev_runs); @@ -114,13 +113,13 @@ cachetable_test (enum pin_evictor_test_type test_type, bool nonblocking) { else if (test_type == pin_partial_fetch) { old_num_ev_runs = evictor_test_helpers::get_num_eviction_runs(&ct->ev); if (nonblocking) { - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, pf_req_callback, pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, pf_req_callback, pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r == TOKUDB_TRY_AGAIN); new_num_ev_runs = evictor_test_helpers::get_num_eviction_runs(&ct->ev); assert(new_num_ev_runs > old_num_ev_runs); } else { - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, pf_req_callback, pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, pf_req_callback, pf_callback, true, NULL); assert_zero(r); new_num_ev_runs = evictor_test_helpers::get_num_eviction_runs(&ct->ev); assert(new_num_ev_runs > old_num_ev_runs); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-flush-during-cleaner.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-flush-during-cleaner.cc index c52444d8e06..db8c5cc99e7 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-flush-during-cleaner.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-flush-during-cleaner.cc @@ -73,11 +73,10 @@ cachetable_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; for (int i = 0; i < 10; i++) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.cleaner_callback = cleaner_callback; - r = toku_cachetable_get_and_pin(f1, make_blocknum(i), i, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(i), i, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); PAIR_ATTR attr = make_pair_attr(8); attr.cache_pressure_size = 8; r = toku_test_cachetable_unpin(f1, make_blocknum(i), i, CACHETABLE_DIRTY, attr); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-getandpin-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-getandpin-test.cc index a9a9fd2408a..c5391722bca 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-getandpin-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-getandpin-test.cc @@ -93,12 +93,14 @@ cachetable_getandpin_test (int n) { for (i=1; i<=n; i++) { uint32_t hi; hi = toku_cachetable_hash(f1, make_blocknum(i)); - void *v; long size; + void *v; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(i), hi, &v, &size, wc, fetch, def_pf_req_callback, def_pf_callback, true, 0); + r = toku_cachetable_get_and_pin(f1, make_blocknum(i), hi, &v, wc, fetch, def_pf_req_callback, def_pf_callback, true, 0); assert(r == 0); - assert(size == i); + PAIR_ATTR attr; + r = toku_cachetable_get_attr(f1, make_blocknum(i), hi, &attr); + assert(r == 0 && attr.size == i); r = toku_test_cachetable_unpin(f1, make_blocknum(i), hi, CACHETABLE_CLEAN, make_pair_attr(i)); assert(r == 0); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-kibbutz_and_flush_cachefile.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-kibbutz_and_flush_cachefile.cc index 17792ffb6d0..df4137e934b 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-kibbutz_and_flush_cachefile.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-kibbutz_and_flush_cachefile.cc @@ -69,10 +69,9 @@ run_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); foo = false; cachefile_kibbutz_enq(f1, kibbutz_work, f1); toku_cachefile_close(&f1, false, ZERO_LSN); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-partial-fetch.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-partial-fetch.cc index 5ae6cc60efb..42c60f1f8e6 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-partial-fetch.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-partial-fetch.cc @@ -121,11 +121,8 @@ cachetable_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - //void* v2; - long s1; - //long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch, pf_req_callback, pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch, pf_req_callback, pf_callback, true, NULL); assert(&fetch_val == v1); // // verify that a prefetch of this node will fail @@ -148,16 +145,19 @@ cachetable_test (void) { // // now get and pin node again, and make sure that partial fetch and fetch are not called // - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, err_fetch, pf_req_callback, err_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, err_fetch, pf_req_callback, err_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); // // now make sure that if we say a partial fetch is required, that we get a partial fetch // and that read_extraargs properly passed down // pf_req_called = false; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, err_fetch, true_pf_req_callback, true_pf_callback, true, &fetch_val); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, err_fetch, true_pf_req_callback, true_pf_callback, true, &fetch_val); assert(pf_req_called); - assert(s1 == sizeof(fetch_val)+1); + PAIR_ATTR attr; + r = toku_cachetable_get_attr(f1, make_blocknum(1), 1, &attr); + assert(r == 0); + assert(attr.size == sizeof(fetch_val)+1); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); // close and reopen cachefile so we can do some simple prefetch tests @@ -185,7 +185,7 @@ cachetable_test (void) { // // now verify we can pin it, and NO fetch callback should get called // - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, err_fetch, pf_req_callback, err_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, err_fetch, pf_req_callback, err_pf_callback, true, NULL); assert(&fetch_val == v1); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); @@ -205,7 +205,7 @@ cachetable_test (void) { &doing_prefetch ); assert(doing_prefetch); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, err_fetch, pf_req_callback, err_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, err_fetch, pf_req_callback, err_pf_callback, true, NULL); assert(&fetch_val == v1); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-checkpoint.cc index 65b02aebaec..9632b199daa 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-checkpoint.cc @@ -171,7 +171,6 @@ static void *move_numbers(void *arg) { */ void* v1; - long s1; CACHEKEY less_key; less_key.b = less; uint32_t less_fullhash = less; @@ -184,7 +183,6 @@ static void *move_numbers(void *arg) { less_key, less, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_CHEAP, NULL, @@ -205,7 +203,6 @@ static void *move_numbers(void *arg) { make_blocknum(greater), greater, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_CHEAP, NULL, @@ -238,7 +235,6 @@ static void *move_numbers(void *arg) { make_blocknum(third), third, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_CHEAP, NULL, @@ -264,7 +260,6 @@ static void *read_random_numbers(void *arg) { while(run_test) { int rand_key1 = random() % NUM_ELEMENTS; void* v1; - long s1; int r1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; @@ -274,7 +269,6 @@ static void *read_random_numbers(void *arg) { make_blocknum(rand_key1), rand_key1, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_READ, NULL, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-nonblocking-checkpoint-clean.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-nonblocking-checkpoint-clean.cc index 758bfc6934b..2d358110280 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-nonblocking-checkpoint-clean.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-nonblocking-checkpoint-clean.cc @@ -57,18 +57,16 @@ run_test (void) { void* v1; void* v2; - long s1; - long s2; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0); for (int i = 0; i < 20; i++) { - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0); } - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v2, &s2, def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v2, def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); // mark nodes as pending a checkpoint, so that get_and_pin_nonblocking on block 1 will return TOKUDB_TRY_AGAIN @@ -79,7 +77,6 @@ run_test (void) { make_blocknum(1), 1, &v1, - &s1, def_write_callback(NULL), def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-prefetch-close-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-prefetch-close-test.cc index e4d4288fbdf..bcc6556b271 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-prefetch-close-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-prefetch-close-test.cc @@ -107,13 +107,11 @@ static void cachetable_prefetch_full_test (bool partial_fetch) { if (partial_fetch) { expect_pf = true; void* value; - long size; r = toku_cachetable_get_and_pin( f1, key, fullhash, &value, - &size, wc, fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-prefetch-getandpin-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-prefetch-getandpin-test.cc index d446560ccf6..5769b5c8a41 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-prefetch-getandpin-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-prefetch-getandpin-test.cc @@ -124,13 +124,11 @@ static void cachetable_prefetch_maybegetandpin_test (bool do_partial_fetch) { if (do_partial_fetch) { expect_pf = true; void* value; - long size; r = toku_cachetable_get_and_pin( f1, key, fullhash, &value, - &size, wc, fetch, pf_req_callback, @@ -152,12 +150,14 @@ static void cachetable_prefetch_maybegetandpin_test (bool do_partial_fetch) { // verify that get_and_pin waits while the prefetch is in progress void *v = 0; - long size = 0; do_pf = false; - r = toku_cachetable_get_and_pin_nonblocking(f1, key, fullhash, &v, &size, wc, fetch, pf_req_callback, pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, key, fullhash, &v, wc, fetch, pf_req_callback, pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r==TOKUDB_TRY_AGAIN); - r = toku_cachetable_get_and_pin(f1, key, fullhash, &v, &size, wc, fetch, pf_req_callback, pf_callback, true, NULL); - assert(r == 0 && v == 0 && size == 2); + r = toku_cachetable_get_and_pin(f1, key, fullhash, &v, wc, fetch, pf_req_callback, pf_callback, true, NULL); + assert(r == 0 && v == 0); + PAIR_ATTR attr; + r = toku_cachetable_get_attr(f1, key, fullhash, &attr); + assert(r == 0 && attr.size == 2); struct timeval tend; gettimeofday(&tend, NULL); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-put-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-put-checkpoint.cc index 4cf1678449b..a159d448b76 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-put-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-put-checkpoint.cc @@ -171,7 +171,6 @@ static void move_number_to_child( child = ((random() % 2) == 0) ? (2*parent + 1) : (2*parent + 2); void* v1; - long s1; CACHEKEY parent_key; parent_key.b = parent; uint32_t parent_fullhash = toku_cachetable_hash(f1, parent_key); @@ -189,7 +188,6 @@ static void move_number_to_child( child_key, child_fullhash, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_CHEAP, NULL, @@ -222,7 +220,6 @@ static void *move_numbers(void *arg) { int parent = 0; int r; void* v1; - long s1; CACHEKEY parent_key; parent_key.b = parent; uint32_t parent_fullhash = toku_cachetable_hash(f1, parent_key); @@ -234,7 +231,6 @@ static void *move_numbers(void *arg) { parent_key, parent_fullhash, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_CHEAP, NULL, @@ -280,7 +276,6 @@ static void merge_and_split_child( assert(child != other_child); void* v1; - long s1; CACHEKEY parent_key; parent_key.b = parent; @@ -299,7 +294,6 @@ static void merge_and_split_child( child_key, child_fullhash, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_CHEAP, NULL, @@ -325,7 +319,6 @@ static void merge_and_split_child( other_child_key, other_child_fullhash, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_CHEAP, NULL, @@ -387,7 +380,6 @@ static void *merge_and_split(void *arg) { int parent = 0; int r; void* v1; - long s1; CACHEKEY parent_key; parent_key.b = parent; uint32_t parent_fullhash = toku_cachetable_hash(f1, parent_key); @@ -399,7 +391,6 @@ static void *merge_and_split(void *arg) { parent_key, parent_fullhash, &v1, - &s1, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_CHEAP, NULL, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-clone.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-clone.cc index f303f22cb33..c51096b3063 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-clone.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-clone.cc @@ -106,11 +106,10 @@ test_clean (enum cachetable_dirty dirty, bool cloneable) { create_dummy_functions(f1); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.clone_callback = cloneable ? clone_callback : NULL; wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, dirty, make_pair_attr(8)); check_flush = true; @@ -127,13 +126,13 @@ test_clean (enum cachetable_dirty dirty, bool cloneable) { gettimeofday(&tstart, NULL); // test that having a pin that passes false for may_modify_value does not stall behind checkpoint - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, false, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, false, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); gettimeofday(&tend, NULL); assert(tdelta_usec(&tend, &tstart) <= 2000000); assert(!clone_called); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); gettimeofday(&tend, NULL); // we take 5 seconds for a write diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-clone2.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-clone2.cc index 51cf70c3e76..341bbe92106 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-clone2.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-clone2.cc @@ -94,11 +94,10 @@ test_clean (enum cachetable_dirty dirty, bool cloneable) { check_flush = false; void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.clone_callback = cloneable ? clone_callback : NULL; wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8)); // begin checkpoint, since pair is clean, we should not @@ -106,7 +105,7 @@ test_clean (enum cachetable_dirty dirty, bool cloneable) { CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); // at this point, there should be no more dirty writes r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, dirty, make_pair_attr(8)); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc index f5024806fb3..c1c4cb4f16e 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc @@ -113,10 +113,9 @@ simple_test(bool unlink_on_close) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); set_cf_userdata(f1); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), CACHETABLE_DIRTY, make_pair_attr(8)); toku_cachetable_verify(ct); if (unlink_on_close) { @@ -169,9 +168,8 @@ static void test_pair_stays_in_cache(enum cachetable_dirty dirty) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), dirty, make_pair_attr(8)); toku_cachefile_close(&f1, false, ZERO_LSN); // now reopen the cachefile @@ -217,28 +215,25 @@ static void test_multiple_cachefiles(bool use_same_hash) { r = toku_cachetable_openf(&f3, ct, fname3, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; void* v2; - long s2; void* v3; - long s3; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); for (int j = 0; j < 3; j++) { uint32_t hash = use_same_hash ? 1 : toku_cachetable_hash(f1, make_blocknum(j)); - r = toku_cachetable_get_and_pin(f1, make_blocknum(j), hash, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(j), hash, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(j), hash, CACHETABLE_CLEAN, make_pair_attr(8)); } for (int j = 0; j < 3; j++) { uint32_t hash = use_same_hash ? 1 : toku_cachetable_hash(f2, make_blocknum(j)); - r = toku_cachetable_get_and_pin(f2, make_blocknum(j), hash, &v2, &s2, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f2, make_blocknum(j), hash, &v2, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f2, make_blocknum(j), hash, CACHETABLE_CLEAN, make_pair_attr(8)); } for (int j = 0; j < 3; j++) { uint32_t hash = use_same_hash ? 1 : toku_cachetable_hash(f3, make_blocknum(j)); - r = toku_cachetable_get_and_pin(f3, make_blocknum(j), hash, &v3, &s3, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f3, make_blocknum(j), hash, &v3, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f3, make_blocknum(j), hash, CACHETABLE_CLEAN, make_pair_attr(8)); } @@ -299,9 +294,8 @@ static void test_evictor(void) { set_cf_userdata(f1); r = toku_cachetable_openf(&f2, ct, fname2, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), CACHETABLE_CLEAN, make_pair_attr(8)); close_called = false; free_called = false; @@ -311,7 +305,7 @@ static void test_evictor(void) { // at this point, we should f1, along with one PAIR, stale in the cachetable // now let's pin another node, and ensure that it causes an eviction and free of f1 - r = toku_cachetable_get_and_pin(f2, make_blocknum(1), toku_cachetable_hash(f2, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f2, make_blocknum(1), toku_cachetable_hash(f2, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f2, make_blocknum(1), toku_cachetable_hash(f2, make_blocknum(1)), CACHETABLE_CLEAN, make_pair_attr(8)); // now sleep for 2 seconds, and check to see if f1 has been closed sleep(2); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-maybe-get-pin.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-maybe-get-pin.cc index 9e724dd536a..1b6ef3ec22d 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-maybe-get-pin.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-maybe-get-pin.cc @@ -57,11 +57,10 @@ cachetable_test (void) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); void* v1; - long s1; // nothing in cachetable, so this should fail r = toku_cachetable_maybe_get_and_pin(f1, make_blocknum(1), 1, PL_WRITE_EXPENSIVE, &v1); assert(r==-1); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); // maybe_get_and_pin_clean should succeed, maybe_get_and_pin should fail diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-cheap.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-cheap.cc index fff5845ef8f..d79d1fb1eaf 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-cheap.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-cheap.cc @@ -80,12 +80,11 @@ run_test (pair_lock_type lock_type) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - r = toku_cachetable_get_and_pin_with_dep_pairs(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, lock_type, NULL, 0, NULL, NULL); + r = toku_cachetable_get_and_pin_with_dep_pairs(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, lock_type, NULL, 0, NULL, NULL); cachefile_kibbutz_enq(f1, kibbutz_work, f1); reset_unlockers(&unlockers); - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, &unlockers); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, &unlockers); // to fix #5393, we changed behavior on full fetch where if we // requested a PL_WRITE_CHEAP, and had to grab a PL_WRITE_EXPENSIVE for // a full fetch, we keep it as a PL_WRITE_EXPENSIVE because downgrading back @@ -100,11 +99,11 @@ run_test (pair_lock_type lock_type) { // now do the same test with a partial fetch required pf_called = false; - r = toku_cachetable_get_and_pin_with_dep_pairs(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, true_pf_req_callback, true_pf_callback, lock_type, NULL, 0, NULL, NULL); + r = toku_cachetable_get_and_pin_with_dep_pairs(f1, make_blocknum(1), 1, &v1, wc, def_fetch, true_pf_req_callback, true_pf_callback, lock_type, NULL, 0, NULL, NULL); assert(pf_called); cachefile_kibbutz_enq(f1, kibbutz_work, f1); reset_unlockers(&unlockers); - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, &unlockers); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, &unlockers); if (lock_type == PL_WRITE_EXPENSIVE) { assert(r == TOKUDB_TRY_AGAIN); assert(!unlockers.locked); } diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-dep-nodes.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-dep-nodes.cc index f4137cebd70..f8219a0ad1a 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-dep-nodes.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-dep-nodes.cc @@ -116,18 +116,15 @@ cachetable_test (bool write_first, bool write_second, bool start_checkpoint) { void* v1; void* v2; void* v3; - long s1; - long s2; - long s3; PAIR dependent_pairs[2]; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(&val1); wc.flush_callback = flush; wc.write_extraargs = &val1; dest_pair = &dependent_pairs[0]; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch, def_pf_req_callback, def_pf_callback, true, &val1); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch, def_pf_req_callback, def_pf_callback, true, &val1); dest_pair = &dependent_pairs[1]; wc.write_extraargs = &val2; - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, &val2); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, &val2); // now we set the dirty state of these two. enum cachetable_dirty cd[2]; @@ -152,7 +149,6 @@ cachetable_test (bool write_first, bool write_second, bool start_checkpoint) { make_blocknum(3), 3, &v3, - &s3, wc, fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, &val3, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-nonblocking-cheap.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-nonblocking-cheap.cc index 36e6e74b18c..9e3213a8462 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-nonblocking-cheap.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-nonblocking-cheap.cc @@ -78,15 +78,14 @@ static void reset_unlockers(UNLOCKERS unlockers) { static void run_case_that_should_succeed(CACHEFILE f1, pair_lock_type first_lock, pair_lock_type second_lock) { void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; struct unlockers unlockers = {true, unlock_dummy, NULL, NULL}; - int r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, first_lock, NULL, NULL); + int r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, first_lock, NULL, NULL); assert(r==0); cachefile_kibbutz_enq(f1, kibbutz_work, f1); reset_unlockers(&unlockers); - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, second_lock, NULL, &unlockers); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, second_lock, NULL, &unlockers); assert(r==0); assert(unlockers.locked); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0); } @@ -94,22 +93,25 @@ run_case_that_should_succeed(CACHEFILE f1, pair_lock_type first_lock, pair_lock_ static void run_case_that_should_fail(CACHEFILE f1, pair_lock_type first_lock, pair_lock_type second_lock) { void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; struct unlockers unlockers = {true, unlock_dummy, NULL, NULL}; - int r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, first_lock, NULL, NULL); + int r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, first_lock, NULL, NULL); assert(r==0); cachefile_kibbutz_enq(f1, kibbutz_work, f1); reset_unlockers(&unlockers); - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, second_lock, NULL, &unlockers); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, second_lock, NULL, &unlockers); assert(r == TOKUDB_TRY_AGAIN); assert(!unlockers.locked); } static void run_test (void) { - const int test_limit = 12; + // sometimes the cachetable evictor runs during the test. this sometimes causes cachetable pair locking contention, + // which results with a TOKUDB_TRY_AGAIN error occurring. unfortunately, the test does not expect this and fails. + // set cachetable size limit to a value big enough so that the cachetable evictor is not triggered during the test. + const int test_limit = 100; + int r; CACHETABLE ct; toku_cachetable_create(&ct, test_limit, ZERO_LSN, nullptr); @@ -119,14 +121,13 @@ run_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; // // test that if we are getting a PAIR for the first time that TOKUDB_TRY_AGAIN is returned // because the PAIR was not in the cachetable. // - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r==TOKUDB_TRY_AGAIN); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-nonblocking.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-nonblocking.cc index 26551761435..6a09b53820c 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-nonblocking.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin-nonblocking.cc @@ -103,34 +103,33 @@ run_test (void) { create_dummy_functions(f1); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; // // test that if we are getting a PAIR for the first time that TOKUDB_TRY_AGAIN is returned // because the PAIR was not in the cachetable. // - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r==TOKUDB_TRY_AGAIN); // now it should succeed - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r==0); foo = false; cachefile_kibbutz_enq(f1, kibbutz_work, f1); // because node is in use, should return TOKUDB_TRY_AGAIN - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r==TOKUDB_TRY_AGAIN); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert(foo); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0); // now make sure we get TOKUDB_TRY_AGAIN when a partial fetch is involved // first make sure value is there - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r==0); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0); // now make sure that we get TOKUDB_TRY_AGAIN for the partial fetch - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, true_def_pf_req_callback, true_def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, def_fetch, true_def_pf_req_callback, true_def_pf_callback, PL_WRITE_EXPENSIVE, NULL, NULL); assert(r==TOKUDB_TRY_AGAIN); toku_cachetable_verify(ct); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin.cc index 12a6bf8926d..6750fdd3954 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-pin.cc @@ -95,21 +95,18 @@ run_test (void) { create_dummy_functions(f1); void* v1; - //void* v2; - long s1; - //long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); foo = false; cachefile_kibbutz_enq(f1, kibbutz_work, f1); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert(foo); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); //now let's do a simple checkpoint test // first dirty the PAIR - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8)); // now this should mark the pair for checkpoint @@ -121,7 +118,7 @@ run_test (void) { // check_me = true; flush_called = false; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert(flush_called); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-put-dep-nodes.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-put-dep-nodes.cc index 5cb8285526e..892c15a11b5 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-put-dep-nodes.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-put-dep-nodes.cc @@ -130,16 +130,14 @@ cachetable_test (bool write_first, bool write_second, bool start_checkpoint) { void* v1; void* v2; - long s1; - long s2; PAIR dependent_pairs[2]; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); wc.flush_callback = flush; dest_pair = &dependent_pairs[0]; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, fetch, def_pf_req_callback, def_pf_callback, true, &val1); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, fetch, def_pf_req_callback, def_pf_callback, true, &val1); assert(r==0); dest_pair = &dependent_pairs[1]; - r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, wc, fetch, def_pf_req_callback, def_pf_callback, true, &val2); + r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, wc, fetch, def_pf_req_callback, def_pf_callback, true, &val2); assert(r==0); // now we set the dirty state of these two. diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin-nonblocking.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin-nonblocking.cc index ebe05e50883..fdca6ef27ce 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin-nonblocking.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin-nonblocking.cc @@ -75,9 +75,8 @@ static int sleep_pf_callback(void* UU(ftnode_pv), void* UU(disk_data), void* UU( static void *run_expensive_pf(void *arg) { void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - int r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, sleep_pf_req_callback, sleep_pf_callback, PL_READ, NULL, NULL); + int r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, sleep_fetch, sleep_pf_req_callback, sleep_pf_callback, PL_READ, NULL, NULL); assert(r == TOKUDB_TRY_AGAIN); assert(pf_called); return arg; @@ -85,9 +84,8 @@ static void *run_expensive_pf(void *arg) { static void *run_expensive_fetch(void *arg) { void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - int r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, sleep_pf_req_callback, sleep_pf_callback, PL_READ, NULL, NULL); + int r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, sleep_fetch, sleep_pf_req_callback, sleep_pf_callback, PL_READ, NULL, NULL); assert(fetch_called); assert(r == TOKUDB_TRY_AGAIN); return arg; @@ -106,7 +104,6 @@ run_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); toku_pthread_t fetch_tid; @@ -118,7 +115,6 @@ run_test (void) { make_blocknum(1), 1, &v1, - &s1, wc, sleep_fetch, def_pf_req_callback, @@ -133,9 +129,9 @@ run_test (void) { assert_zero(r); // call with may_modify_node = false twice, make sure we can get it - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, PL_READ, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, PL_READ, NULL, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, PL_READ, NULL, NULL); + r = toku_cachetable_get_and_pin_nonblocking(f1, make_blocknum(1), 1, &v1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, PL_READ, NULL, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0); @@ -151,7 +147,6 @@ run_test (void) { make_blocknum(1), 1, &v1, - &s1, wc, sleep_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin.cc index dd5d59df002..1a8f3813ffa 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin.cc @@ -77,11 +77,10 @@ static int sleep_pf_callback(void* UU(ftnode_pv), void* UU(disk_data), void* UU( static void *run_expensive_pf(void *arg) { void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); pf_called = false; fetch_called = false; - int r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, sleep_pf_req_callback, sleep_pf_callback, false, NULL); + int r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, sleep_fetch, sleep_pf_req_callback, sleep_pf_callback, false, NULL); assert_zero(r); assert(pf_called); return arg; @@ -89,11 +88,10 @@ static void *run_expensive_pf(void *arg) { static void *run_expensive_fetch(void *arg) { void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); pf_called = false; fetch_called = false; - int r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, sleep_pf_req_callback, sleep_pf_callback, false, NULL); + int r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, sleep_fetch, sleep_pf_req_callback, sleep_pf_callback, false, NULL); assert_zero(r); assert(fetch_called); return arg; @@ -112,7 +110,6 @@ run_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - long s1; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); toku_pthread_t fetch_tid; @@ -124,7 +121,6 @@ run_test (void) { make_blocknum(1), 1, &v1, - &s1, wc, sleep_fetch, def_pf_req_callback, @@ -141,9 +137,9 @@ run_test (void) { assert_zero(r); // call with may_modify_node = false twice, make sure we can get it - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, false, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, false, NULL); assert_zero(r); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, false, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, false, NULL); assert_zero(r); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0); @@ -159,7 +155,6 @@ run_test (void) { make_blocknum(1), 1, &v1, - &s1, wc, sleep_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-unpin-remove-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-unpin-remove-checkpoint.cc index 7430fa27405..6b0efdb011f 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-unpin-remove-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-unpin-remove-checkpoint.cc @@ -70,11 +70,8 @@ cachetable_test (void) { create_dummy_functions(f1); void* v1; - //void* v2; - long s1; - //long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); r = toku_test_cachetable_unpin_and_remove(f1, make_blocknum(1), remove_key_expect_checkpoint, NULL); @@ -85,7 +82,7 @@ cachetable_test (void) { NULL ); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin_and_remove(f1, make_blocknum(1), remove_key_expect_no_checkpoint, NULL); toku_cachetable_verify(ct); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-verify.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-verify.cc index f8544ea82d3..67ff4b9669c 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-verify.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-verify.cc @@ -50,11 +50,8 @@ cachetable_test (void) { r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); void* v1; - //void* v2; - long s1; - //long s2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8)); toku_cachetable_verify(ct); toku_cachefile_close(&f1, false, ZERO_LSN); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-test.cc index 64f688c470d..a2b04d578db 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-test.cc @@ -129,7 +129,7 @@ static void test_nested_pin (void) { wc.flush_callback = flush_n; toku_cachetable_put(f, make_blocknum(1), f1hash, &i0, make_pair_attr(1), wc, put_callback_nop); r = toku_test_cachetable_unpin(f, make_blocknum(1), f1hash, CACHETABLE_CLEAN, make_pair_attr(test_object_size)); - r = toku_cachetable_get_and_pin(f, make_blocknum(1), f1hash, &vv, NULL, wc, fetch_n, def_pf_req_callback, def_pf_callback, true, f2); + r = toku_cachetable_get_and_pin(f, make_blocknum(1), f1hash, &vv, wc, fetch_n, def_pf_req_callback, def_pf_callback, true, f2); assert(r==0); assert(vv==&i0); assert(i0==0); @@ -215,12 +215,12 @@ static void test_multi_filehandles (void) { wc.flush_callback = null_flush; toku_cachetable_put(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), (void*)124, make_pair_attr(test_object_size), wc, put_callback_nop); r = toku_test_cachetable_unpin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), CACHETABLE_DIRTY, make_pair_attr(0)); assert(r==0); - r = toku_cachetable_get_and_pin(f2, make_blocknum(1), toku_cachetable_hash(f2, make_blocknum(1)), &v, NULL, wc, add123_fetch, def_pf_req_callback, def_pf_callback, true, (void*)123); assert(r==0); + r = toku_cachetable_get_and_pin(f2, make_blocknum(1), toku_cachetable_hash(f2, make_blocknum(1)), &v, wc, add123_fetch, def_pf_req_callback, def_pf_callback, true, (void*)123); assert(r==0); assert((unsigned long)v==124); - r = toku_cachetable_get_and_pin(f2, make_blocknum(2), toku_cachetable_hash(f2, make_blocknum(2)), &v, NULL, wc, add123_fetch, def_pf_req_callback, def_pf_callback, true, (void*)123); assert(r==0); + r = toku_cachetable_get_and_pin(f2, make_blocknum(2), toku_cachetable_hash(f2, make_blocknum(2)), &v, wc, add123_fetch, def_pf_req_callback, def_pf_callback, true, (void*)123); assert(r==0); assert((unsigned long)v==125); wc.write_extraargs = (void*)222; - r = toku_cachetable_get_and_pin(f3, make_blocknum(2), toku_cachetable_hash(f3, make_blocknum(2)), &v, NULL, wc, add222_fetch, def_pf_req_callback, def_pf_callback, true, (void*)222); assert(r==0); + r = toku_cachetable_get_and_pin(f3, make_blocknum(2), toku_cachetable_hash(f3, make_blocknum(2)), &v, wc, add222_fetch, def_pf_req_callback, def_pf_callback, true, (void*)222); assert(r==0); assert((unsigned long)v==224); // we support only one close for a file handle @@ -296,7 +296,7 @@ static void test_dirty(void) { assert(dirty == 1); assert(pinned == 0); - r = toku_cachetable_get_and_pin(f, key, hkey, &value, NULL, wc, + r = toku_cachetable_get_and_pin(f, key, hkey, &value, wc, test_dirty_fetch, def_pf_req_callback, def_pf_callback, true, 0); assert(r == 0); @@ -318,7 +318,7 @@ static void test_dirty(void) { key = make_blocknum(2); hkey = toku_cachetable_hash(f, key); r = toku_cachetable_get_and_pin(f, key, hkey, - &value, NULL, wc, + &value, wc, test_dirty_fetch, def_pf_req_callback, def_pf_callback, true, 0); assert(r == 0); @@ -338,7 +338,7 @@ static void test_dirty(void) { assert(pinned == 0); r = toku_cachetable_get_and_pin(f, key, hkey, - &value, NULL, wc, + &value, wc, test_dirty_fetch, def_pf_req_callback, def_pf_callback, true, 0); assert(r == 0); @@ -429,11 +429,13 @@ static void test_size_resize(void) { assert(r == 0); void *current_value; - long current_size; - r = toku_cachetable_get_and_pin(f, key, hkey, ¤t_value, ¤t_size, wc, 0, def_pf_req_callback, def_pf_callback, true, 0); + r = toku_cachetable_get_and_pin(f, key, hkey, ¤t_value, wc, 0, def_pf_req_callback, def_pf_callback, true, 0); assert(r == 0); assert(current_value == value); - assert(current_size == new_size); + PAIR_ATTR attr; + r = toku_cachetable_get_attr(f, key, hkey, &attr); + assert(r == 0); + assert(attr.size == new_size); r = toku_test_cachetable_unpin(f, key, hkey, CACHETABLE_CLEAN, make_pair_attr(new_size)); assert(r == 0); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-and-remove-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-and-remove-test.cc index 1a8932e8cdf..5290db26597 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-and-remove-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-and-remove-test.cc @@ -139,8 +139,8 @@ cachetable_put_evict_remove_test (int n) { } // get 0 - void *v; long s; - r = toku_cachetable_get_and_pin(f1, make_blocknum(0), hi[0], &v, &s, wc, fetch, def_pf_req_callback, def_pf_callback, true, 0); + void *v; + r = toku_cachetable_get_and_pin(f1, make_blocknum(0), hi[0], &v, wc, fetch, def_pf_req_callback, def_pf_callback, true, 0); assert(r == 0); // remove 0 diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-remove-and-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-remove-and-checkpoint.cc index 0e44bf10349..9fe43672d39 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-remove-and-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-remove-and-checkpoint.cc @@ -71,10 +71,7 @@ run_test (void) { CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); void* v1; - //void* v2; - long s1; - //long s2; - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); toku_test_cachetable_unpin( f1, make_blocknum(1), @@ -90,7 +87,6 @@ run_test (void) { make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, - &s1, wc, def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-test.cc index 3780b497bf2..e41181d9c2e 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-test.cc @@ -102,7 +102,6 @@ unpin_and_evictor_test(enum unpin_evictor_test_type test_type) { evictor_test_helpers::disable_ev_thread(&ct->ev); void* value2; - long size2; CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL); // this should put in the cachetable a pair of size 8 r = toku_cachetable_get_and_pin( @@ -110,7 +109,6 @@ unpin_and_evictor_test(enum unpin_evictor_test_type test_type) { make_blocknum(1), 1, &value2, - &size2, wc, def_fetch, def_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ft/tests/test-TDB2-pe.cc b/storage/tokudb/PerconaFT/ft/tests/test-TDB2-pe.cc new file mode 100644 index 00000000000..fc7d5cc4368 --- /dev/null +++ b/storage/tokudb/PerconaFT/ft/tests/test-TDB2-pe.cc @@ -0,0 +1,178 @@ +/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: +#ident "$Id$" +/*====== +This file is part of PerconaFT. + + +Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License, version 2, + as published by the Free Software Foundation. + + PerconaFT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. + +---------------------------------------- + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License, version 3, + as published by the Free Software Foundation. + + PerconaFT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. +======= */ + +#ident \ + "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." + +/* The goal of this test. Make sure that inserts stay behind deletes. */ + +#include "test.h" + +#include "cachetable/checkpoint.h" +#include "ft-flusher-internal.h" +#include "ft-flusher.h" +#include <ft-cachetable-wrappers.h> + +static TOKUTXN const null_txn = 0; + +enum { NODESIZE = 1024, KSIZE = NODESIZE - 100, TOKU_PSIZE = 20 }; + +CACHETABLE ct; +FT_HANDLE ft; +const char *fname = TOKU_TEST_FILENAME; + +static int update_func(DB *UU(db), const DBT *key, const DBT *old_val, + const DBT *UU(extra), + void (*set_val)(const DBT *new_val, void *set_extra), + void *set_extra) { + DBT new_val; + assert(old_val->size > 0); + if (verbose) { + printf("applying update to %s\n", (char *)key->data); + } + toku_init_dbt(&new_val); + set_val(&new_val, set_extra); + return 0; +} + +static void doit() { + BLOCKNUM node_leaf; + BLOCKNUM node_root; + BLOCKNUM node_internal; + int r; + + toku_cachetable_create(&ct, 500 * 1024 * 1024, ZERO_LSN, nullptr); + unlink(fname); + r = toku_open_ft_handle(fname, 1, &ft, NODESIZE, NODESIZE / 2, + TOKU_DEFAULT_COMPRESSION_METHOD, ct, null_txn, + toku_builtin_compare_fun); + assert(r == 0); + + ft->options.update_fun = update_func; + ft->ft->update_fun = update_func; + + toku_testsetup_initialize(); // must precede any other toku_testsetup calls + char *pivots[1]; + pivots[0] = toku_strdup("kkkkk"); + int pivot_len = 6; + r = toku_testsetup_leaf(ft, &node_leaf, 2, pivots, &pivot_len); + assert(r == 0); + + toku_free(pivots[0]); + + r = toku_testsetup_nonleaf(ft, 1, &node_internal, 1, &node_leaf, 0, 0); + assert(r == 0); + + r = toku_testsetup_nonleaf(ft, 2, &node_root, 1, &node_internal, 0, 0); + assert(r == 0); + + r = toku_testsetup_root(ft, node_root); + assert(r == 0); + + r = toku_testsetup_insert_to_leaf(ft, node_leaf, + "a", // key + 2, // keylen + "aa", 3); + assert(r == 0); + + r = toku_testsetup_insert_to_leaf(ft, node_leaf, + "z", // key + 2, // keylen + "zz", 3); + assert(r == 0); + char filler[400]; + memset(filler, 0, sizeof(filler)); + // now we insert filler data so that the rebalance + // keeps it at two nodes + r = toku_testsetup_insert_to_leaf(ft, node_leaf, + "b", // key + 2, // keylen + filler, sizeof(filler)); + assert(r == 0); + r = toku_testsetup_insert_to_leaf(ft, node_leaf, + "y", // key + 2, // keylen + filler, sizeof(filler)); + assert(r == 0); + + r = toku_testsetup_insert_to_nonleaf(ft, node_internal, FT_INSERT, + "a", // key + 2, // keylen + "yy", 3); + assert(r == 0); + + r = toku_testsetup_insert_to_nonleaf(ft, node_root, FT_INSERT, + "a", // key + 2, // keylen + "zz", 3); + assert(r == 0); + + // at this point of time, the logical row count will be 6. This has to be + // manually set up as the tests work under the interface of the ft_send_msg + ft->ft->in_memory_logical_rows = 6; + // now run a checkpoint to get everything clean + CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); + r = toku_checkpoint(cp, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); + assert_zero(r); + // now do a lookup on one of the keys, this should bring a leaf node up to + // date + DBT k; + struct check_pair pair = {2, "a", 3, "zz", 0}; + r = toku_ft_lookup(ft, toku_fill_dbt(&k, "a", 2), lookup_checkf, &pair); + assert(r == 0); + assert(ft->ft->in_memory_logical_rows == 4); + FTNODE node; + // now lock and release the leaf node to make sure it is what we expect it to + // be. + toku_pin_node_with_min_bfe(&node, node_leaf, ft); + for (int i = 0; i < 20; i++) { + toku_ftnode_pe_callback(node, make_pair_attr(0xffffffff), ft->ft, + def_pe_finalize_impl, nullptr); + } + toku_unpin_ftnode(ft->ft, node); + assert(ft->ft->in_memory_logical_rows == 6); + + r = toku_close_ft_handle_nolsn(ft, 0); + assert(r == 0); + toku_cachetable_close(&ct); +} + +int test_main(int argc __attribute__((__unused__)), + const char *argv[] __attribute__((__unused__))) { + default_parse_args(argc, argv); + doit(); + return 0; +} diff --git a/storage/tokudb/PerconaFT/ft/tests/test-TDB89.cc b/storage/tokudb/PerconaFT/ft/tests/test-TDB89.cc new file mode 100644 index 00000000000..9371a3a07b9 --- /dev/null +++ b/storage/tokudb/PerconaFT/ft/tests/test-TDB89.cc @@ -0,0 +1,208 @@ +/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: +#ident "$Id$" +/*====== +This file is part of PerconaFT. + + +Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License, version 2, + as published by the Free Software Foundation. + + PerconaFT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. + +---------------------------------------- + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License, version 3, + as published by the Free Software Foundation. + + PerconaFT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. +======= */ + +#ident \ + "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." + +/* The goal of this test. Make sure that inserts stay behind deletes. */ + +#include "test.h" + +#include "cachetable/checkpoint.h" +#include "ft-flusher-internal.h" +#include "ft-flusher.h" +#include <ft-cachetable-wrappers.h> + +static TOKUTXN const null_txn = 0; + +enum { NODESIZE = 1024, KSIZE = NODESIZE - 100, TOKU_PSIZE = 20 }; + +CACHETABLE ct; +FT_HANDLE ft; +const char *fname = TOKU_TEST_FILENAME; + +static int update_func(DB *UU(db), const DBT *key, const DBT *old_val, + const DBT *UU(extra), + void (*set_val)(const DBT *new_val, void *set_extra), + void *set_extra) { + DBT new_val; + assert(old_val->size > 0); + if (verbose) { + printf("applying update to %s\n", (char *)key->data); + } + toku_init_dbt(&new_val); + set_val(&new_val, set_extra); + return 0; +} + +// callback functions for toku_ft_flush_some_child +static bool destroy_bn(void *UU(extra)) { return true; } + +static bool recursively_flush_should_not_happen(FTNODE UU(child), + void *UU(extra)) { + assert(false); +} + +static int child_to_flush(FT UU(h), FTNODE parent, void *UU(extra)) { + assert(parent->height == 1); + assert(parent->n_children == 1); + return 0; +} + +static void dummy_update_status(FTNODE UU(child), int UU(dirtied), + void *UU(extra)) {} + +static void doit() { + BLOCKNUM node_leaf; + BLOCKNUM node_root; + BLOCKNUM node_internal; + int r; + + toku_cachetable_create(&ct, 500 * 1024 * 1024, ZERO_LSN, nullptr); + unlink(fname); + r = toku_open_ft_handle(fname, 1, &ft, NODESIZE, NODESIZE / 2, + TOKU_DEFAULT_COMPRESSION_METHOD, ct, null_txn, + toku_builtin_compare_fun); + assert(r == 0); + + ft->options.update_fun = update_func; + ft->ft->update_fun = update_func; + + toku_testsetup_initialize(); // must precede any other toku_testsetup calls + char *pivots[1]; + pivots[0] = toku_strdup("kkkkk"); + int pivot_len = 6; + r = toku_testsetup_leaf(ft, &node_leaf, 2, pivots, &pivot_len); + assert(r == 0); + + toku_free(pivots[0]); + + r = toku_testsetup_nonleaf(ft, 1, &node_internal, 1, &node_leaf, 0, 0); + assert(r == 0); + + r = toku_testsetup_nonleaf(ft, 2, &node_root, 1, &node_internal, 0, 0); + assert(r == 0); + + r = toku_testsetup_root(ft, node_root); + assert(r == 0); + + r = toku_testsetup_insert_to_leaf(ft, node_leaf, + "a", // key + 2, // keylen + "aa", 3); + assert(r == 0); + + r = toku_testsetup_insert_to_leaf(ft, node_leaf, + "z", // key + 2, // keylen + "zz", 3); + assert(r == 0); + char filler[400]; + memset(filler, 0, sizeof(filler)); + // now we insert filler data so that the rebalance + // keeps it at two nodes + r = toku_testsetup_insert_to_leaf(ft, node_leaf, + "b", // key + 2, // keylen + filler, sizeof(filler)); + assert(r == 0); + r = toku_testsetup_insert_to_leaf(ft, node_leaf, + "y", // key + 2, // keylen + filler, sizeof(filler)); + assert(r == 0); + + r = toku_testsetup_insert_to_nonleaf(ft, node_internal, FT_INSERT, + "a", // key + 2, // keylen + "yy", 3); + assert(r == 0); + + r = toku_testsetup_insert_to_nonleaf(ft, node_root, FT_INSERT, + "a", // key + 2, // keylen + "zz", 3); + assert(r == 0); + + // at this point of time, the logical row count will be 6. This has to be + // manually set up as the tests work under the interface of the ft_send_msg + ft->ft->in_memory_logical_rows = 6; + // now run a checkpoint to get everything clean + CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); + r = toku_checkpoint(cp, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); + assert_zero(r); + // now do a lookup on one of the keys, this should bring a leaf node up to + // date + DBT k; + struct check_pair pair = {2, "a", 3, "zz", 0}; + r = toku_ft_lookup(ft, toku_fill_dbt(&k, "a", 2), lookup_checkf, &pair); + assert(r == 0); + assert(ft->ft->in_memory_logical_rows == 4); + + // now lock and release the leaf node to make sure it is what we expect it to + // be. + FTNODE node = NULL; + ftnode_fetch_extra bfe; + bfe.create_for_min_read(ft->ft); + toku_pin_ftnode_with_dep_nodes( + ft->ft, node_internal, toku_cachetable_hash(ft->ft->cf, node_internal), + &bfe, PL_WRITE_EXPENSIVE, 0, NULL, &node, true); + assert(node->height == 1); + assert(node->n_children == 1); + + struct flusher_advice fa; + flusher_advice_init(&fa, child_to_flush, destroy_bn, + recursively_flush_should_not_happen, default_merge_child, + dummy_update_status, default_pick_child_after_split, + NULL); + + // do the flush which forces an evict of the leaf. logical row count back to + // 6 before the flush + toku_ft_flush_some_child(ft->ft, node, &fa); + + assert(ft->ft->in_memory_logical_rows == 5); + + r = toku_close_ft_handle_nolsn(ft, 0); + assert(r == 0); + toku_cachetable_close(&ct); +} + +int test_main(int argc __attribute__((__unused__)), + const char *argv[] __attribute__((__unused__))) { + default_parse_args(argc, argv); + doit(); + return 0; +} diff --git a/storage/tokudb/PerconaFT/ft/txn/rollback-apply.cc b/storage/tokudb/PerconaFT/ft/txn/rollback-apply.cc index c9464c3ed60..0f19c445a0f 100644 --- a/storage/tokudb/PerconaFT/ft/txn/rollback-apply.cc +++ b/storage/tokudb/PerconaFT/ft/txn/rollback-apply.cc @@ -230,8 +230,10 @@ int toku_rollback_commit(TOKUTXN txn, LSN lsn) { //If this transaction needs an fsync (if it commits) //save that in the parent. Since the commit really happens in the root txn. + toku_txn_lock(txn->parent); txn->parent->force_fsync_on_commit |= txn->force_fsync_on_commit; txn->parent->roll_info.num_rollentries += txn->roll_info.num_rollentries; + toku_txn_unlock(txn->parent); } else { r = apply_txn(txn, lsn, toku_commit_rollback_item); assert(r==0); diff --git a/storage/tokudb/PerconaFT/ft/txn/rollback.cc b/storage/tokudb/PerconaFT/ft/txn/rollback.cc index 88e660e2cda..0c793842f3c 100644 --- a/storage/tokudb/PerconaFT/ft/txn/rollback.cc +++ b/storage/tokudb/PerconaFT/ft/txn/rollback.cc @@ -276,7 +276,7 @@ void toku_get_and_pin_rollback_log(TOKUTXN txn, BLOCKNUM blocknum, ROLLBACK_LOG_ FT CAST_FROM_VOIDP(h, toku_cachefile_get_userdata(cf)); uint32_t hash = toku_cachetable_hash(cf, blocknum); int r = toku_cachetable_get_and_pin_with_dep_pairs(cf, blocknum, hash, - &value, NULL, + &value, get_write_callbacks_for_rollback_log(h), toku_rollback_fetch_callback, toku_rollback_pf_req_callback, diff --git a/storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp b/storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp index fbb5aa08571..6c0fb341542 100644 --- a/storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp +++ b/storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp @@ -39,7 +39,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "malloc_utils.hpp" -#if !HAVE_BITS_FUNCTEXCEPT_H +#if !defined(HAVE_BITS_FUNCTEXCEPT_H) || !HAVE_BITS_FUNCTEXCEPT_H namespace std { diff --git a/storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp b/storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp index 3e2b591430e..4aae801b1e2 100644 --- a/storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp +++ b/storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp @@ -47,7 +47,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include <cassert> #include <cstdlib> -#if HAVE_BITS_FUNCTEXCEPT_H +#if defined(HAVE_BITS_FUNCTEXCEPT_H) && HAVE_BITS_FUNCTEXCEPT_H # include <bits/functexcept.h> diff --git a/storage/tokudb/PerconaFT/portability/memory.cc b/storage/tokudb/PerconaFT/portability/memory.cc index 9594158cf38..403abfe1d68 100644 --- a/storage/tokudb/PerconaFT/portability/memory.cc +++ b/storage/tokudb/PerconaFT/portability/memory.cc @@ -182,7 +182,7 @@ toku_memory_footprint(void * p, size_t touched) void * toku_malloc(size_t size) { -#if __APPLE__ +#if defined(__APPLE__) if (size == 0) { return nullptr; } @@ -209,7 +209,7 @@ toku_malloc(size_t size) { } void *toku_malloc_aligned(size_t alignment, size_t size) { -#if __APPLE__ +#if defined(__APPLE__) if (size == 0) { return nullptr; } @@ -245,7 +245,7 @@ toku_calloc(size_t nmemb, size_t size) { void * toku_realloc(void *p, size_t size) { -#if __APPLE__ +#if defined(__APPLE__) if (size == 0) { if (p != nullptr) { toku_free(p); @@ -276,7 +276,7 @@ toku_realloc(void *p, size_t size) { } void *toku_realloc_aligned(size_t alignment, void *p, size_t size) { -#if __APPLE__ +#if defined(__APPLE__) if (size == 0) { if (p != nullptr) { toku_free(p); @@ -345,7 +345,7 @@ toku_free(void *p) { void * toku_xmalloc(size_t size) { -#if __APPLE__ +#if defined(__APPLE__) if (size == 0) { return nullptr; } @@ -375,7 +375,7 @@ void* toku_xmalloc_aligned(size_t alignment, size_t size) // Fail with a resource_assert if the allocation fails (don't return an error code). // Requires: alignment is a power of two. { -#if __APPLE__ +#if defined(__APPLE__) if (size == 0) { return nullptr; } @@ -409,7 +409,7 @@ toku_xcalloc(size_t nmemb, size_t size) { void * toku_xrealloc(void *v, size_t size) { -#if __APPLE__ +#if defined(__APPLE__) if (size == 0) { if (v != nullptr) { toku_free(v); diff --git a/storage/tokudb/PerconaFT/portability/toku_assert.h b/storage/tokudb/PerconaFT/portability/toku_assert.h index b0a7be3287b..a5593a93ed8 100644 --- a/storage/tokudb/PerconaFT/portability/toku_assert.h +++ b/storage/tokudb/PerconaFT/portability/toku_assert.h @@ -126,7 +126,7 @@ void db_env_do_backtrace(FILE *outf); #define resource_assert_zero(a) assert_zero(a) // indicates resource must be available, otherwise unrecoverable #define resource_assert_equals(a, b) assert_equals(a, b) // indicates resource must be available, otherwise unrecoverable -#if TOKU_DEBUG_PARANOID +#if defined(TOKU_DEBUG_PARANOID) && TOKU_DEBUG_PARANOID #define paranoid_invariant(a) assert(a) #define paranoid_invariant_null(a) assert_null(a) #define paranoid_invariant_notnull(a) assert(a) diff --git a/storage/tokudb/PerconaFT/portability/toku_debug_sync.h b/storage/tokudb/PerconaFT/portability/toku_debug_sync.h index 493075c36c3..6ed052098f6 100644 --- a/storage/tokudb/PerconaFT/portability/toku_debug_sync.h +++ b/storage/tokudb/PerconaFT/portability/toku_debug_sync.h @@ -40,7 +40,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. struct tokutxn; -#if defined(ENABLED_DEBUG_SYNC) +#if defined(MYSQL_TOKUDB_ENGINE) && MYSQL_TOKUDB_ENGINE && \ + defined(ENABLED_DEBUG_SYNC) && ENABLED_DEBUG_SYNC /* the below macros are defined in my_global.h, which is included in m_string.h, diff --git a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc index b7b4c0ab233..d742555f878 100644 --- a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc +++ b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc @@ -1,4 +1,4 @@ -#ifdef MYSQL_TOKUDB_ENGINE +#ifdef TOKU_MYSQL_WITH_PFS #include "toku_portability.h" #include "toku_pthread.h" @@ -18,7 +18,7 @@ int toku_pthread_create(const toku_instr_key &key, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) { -#if (MYSQL_VERSION_MAJOR >= 5) && (MYSQL_VERSION_MINOR >= 7) +#if (50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799) return PSI_THREAD_CALL(spawn_thread)( key.id(), reinterpret_cast<my_thread_handle *>(thread), attr, start_routine, arg); @@ -362,4 +362,4 @@ void toku_instr_rwlock_unlock(toku_pthread_rwlock_t &rwlock) { PSI_RWLOCK_CALL(unlock_rwlock)(rwlock.psi_rwlock); } -#endif // MYSQL_TOKUDB_ENGINE +#endif // TOKU_MYSQL_WITH_PFS diff --git a/storage/tokudb/PerconaFT/portability/toku_instrumentation.h b/storage/tokudb/PerconaFT/portability/toku_instrumentation.h index c300f9275b8..7f2946d9702 100644 --- a/storage/tokudb/PerconaFT/portability/toku_instrumentation.h +++ b/storage/tokudb/PerconaFT/portability/toku_instrumentation.h @@ -41,7 +41,7 @@ class toku_instr_probe_empty { extern toku_instr_key toku_uninstrumented; -#ifndef MYSQL_TOKUDB_ENGINE +#ifndef TOKU_MYSQL_WITH_PFS #include <pthread.h> @@ -245,10 +245,10 @@ inline void toku_instr_rwlock_wrlock_wait_end( inline void toku_instr_rwlock_unlock(UU(toku_pthread_rwlock_t &rwlock)) {} -#else // MYSQL_TOKUDB_ENGINE +#else // TOKU_MYSQL_WITH_PFS // There can be not only mysql but also mongodb or any other PFS stuff #include <toku_instr_mysql.h> -#endif // MYSQL_TOKUDB_ENGINE +#endif // TOKU_MYSQL_WITH_PFS extern toku_instr_key toku_uninstrumented; diff --git a/storage/tokudb/PerconaFT/portability/toku_portability.h b/storage/tokudb/PerconaFT/portability/toku_portability.h index e722158d970..afa5e0135aa 100644 --- a/storage/tokudb/PerconaFT/portability/toku_portability.h +++ b/storage/tokudb/PerconaFT/portability/toku_portability.h @@ -69,7 +69,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include <sys/stat.h> #include <stdio.h> -#if __FreeBSD__ +#if defined(__FreeBSD__) #include <stdarg.h> #endif diff --git a/storage/tokudb/PerconaFT/portability/toku_race_tools.h b/storage/tokudb/PerconaFT/portability/toku_race_tools.h index 96712ffffdc..eee08185513 100644 --- a/storage/tokudb/PerconaFT/portability/toku_race_tools.h +++ b/storage/tokudb/PerconaFT/portability/toku_race_tools.h @@ -45,7 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #define USE_VALGRIND 1 #endif -#if defined(__linux__) && USE_VALGRIND +#if defined(__linux__) && defined(USE_VALGRIND) && USE_VALGRIND # include <valgrind/helgrind.h> # include <valgrind/drd.h> diff --git a/storage/tokudb/PerconaFT/src/tests/get_last_key.cc b/storage/tokudb/PerconaFT/src/tests/get_last_key.cc index 3749d9ea8ff..ad6cf34fda3 100644 --- a/storage/tokudb/PerconaFT/src/tests/get_last_key.cc +++ b/storage/tokudb/PerconaFT/src/tests/get_last_key.cc @@ -161,16 +161,18 @@ static void do_test(size_t ct_size, int num_keys) r = env->txn_begin(env, nullptr, &txn, 0); CKERR(r); - DBT key, value; - for (i = 0; i < num_keys; i++) { - int v, k = toku_htonl(i); - dbt_init(&key, &k, sizeof(int)); - dbt_init(&value, &v, sizeof(int)); - get_value_by_key(&key, &value); - r = db->put(db, txn, &key, &value, 0); - CKERR(r); + { + DBT key, value; + for (i = 0; i < num_keys; i++) { + int v, k = toku_htonl(i); + dbt_init(&key, &k, sizeof(int)); + dbt_init(&value, &v, sizeof(int)); + get_value_by_key(&key, &value); + if (0) printf("put %d\n", k); + r = db->put(db, txn, &key, &value, 0); + CKERR(r); + } } - CKERR(r); int expect_r = num_keys == 0 ? DB_NOTFOUND : 0; check_last_key_matches(db, expect_r, num_keys - 1); @@ -186,13 +188,23 @@ static void do_test(size_t ct_size, int num_keys) r = env->txn_begin(env, nullptr, &txn, 0); CKERR(r); - r = db->del(db, txn, &key, 0); + // Delete the last key + { + DBT key; + int k = toku_htonl(num_keys - 1); + dbt_init(&key, &k, sizeof(int)); + if (0) printf("del %d\n", *(int*)key.data); + r = db->del(db, txn, &key, 0); + CKERR(r); + } check_last_key_matches(db, 0, num_keys - 1); r = txn->commit(txn, 0); + CKERR(r); check_last_key_matches(db, 0, num_keys - 1); r = txn2->commit(txn2, 0); + CKERR(r); check_last_key_matches(db, 0, num_keys - 1); //Run Garbage collection (NOTE does not work when everything fits in root??? WHY) diff --git a/storage/tokudb/PerconaFT/src/ydb.cc b/storage/tokudb/PerconaFT/src/ydb.cc index 9875e9227d4..58d39c50c23 100644 --- a/storage/tokudb/PerconaFT/src/ydb.cc +++ b/storage/tokudb/PerconaFT/src/ydb.cc @@ -186,9 +186,12 @@ toku_ydb_init(void) { // Do not clean up resources if env is panicked, just exit ugly void toku_ydb_destroy(void) { + if (!ydb_layer_status.initialized) + return; if (env_is_panicked == 0) { toku_ft_layer_destroy(); } + ydb_layer_status.initialized = false; } static int diff --git a/storage/tokudb/PerconaFT/src/ydb_lib.cc b/storage/tokudb/PerconaFT/src/ydb_lib.cc index bf3cde4e927..4775f601d23 100644 --- a/storage/tokudb/PerconaFT/src/ydb_lib.cc +++ b/storage/tokudb/PerconaFT/src/ydb_lib.cc @@ -43,7 +43,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "ydb.h" #include <toku_assert.h> -#if defined(__GNUC__) +#if 0 && defined(__GNUC__) static void __attribute__((constructor)) libtokuft_init(void) { int r = toku_ydb_init(); diff --git a/storage/tokudb/PerconaFT/util/dmt.cc b/storage/tokudb/PerconaFT/util/dmt.cc index 642c9367d7e..a584bf2b2bf 100644 --- a/storage/tokudb/PerconaFT/util/dmt.cc +++ b/storage/tokudb/PerconaFT/util/dmt.cc @@ -80,8 +80,8 @@ void dmt<dmtdata_t, dmtdataout_t, dmtwriter_t>::create_from_sorted_memory_of_fix paranoid_invariant(numvalues > 0); void *ptr = toku_mempool_malloc(&this->mp, aligned_memsize); paranoid_invariant_notnull(ptr); - uint8_t * CAST_FROM_VOIDP(dest, ptr); - const uint8_t * CAST_FROM_VOIDP(src, mem); + uint8_t * const dest = static_cast<uint8_t *>(ptr); + const uint8_t * const src = static_cast<const uint8_t *>(mem); if (pad_bytes == 0) { paranoid_invariant(aligned_memsize == mem_length); memcpy(dest, src, aligned_memsize); diff --git a/storage/tokudb/PerconaFT/util/minicron.cc b/storage/tokudb/PerconaFT/util/minicron.cc index c1412015be0..241e498c7ac 100644 --- a/storage/tokudb/PerconaFT/util/minicron.cc +++ b/storage/tokudb/PerconaFT/util/minicron.cc @@ -85,8 +85,9 @@ minicron_do (void *pv) toku_cond_wait(&p->condvar, &p->mutex); } else if (p->period_in_ms <= 1000) { + uint32_t period_in_ms = p->period_in_ms; toku_mutex_unlock(&p->mutex); - usleep(p->period_in_ms * 1000); + usleep(period_in_ms * 1000); toku_mutex_lock(&p->mutex); } else { diff --git a/storage/tokudb/PerconaFT/util/scoped_malloc.cc b/storage/tokudb/PerconaFT/util/scoped_malloc.cc index 55bbab39332..6c4fb95a318 100644 --- a/storage/tokudb/PerconaFT/util/scoped_malloc.cc +++ b/storage/tokudb/PerconaFT/util/scoped_malloc.cc @@ -94,7 +94,7 @@ namespace toku { } void destroy() { -#if TOKU_SCOPED_MALLOC_DEBUG +#if defined(TOKU_SCOPED_MALLOC_DEBUG) && TOKU_SCOPED_MALLOC_DEBUG printf("%s %p %p\n", __FUNCTION__, this, m_stack); #endif if (m_stack != NULL) { diff --git a/storage/tokudb/PerconaFT/util/tests/minicron-change-period-data-race.cc b/storage/tokudb/PerconaFT/util/tests/minicron-change-period-data-race.cc new file mode 100644 index 00000000000..952cbf5769b --- /dev/null +++ b/storage/tokudb/PerconaFT/util/tests/minicron-change-period-data-race.cc @@ -0,0 +1,66 @@ +/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: +#ident "$Id$" +/*====== +This file is part of PerconaFT. + + +Copyright (c) 2018, Percona and/or its affiliates. All rights reserved. + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License, version 2, + as published by the Free Software Foundation. + + PerconaFT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. + +---------------------------------------- + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License, version 3, + as published by the Free Software Foundation. + + PerconaFT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. +======= */ + +#ident "Copyright (c) 2018, Percona and/or its affiliates. All rights reserved." + +#include <toku_portability.h> +#include "test.h" +#include "util/minicron.h" +#include <unistd.h> +#include <string.h> +#include <stdlib.h> + +// The thread sanitizer detected a data race in the minicron in a test unrelated to the minicron. +// This test reproduces the data race in a much smaller test which merely runs minicron tasks +// while changing the minicron period in an unrelated thread. + +static int do_nothing(void *UU(v)) { + return 0; +} + +int test_main (int argc, const char *argv[]) { + default_parse_args(argc,argv); + + minicron m = {}; + int r = toku_minicron_setup(&m, 1, do_nothing, nullptr); + assert(r == 0); + for (int i=0; i<1000; i++) + toku_minicron_change_period(&m, 1); + r = toku_minicron_shutdown(&m); + assert(r == 0); + + return 0; +} |