Commit 10a4b766 authored by John Esmet's avatar John Esmet

fixes #144 Remove the 'batched' API, which was deprecated long ago when

the cachetable reader-writer lock was replaced with bucket mutexes.
parent 56034514
......@@ -1573,7 +1573,7 @@ static bool try_pin_pair(
return try_again;
}
int toku_cachetable_get_and_pin_with_dep_pairs_batched (
int toku_cachetable_get_and_pin_with_dep_pairs (
CACHEFILE cachefile,
CACHEKEY key,
uint32_t fullhash,
......@@ -1766,43 +1766,6 @@ int toku_cachetable_get_and_pin_with_dep_pairs_batched (
return 0;
}
int toku_cachetable_get_and_pin_with_dep_pairs (
CACHEFILE cachefile,
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,
CACHETABLE_PARTIAL_FETCH_CALLBACK pf_callback,
pair_lock_type lock_type,
void* read_extraargs, // parameter for fetch_callback, pf_req_callback, and pf_callback
uint32_t num_dependent_pairs, // number of dependent pairs that we may need to checkpoint
PAIR* dependent_pairs,
enum cachetable_dirty* dependent_dirty // array stating dirty/cleanness of dependent pairs
)
// See cachetable.h
{
int r = toku_cachetable_get_and_pin_with_dep_pairs_batched(
cachefile,
key,
fullhash,
value,
sizep,
write_callback,
fetch_callback,
pf_req_callback,
pf_callback,
lock_type,
read_extraargs,
num_dependent_pairs,
dependent_pairs,
dependent_dirty
);
return r;
}
// Lookup a key in the cachetable. If it is found and it is not being written, then
// acquire a read lock on the pair, update the LRU list, and return sucess.
//
......@@ -2048,7 +2011,7 @@ maybe_pin_pair(
return retval;
}
int toku_cachetable_get_and_pin_nonblocking_batched(
int toku_cachetable_get_and_pin_nonblocking(
CACHEFILE cf,
CACHEKEY key,
uint32_t fullhash,
......@@ -2200,40 +2163,6 @@ int toku_cachetable_get_and_pin_nonblocking_batched(
abort();
}
int toku_cachetable_get_and_pin_nonblocking (
CACHEFILE cf,
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,
CACHETABLE_PARTIAL_FETCH_CALLBACK pf_callback,
pair_lock_type lock_type,
void *read_extraargs,
UNLOCKERS unlockers
)
// See cachetable.h.
{
int r = 0;
r = toku_cachetable_get_and_pin_nonblocking_batched(
cf,
key,
fullhash,
value,
sizep,
write_callback,
fetch_callback,
pf_req_callback,
pf_callback,
lock_type,
read_extraargs,
unlockers
);
return r;
}
struct cachefile_prefetch_args {
PAIR p;
CACHETABLE_FETCH_CALLBACK fetch_callback;
......
......@@ -344,28 +344,6 @@ void toku_cachetable_put(CACHEFILE cf, CACHEKEY key, uint32_t fullhash,
// then the required PAIRs are written to disk for checkpoint.
// KEY PROPERTY OF DEPENDENT PAIRS: They are already locked by the client
// Returns: 0 if the memory object is in memory, otherwise an error number.
// Rationale:
// begin_batched_pin and end_batched_pin take and release a read lock on the pair list.
// Normally, that would be done within this get_and_pin, but we want to pin multiple nodes with a single acquisition of the read lock.
int toku_cachetable_get_and_pin_with_dep_pairs_batched (
CACHEFILE cachefile,
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,
CACHETABLE_PARTIAL_FETCH_CALLBACK pf_callback,
pair_lock_type lock_type,
void* read_extraargs, // parameter for fetch_callback, pf_req_callback, and pf_callback
uint32_t num_dependent_pairs, // number of dependent pairs that we may need to checkpoint
PAIR* dependent_pairs,
enum cachetable_dirty* dependent_dirty // array stating dirty/cleanness of dependent pairs
);
// Effect: call toku_cachetable_get_and_pin_with_dep_pairs_batched once,
// wrapped in begin_batched_pin and end_batched_pin calls.
int toku_cachetable_get_and_pin_with_dep_pairs (
CACHEFILE cachefile,
CACHEKEY key,
......@@ -383,7 +361,6 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
enum cachetable_dirty* dependent_dirty // array stating dirty/cleanness of dependent pairs
);
// Get and pin a memory object.
// Effects: If the memory object is in the cachetable acquire the PAIR lock on it.
// Otherwise, fetch it from storage by calling the fetch callback. If the fetch
......@@ -422,10 +399,7 @@ struct unlockers {
// Effect: If the block is in the cachetable, then return it.
// Otherwise call the functions in unlockers, fetch the data (but don't pin it, since we'll just end up pinning it again later), and return TOKUDB_TRY_AGAIN.
// Rationale:
// begin_batched_pin and end_batched_pin take and release a read lock on the pair list.
// Normally, that would be done within this get_and_pin, but we want to pin multiple nodes with a single acquisition of the read lock.
int toku_cachetable_get_and_pin_nonblocking_batched (
int toku_cachetable_get_and_pin_nonblocking (
CACHEFILE cf,
CACHEKEY key,
uint32_t fullhash,
......@@ -440,23 +414,6 @@ int toku_cachetable_get_and_pin_nonblocking_batched (
UNLOCKERS unlockers
);
// Effect: call toku_cachetable_get_and_pin_nonblocking_batched once,
// wrapped in begin_batched_pin and end_batched_pin calls.
int toku_cachetable_get_and_pin_nonblocking (
CACHEFILE cf,
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 __attribute__((unused)),
CACHETABLE_PARTIAL_FETCH_CALLBACK pf_callback __attribute__((unused)),
pair_lock_type lock_type,
void *read_extraargs, // parameter for fetch_callback, pf_req_callback, and pf_callback
UNLOCKERS unlockers
);
int toku_cachetable_maybe_get_and_pin (CACHEFILE, CACHEKEY, uint32_t /*fullhash*/, pair_lock_type, void**);
// Effect: Maybe get and pin a memory object.
// This function is similar to the get_and_pin function except that it
......
......@@ -201,7 +201,7 @@ toku_create_new_ftnode (
// then a PL_WRITE_CHEAP lock is grabbed
//
int
toku_pin_ftnode_batched(
toku_pin_ftnode(
FT_HANDLE brt,
BLOCKNUM blocknum,
uint32_t fullhash,
......@@ -225,7 +225,7 @@ toku_pin_ftnode_batched(
paranoid_invariant(bfe->type == ftnode_fetch_subset);
}
int r = toku_cachetable_get_and_pin_nonblocking_batched(
int r = toku_cachetable_get_and_pin_nonblocking(
brt->ft->cf,
blocknum,
fullhash,
......@@ -256,7 +256,7 @@ toku_pin_ftnode_batched(
toku::context apply_messages_ctx(CTX_MESSAGE_APPLICATION);
toku_unpin_ftnode_read_only(brt->ft, node);
int rr = toku_cachetable_get_and_pin_nonblocking_batched(
int rr = toku_cachetable_get_and_pin_nonblocking(
brt->ft->cf,
blocknum,
fullhash,
......@@ -316,31 +316,6 @@ toku_pin_ftnode_batched(
return r;
}
void
toku_pin_ftnode_off_client_thread_and_maybe_move_messages(
FT h,
BLOCKNUM blocknum,
uint32_t fullhash,
FTNODE_FETCH_EXTRA bfe,
pair_lock_type lock_type,
uint32_t num_dependent_nodes,
FTNODE* dependent_nodes,
FTNODE *node_p,
bool move_messages)
{
toku_pin_ftnode_off_client_thread_batched_and_maybe_move_messages(
h,
blocknum,
fullhash,
bfe,
lock_type,
num_dependent_nodes,
dependent_nodes,
node_p,
move_messages
);
}
void
toku_pin_ftnode_off_client_thread(
FT h,
......@@ -357,7 +332,7 @@ toku_pin_ftnode_off_client_thread(
}
void
toku_pin_ftnode_off_client_thread_batched_and_maybe_move_messages(
toku_pin_ftnode_off_client_thread_and_maybe_move_messages(
FT h,
BLOCKNUM blocknum,
uint32_t fullhash,
......@@ -376,7 +351,7 @@ toku_pin_ftnode_off_client_thread_batched_and_maybe_move_messages(
dependent_dirty_bits[i] = (enum cachetable_dirty) dependent_nodes[i]->dirty;
}
int r = toku_cachetable_get_and_pin_with_dep_pairs_batched(
int r = toku_cachetable_get_and_pin_with_dep_pairs(
h->cf,
blocknum,
fullhash,
......@@ -400,21 +375,6 @@ toku_pin_ftnode_off_client_thread_batched_and_maybe_move_messages(
*node_p = node;
}
void
toku_pin_ftnode_off_client_thread_batched(
FT h,
BLOCKNUM blocknum,
uint32_t fullhash,
FTNODE_FETCH_EXTRA bfe,
pair_lock_type lock_type,
uint32_t num_dependent_nodes,
FTNODE* dependent_nodes,
FTNODE *node_p)
{
toku_pin_ftnode_off_client_thread_batched_and_maybe_move_messages(
h, blocknum, fullhash, bfe, lock_type, num_dependent_nodes, dependent_nodes, node_p, true);
}
int toku_maybe_pin_ftnode_clean(FT ft, BLOCKNUM blocknum, uint32_t fullhash, pair_lock_type lock_type, FTNODE *nodep) {
void *node_v;
int r = toku_cachetable_maybe_get_and_pin_clean(ft->cf, blocknum, fullhash, lock_type, &node_v);
......
......@@ -138,12 +138,8 @@ toku_create_new_ftnode (
int n_children
);
/**
* Batched version of toku_pin_ftnode, see cachetable batched API for more
* details.
*/
int
toku_pin_ftnode_batched(
toku_pin_ftnode(
FT_HANDLE brt,
BLOCKNUM blocknum,
uint32_t fullhash,
......@@ -194,12 +190,8 @@ toku_pin_ftnode_off_client_thread_and_maybe_move_messages(
*/
int toku_maybe_pin_ftnode_clean(FT ft, BLOCKNUM blocknum, uint32_t fullhash, pair_lock_type lock_type, FTNODE *nodep);
/**
* Batched version of toku_pin_ftnode_off_client_thread, see cachetable
* batched API for more details.
*/
void
toku_pin_ftnode_off_client_thread_batched_and_maybe_move_messages(
toku_pin_ftnode_off_client_thread_and_maybe_move_messages(
FT h,
BLOCKNUM blocknum,
uint32_t fullhash,
......@@ -211,12 +203,8 @@ toku_pin_ftnode_off_client_thread_batched_and_maybe_move_messages(
bool move_messages
);
/**
* Batched version of toku_pin_ftnode_off_client_thread, see cachetable
* batched API for more details.
*/
void
toku_pin_ftnode_off_client_thread_batched(
toku_pin_ftnode_off_client_thread(
FT h,
BLOCKNUM blocknum,
uint32_t fullhash,
......
......@@ -2768,7 +2768,6 @@ static bool process_maybe_reactive_child(FT ft, FTNODE parent, FTNODE child, int
// Effect:
// If child needs to be split or merged, do that.
// parent and child will be unlocked if this happens
// also, the batched pin will have ended if this happens
// Requires: parent and child are read locked
// Returns:
// true if relocking is needed
......@@ -2793,7 +2792,7 @@ static bool process_maybe_reactive_child(FT ft, FTNODE parent, FTNODE child, int
struct ftnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, ft);
FTNODE newparent, newchild;
toku_pin_ftnode_off_client_thread_batched(ft, parent_blocknum, parent_fullhash, &bfe, PL_WRITE_CHEAP, 0, nullptr, &newparent);
toku_pin_ftnode_off_client_thread(ft, parent_blocknum, parent_fullhash, &bfe, PL_WRITE_CHEAP, 0, nullptr, &newparent);
if (newparent->height != parent_height || newparent->n_children != parent_n_children ||
childnum >= newparent->n_children || toku_bnc_n_entries(BNC(newparent, childnum))) {
// If the height changed or childnum is now off the end, something clearly got split or merged out from under us.
......@@ -2807,7 +2806,7 @@ static bool process_maybe_reactive_child(FT ft, FTNODE parent, FTNODE child, int
// and split it.
child_blocknum = BP_BLOCKNUM(newparent, childnum);
child_fullhash = compute_child_fullhash(ft->cf, newparent, childnum);
toku_pin_ftnode_off_client_thread_batched(ft, child_blocknum, child_fullhash, &bfe, PL_WRITE_CHEAP, 1, &newparent, &newchild);
toku_pin_ftnode_off_client_thread(ft, child_blocknum, child_fullhash, &bfe, PL_WRITE_CHEAP, 1, &newparent, &newchild);
newre = get_node_reactivity(ft, newchild);
if (newre == RE_FISSIBLE) {
enum split_mode split_mode;
......@@ -2845,7 +2844,7 @@ static bool process_maybe_reactive_child(FT ft, FTNODE parent, FTNODE child, int
struct ftnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, ft);
FTNODE newparent, newchild;
toku_pin_ftnode_off_client_thread_batched(ft, parent_blocknum, parent_fullhash, &bfe, PL_WRITE_CHEAP, 0, nullptr, &newparent);
toku_pin_ftnode_off_client_thread(ft, parent_blocknum, parent_fullhash, &bfe, PL_WRITE_CHEAP, 0, nullptr, &newparent);
if (newparent->height != parent_height || childnum >= newparent->n_children) {
// looks like this is the root and it got merged, let's just start over (like in the split case above)
toku_unpin_ftnode_read_only(ft, newparent);
......@@ -2853,7 +2852,7 @@ static bool process_maybe_reactive_child(FT ft, FTNODE parent, FTNODE child, int
}
child_blocknum = BP_BLOCKNUM(newparent, childnum);
child_fullhash = compute_child_fullhash(ft->cf, newparent, childnum);
toku_pin_ftnode_off_client_thread_batched(ft, child_blocknum, child_fullhash, &bfe, PL_READ, 1, &newparent, &newchild);
toku_pin_ftnode_off_client_thread(ft, child_blocknum, child_fullhash, &bfe, PL_READ, 1, &newparent, &newchild);
newre = get_node_reactivity(ft, newchild);
if (newre == RE_FUSIBLE && newparent->n_children >= 2) {
toku_unpin_ftnode_read_only(ft, newchild);
......@@ -2886,7 +2885,7 @@ static void inject_message_at_this_blocknum(FT ft, CACHEKEY cachekey, uint32_t f
FTNODE node;
struct ftnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, ft);
toku_pin_ftnode_off_client_thread_batched(ft, cachekey, fullhash, &bfe, PL_WRITE_CHEAP, 0, NULL, &node);
toku_pin_ftnode_off_client_thread(ft, cachekey, fullhash, &bfe, PL_WRITE_CHEAP, 0, NULL, &node);
toku_assert_entire_node_in_memory(node);
paranoid_invariant(node->fullhash==fullhash);
ft_verify_flags(ft, node);
......@@ -3009,11 +3008,11 @@ static void push_something_in_subtree(
if (lock_type == PL_WRITE_CHEAP) {
// We intend to take the write lock for message injection
toku::context inject_ctx(CTX_MESSAGE_INJECTION);
toku_pin_ftnode_off_client_thread_batched(ft, child_blocknum, child_fullhash, &bfe, lock_type, 0, nullptr, &child);
toku_pin_ftnode_off_client_thread(ft, child_blocknum, child_fullhash, &bfe, lock_type, 0, nullptr, &child);
} else {
// We're going to keep promoting
toku::context promo_ctx(CTX_PROMO);
toku_pin_ftnode_off_client_thread_batched(ft, child_blocknum, child_fullhash, &bfe, lock_type, 0, nullptr, &child);
toku_pin_ftnode_off_client_thread(ft, child_blocknum, child_fullhash, &bfe, lock_type, 0, nullptr, &child);
}
} else {
r = toku_maybe_pin_ftnode_clean(ft, child_blocknum, child_fullhash, lock_type, &child);
......@@ -3046,7 +3045,7 @@ static void push_something_in_subtree(
FTNODE newparent;
struct ftnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, ft); // should be fully in memory, we just split it
toku_pin_ftnode_off_client_thread_batched(ft, subtree_root_blocknum, subtree_root_fullhash, &bfe, PL_READ, 0, nullptr, &newparent);
toku_pin_ftnode_off_client_thread(ft, subtree_root_blocknum, subtree_root_fullhash, &bfe, PL_READ, 0, nullptr, &newparent);
push_something_in_subtree(ft, newparent, -1, msg, flow_deltas, gc_info, depth, loc, true);
return;
}
......@@ -3143,7 +3142,7 @@ void toku_ft_root_put_msg(
// and jump back to here.
change_lock_type:
// get the root node
toku_pin_ftnode_off_client_thread_batched(ft, root_key, fullhash, &bfe, lock_type, 0, NULL, &node);
toku_pin_ftnode_off_client_thread(ft, root_key, fullhash, &bfe, lock_type, 0, NULL, &node);
toku_assert_entire_node_in_memory(node);
paranoid_invariant(node->fullhash==fullhash);
ft_verify_flags(ft, node);
......@@ -5173,7 +5172,7 @@ ft_search_child(FT_HANDLE brt, FTNODE node, int childnum, ft_search_t *search, F
);
bool msgs_applied = false;
{
int rr = toku_pin_ftnode_batched(brt, childblocknum, fullhash,
int rr = toku_pin_ftnode(brt, childblocknum, fullhash,
unlockers,
&next_ancestors, bounds,
&bfe,
......@@ -5183,8 +5182,6 @@ ft_search_child(FT_HANDLE brt, FTNODE node, int childnum, ft_search_t *search, F
if (rr==TOKUDB_TRY_AGAIN) {
return rr;
}
// We end the batch before applying ancestor messages if we get
// all the way to a leaf.
invariant_zero(rr);
}
......@@ -5468,7 +5465,7 @@ toku_ft_search (FT_HANDLE brt, ft_search_t *search, FT_GET_CALLBACK_FUNCTION get
uint32_t fullhash;
CACHEKEY root_key;
toku_calculate_root_offset_pointer(ft, &root_key, &fullhash);
toku_pin_ftnode_off_client_thread_batched(
toku_pin_ftnode_off_client_thread(
ft,
root_key,
fullhash,
......@@ -6011,7 +6008,7 @@ toku_ft_keysrange_internal (FT_HANDLE brt, FTNODE node,
FTNODE childnode;
bool msgs_applied = false;
bool child_may_find_right = may_find_right && left_child_number == right_child_number;
r = toku_pin_ftnode_batched(
r = toku_pin_ftnode(
brt,
childblocknum,
fullhash,
......@@ -6090,7 +6087,7 @@ void toku_ft_keysrange(FT_HANDLE brt, DBT* key_left, DBT* key_right, uint64_t *l
uint32_t fullhash;
CACHEKEY root_key;
toku_calculate_root_offset_pointer(brt->ft, &root_key, &fullhash);
toku_pin_ftnode_off_client_thread_batched(
toku_pin_ftnode_off_client_thread(
brt->ft,
root_key,
fullhash,
......@@ -6225,7 +6222,7 @@ static int get_key_after_bytes_in_child(FT_HANDLE ft_h, FT ft, FTNODE node, UNLO
uint32_t fullhash = compute_child_fullhash(ft->cf, node, childnum);
FTNODE child;
bool msgs_applied = false;
r = toku_pin_ftnode_batched(ft_h, childblocknum, fullhash, unlockers, &next_ancestors, bounds, bfe, false, &child, &msgs_applied);
r = toku_pin_ftnode(ft_h, childblocknum, fullhash, unlockers, &next_ancestors, bounds, bfe, false, &child, &msgs_applied);
paranoid_invariant(!msgs_applied);
if (r == TOKUDB_TRY_AGAIN) {
return r;
......@@ -6308,7 +6305,7 @@ int toku_ft_get_key_after_bytes(FT_HANDLE ft_h, const DBT *start_key, uint64_t s
uint32_t fullhash;
CACHEKEY root_key;
toku_calculate_root_offset_pointer(ft, &root_key, &fullhash);
toku_pin_ftnode_off_client_thread_batched(ft, root_key, fullhash, &bfe, PL_READ, 0, nullptr, &root);
toku_pin_ftnode_off_client_thread(ft, root_key, fullhash, &bfe, PL_READ, 0, nullptr, &root);
}
struct unlock_ftnode_extra unlock_extra = {ft_h, root, false};
struct unlockers unlockers = {true, unlock_ftnode_fun, (void*)&unlock_extra, (UNLOCKERS) nullptr};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment