Commit 70c6f6e7 authored by John Esmet's avatar John Esmet

Remove toku_unpin_ftnode_off_client_thread

parent 489e3eab
......@@ -374,24 +374,12 @@ int toku_maybe_pin_ftnode_clean(FT ft, BLOCKNUM blocknum, uint32_t fullhash, pai
return r;
}
void
toku_unpin_ftnode_off_client_thread(FT ft, FTNODE node)
{
int r = toku_cachetable_unpin(
ft->cf,
node->ct_pair,
(enum cachetable_dirty) node->dirty,
make_ftnode_pair_attr(node)
);
assert(r==0);
}
void
toku_unpin_ftnode(FT ft, FTNODE node)
{
// printf("%*sUnpin %ld\n", 8-node->height, "", node->thisnodename.b);
//VERIFY_NODE(brt,node);
toku_unpin_ftnode_off_client_thread(ft, node);
void toku_unpin_ftnode(FT ft, FTNODE node) {
int r = toku_cachetable_unpin(ft->cf,
node->ct_pair,
static_cast<enum cachetable_dirty>(node->dirty),
make_ftnode_pair_attr(node));
invariant_zero(r);
}
void
......
......@@ -179,20 +179,9 @@ toku_pin_ftnode_off_client_thread(
int toku_maybe_pin_ftnode_clean(FT ft, BLOCKNUM blocknum, uint32_t fullhash, pair_lock_type lock_type, FTNODE *nodep);
/**
* Effect: Unpin a brt node. Used for
* nodes that were pinned off client thread.
* Effect: Unpin an ftnode.
*/
void
toku_unpin_ftnode_off_client_thread(FT h, FTNODE node);
/**
* Effect: Unpin a brt node.
* Used for nodes pinned on a client thread
*/
void
toku_unpin_ftnode(FT h, FTNODE node);
void
toku_unpin_ftnode_read_only(FT ft, FTNODE node);
void toku_unpin_ftnode(FT h, FTNODE node);
void toku_unpin_ftnode_read_only(FT ft, FTNODE node);
#endif
......@@ -334,7 +334,7 @@ default_merge_child(struct flusher_advice *fa,
// we are just going to unpin child and
// let ft_merge_child pin it again
//
toku_unpin_ftnode_off_client_thread(h, child);
toku_unpin_ftnode(h, child);
//
//
// it is responsibility of ft_merge_child to unlock parent
......@@ -486,8 +486,8 @@ ct_maybe_merge_child(struct flusher_advice *fa,
default_pick_child_after_split,
&ctme);
toku_unpin_ftnode_off_client_thread(h, parent);
toku_unpin_ftnode_off_client_thread(h, child);
toku_unpin_ftnode(h, parent);
toku_unpin_ftnode(h, child);
FTNODE root_node = NULL;
{
......@@ -1082,20 +1082,20 @@ ft_split_child(
// and possibly continue
// flushing one of the children
int picked_child = fa->pick_child_after_split(h, node, childnum, childnum + 1, fa->extra);
toku_unpin_ftnode_off_client_thread(h, node);
toku_unpin_ftnode(h, node);
if (picked_child == childnum ||
(picked_child < 0 && nodea->height > 0 && fa->should_recursively_flush(nodea, fa->extra))) {
toku_unpin_ftnode_off_client_thread(h, nodeb);
toku_unpin_ftnode(h, nodeb);
toku_ft_flush_some_child(h, nodea, fa);
}
else if (picked_child == childnum + 1 ||
(picked_child < 0 && nodeb->height > 0 && fa->should_recursively_flush(nodeb, fa->extra))) {
toku_unpin_ftnode_off_client_thread(h, nodea);
toku_unpin_ftnode(h, nodea);
toku_ft_flush_some_child(h, nodeb, fa);
}
else {
toku_unpin_ftnode_off_client_thread(h, nodea);
toku_unpin_ftnode_off_client_thread(h, nodeb);
toku_unpin_ftnode(h, nodea);
toku_unpin_ftnode(h, nodeb);
}
}
......@@ -1525,7 +1525,7 @@ ft_merge_child(
// unlock the parent
paranoid_invariant(node->dirty);
toku_unpin_ftnode_off_client_thread(h, node);
toku_unpin_ftnode(h, node);
}
else {
// for test
......@@ -1533,14 +1533,14 @@ ft_merge_child(
// unlock the parent
paranoid_invariant(node->dirty);
toku_unpin_ftnode_off_client_thread(h, node);
toku_unpin_ftnode_off_client_thread(h, childb);
toku_unpin_ftnode(h, node);
toku_unpin_ftnode(h, childb);
}
if (childa->height > 0 && fa->should_recursively_flush(childa, fa->extra)) {
toku_ft_flush_some_child(h, childa, fa);
}
else {
toku_unpin_ftnode_off_client_thread(h, childa);
toku_unpin_ftnode(h, childa);
}
}
......@@ -1614,7 +1614,7 @@ void toku_ft_flush_some_child(FT ft, FTNODE parent, struct flusher_advice *fa)
// reactive, we can unpin the parent
//
if (!may_child_be_reactive) {
toku_unpin_ftnode_off_client_thread(ft, parent);
toku_unpin_ftnode(ft, parent);
parent = NULL;
}
......@@ -1632,7 +1632,7 @@ void toku_ft_flush_some_child(FT ft, FTNODE parent, struct flusher_advice *fa)
// for the root with a fresh one
enum reactivity child_re = get_node_reactivity(ft, child);
if (parent && child_re == RE_STABLE) {
toku_unpin_ftnode_off_client_thread(ft, parent);
toku_unpin_ftnode(ft, parent);
parent = NULL;
}
......@@ -1671,7 +1671,7 @@ void toku_ft_flush_some_child(FT ft, FTNODE parent, struct flusher_advice *fa)
)
{
if (parent) {
toku_unpin_ftnode_off_client_thread(ft, parent);
toku_unpin_ftnode(ft, parent);
parent = NULL;
}
//
......@@ -1681,7 +1681,7 @@ void toku_ft_flush_some_child(FT ft, FTNODE parent, struct flusher_advice *fa)
toku_ft_flush_some_child(ft, child, fa);
}
else {
toku_unpin_ftnode_off_client_thread(ft, child);
toku_unpin_ftnode(ft, child);
}
}
else if (child_re == RE_FISSIBLE) {
......@@ -1837,7 +1837,7 @@ toku_ftnode_cleaner_callback(
ct_flusher_advice_init(&fa, &fste, h->h->nodesize);
toku_ft_flush_some_child(h, node, &fa);
} else {
toku_unpin_ftnode_off_client_thread(h, node);
toku_unpin_ftnode(h, node);
}
return 0;
}
......@@ -1897,7 +1897,7 @@ static void flush_node_fun(void *fe_v)
toku_ft_flush_some_child(fe->h, fe->node, &fa);
}
else {
toku_unpin_ftnode_off_client_thread(fe->h,fe->node);
toku_unpin_ftnode(fe->h,fe->node);
}
}
else {
......
......@@ -371,7 +371,7 @@ toku_ft_hot_optimize(FT_HANDLE brt, DBT* left, DBT* right,
// Since there are no children to flush, we should abort
// the HOT call.
flusher.rightmost_leaf_seen = 1;
toku_unpin_ftnode_off_client_thread(brt->ft, root);
toku_unpin_ftnode(brt->ft, root);
}
// Set the highest pivot key seen here, since the parent may
......
......@@ -3180,7 +3180,7 @@ void toku_ft_root_put_msg(
ft_init_new_root(ft, node, &node);
// Then downgrade back to a read lock, and we can finally
// do the injection.
toku_unpin_ftnode_off_client_thread(ft, node);
toku_unpin_ftnode(ft, node);
lock_type = PL_READ;
STATUS_INC(FT_PRO_NUM_ROOT_SPLIT, 1);
goto change_lock_type;
......@@ -6430,7 +6430,7 @@ toku_dump_ftnode (FILE *file, FT_HANDLE brt, BLOCKNUM blocknum, int depth, const
}
}
}
toku_unpin_ftnode_off_client_thread(brt->ft, node);
toku_unpin_ftnode(brt->ft, node);
return result;
}
......
......@@ -305,7 +305,7 @@ doit (bool after_child_pin) {
else {
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) > 0);
}
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
toku_pin_ftnode_off_client_thread(
c_ft->ft,
......@@ -326,7 +326,7 @@ doit (bool after_child_pin) {
else {
assert(BLB_NBYTESINDATA(node,0) == 0);
}
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
struct check_pair pair1 = {2, "a", 0, NULL, 0};
DBT k;
......
......@@ -334,7 +334,7 @@ doit (int state) {
else {
assert(false);
}
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
// now let's verify the leaves are what we expect
if (state == flt_flush_before_merge || state == flt_flush_before_pin_second_node_for_merge) {
......@@ -353,7 +353,7 @@ doit (int state) {
assert(!node->dirty);
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->omt_size() == 1);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
toku_pin_ftnode_off_client_thread(
c_ft->ft,
......@@ -370,7 +370,7 @@ doit (int state) {
assert(!node->dirty);
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->omt_size() == 1);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
}
else if (state == ft_flush_aflter_merge || state == flt_flush_before_unpin_remove) {
toku_pin_ftnode_off_client_thread(
......@@ -388,7 +388,7 @@ doit (int state) {
assert(!node->dirty);
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->omt_size() == 2);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
}
else {
assert(false);
......
......@@ -345,7 +345,7 @@ doit (int state) {
left_child = BP_BLOCKNUM(node,0);
right_child = BP_BLOCKNUM(node,1);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
// now let's verify the leaves are what we expect
toku_pin_ftnode_off_client_thread(
......@@ -362,7 +362,7 @@ doit (int state) {
assert(!node->dirty);
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->omt_size() == 2);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
toku_pin_ftnode_off_client_thread(
c_ft->ft,
......@@ -378,7 +378,7 @@ doit (int state) {
assert(!node->dirty);
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->omt_size() == 2);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
DBT k;
......
......@@ -325,7 +325,7 @@ doit (bool after_split) {
left_child = BP_BLOCKNUM(node,0);
assert(left_child.b == node_leaf.b);
}
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
// now let's verify the leaves are what we expect
if (after_split) {
......@@ -343,7 +343,7 @@ doit (bool after_split) {
assert(!node->dirty);
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->omt_size() == 1);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
toku_pin_ftnode_off_client_thread(
c_ft->ft,
......@@ -359,7 +359,7 @@ doit (bool after_split) {
assert(!node->dirty);
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->omt_size() == 1);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
}
else {
toku_pin_ftnode_off_client_thread(
......@@ -376,7 +376,7 @@ doit (bool after_split) {
assert(!node->dirty);
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->omt_size() == 2);
toku_unpin_ftnode_off_client_thread(c_ft->ft, node);
toku_unpin_ftnode(c_ft->ft, node);
}
......
......@@ -255,7 +255,7 @@ doit (void) {
assert(node->n_children == 2);
assert(BP_STATE(node,0) == PT_AVAIL);
assert(BP_STATE(node,1) == PT_AVAIL);
toku_unpin_ftnode_off_client_thread(brt->ft, node);
toku_unpin_ftnode(brt->ft, node);
// now do a lookup on one of the keys, this should bring a leaf node up to date
DBT k;
......@@ -285,7 +285,7 @@ doit (void) {
assert(node->n_children == 2);
assert(BP_STATE(node,0) == PT_AVAIL);
assert(BP_STATE(node,1) == PT_AVAIL);
toku_unpin_ftnode_off_client_thread(brt->ft, node);
toku_unpin_ftnode(brt->ft, node);
//
// now let us induce a clean on the internal node
......@@ -329,7 +329,7 @@ doit (void) {
);
// check that buffers are empty
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
toku_unpin_ftnode_off_client_thread(brt->ft, node);
toku_unpin_ftnode(brt->ft, node);
//
// now run a checkpoint to get everything clean,
......
......@@ -266,7 +266,7 @@ doit (bool keep_other_bn_in_memory) {
// that the data is read off disk
assert(BP_STATE(node,0) == PT_ON_DISK);
assert(BP_STATE(node,1) == PT_ON_DISK);
toku_unpin_ftnode_off_client_thread(brt->ft, node);
toku_unpin_ftnode(brt->ft, node);
// now do a lookup on one of the keys, this should bring a leaf node up to date
DBT k;
......@@ -312,7 +312,7 @@ doit (bool keep_other_bn_in_memory) {
else {
assert(BP_STATE(node,1) == PT_ON_DISK);
}
toku_unpin_ftnode_off_client_thread(brt->ft, node);
toku_unpin_ftnode(brt->ft, node);
//
// now let us induce a clean on the internal node
......@@ -354,7 +354,7 @@ doit (bool keep_other_bn_in_memory) {
);
// check that buffers are empty
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
toku_unpin_ftnode_off_client_thread(brt->ft, node);
toku_unpin_ftnode(brt->ft, node);
//
// now run a checkpoint to get everything clean,
......
......@@ -269,7 +269,7 @@ doit (void) {
assert(node->n_children == 1);
// check that buffers are empty
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
toku_unpin_ftnode_off_client_thread(brt->ft, node);
toku_unpin_ftnode(brt->ft, node);
//
// now run a checkpoint to get everything clean,
......
......@@ -164,7 +164,7 @@ doit (void) {
// simply assert that the buffer is less than 50MB,
// we inserted 100MB of data in there.
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) < 50*1000*1000);
toku_unpin_ftnode_off_client_thread(t->ft, node);
toku_unpin_ftnode(t->ft, node);
r = toku_close_ft_handle_nolsn(t, 0); assert(r==0);
toku_cachetable_close(&ct);
......
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