Commit d28f7b1f authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5861 fix the bug on mainline


git-svn-id: file:///svn/toku/tokudb@51529 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1feb5a30
...@@ -2693,19 +2693,19 @@ static bool process_maybe_reactive_child(FT ft, FTNODE parent, FTNODE child, int ...@@ -2693,19 +2693,19 @@ static bool process_maybe_reactive_child(FT ft, FTNODE parent, FTNODE child, int
child_fullhash = compute_child_fullhash(ft->cf, 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_batched(ft, child_blocknum, child_fullhash, &bfe, PL_READ, 1, &newparent, &newchild);
newre = get_node_reactivity(newchild, ft->h->nodesize); newre = get_node_reactivity(newchild, ft->h->nodesize);
if (newre == RE_FUSIBLE) { if (newre == RE_FUSIBLE && newparent->n_children >= 2) {
if (newparent->n_children < 2) {
// weird case where newparent is the root node and
// can't merge, so it might only have one child. In
// this case, just return false so we can insert
// anyway.
return false;
}
toku_unpin_ftnode_read_only(ft, newchild); toku_unpin_ftnode_read_only(ft, newchild);
toku_ft_merge_child(ft, newparent, childnum); toku_ft_merge_child(ft, newparent, childnum);
} else { } else {
// some other thread already got it, just unpin and tell the // Could be a weird case where newparent has only one
// caller to retry // child. In this case, we want to inject here but we've
// already unpinned the caller's copy of parent so we have
// to ask them to re-pin, or they could (very rarely)
// dereferenced memory in a freed node. TODO: we could
// give them back the copy of the parent we pinned.
//
// Otherwise, some other thread already got it, just unpin
// and tell the caller to retry
toku_unpin_ftnode_read_only(ft, newchild); toku_unpin_ftnode_read_only(ft, newchild);
toku_unpin_ftnode_read_only(ft, newparent); toku_unpin_ftnode_read_only(ft, newparent);
} }
......
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