Commit a06c520e authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

refs #5559, set child->oldest_known_referenced_xid in toku_bnc_flush_to_child,...

refs #5559, set child->oldest_known_referenced_xid in toku_bnc_flush_to_child, remove oldest_known_referenced_xid as parameter to ft_flush_some_child

git-svn-id: file:///svn/toku/tokudb@50821 c7de825b-a66e-492c-adef-691d508d4ae1
parent 280d20b0
...@@ -1510,11 +1510,11 @@ ft_merge_child( ...@@ -1510,11 +1510,11 @@ ft_merge_child(
} }
} }
static void ft_flush_some_child_with_xid( static void ft_flush_some_child(
FT ft, FT ft,
FTNODE parent, FTNODE parent,
struct flusher_advice *fa, struct flusher_advice *fa
TXNID oldest_referenced_xid) )
// Effect: This function does the following: // Effect: This function does the following:
// - Pick a child of parent (the heaviest child), // - Pick a child of parent (the heaviest child),
// - flush from parent to child, // - flush from parent to child,
...@@ -1528,6 +1528,7 @@ static void ft_flush_some_child_with_xid( ...@@ -1528,6 +1528,7 @@ static void ft_flush_some_child_with_xid(
NONLEAF_CHILDINFO bnc = NULL; NONLEAF_CHILDINFO bnc = NULL;
paranoid_invariant(parent->height>0); paranoid_invariant(parent->height>0);
toku_assert_entire_node_in_memory(parent); toku_assert_entire_node_in_memory(parent);
TXNID oldest_referenced_xid = parent->oldest_known_referenced_xid;
// pick the child we want to flush to // pick the child we want to flush to
int childnum = fa->pick_child(ft, parent, fa->extra); int childnum = fa->pick_child(ft, parent, fa->extra);
...@@ -1644,10 +1645,10 @@ static void ft_flush_some_child_with_xid( ...@@ -1644,10 +1645,10 @@ static void ft_flush_some_child_with_xid(
parent = NULL; parent = NULL;
} }
// //
// it is the responsibility of ft_flush_some_child_with_xid to unpin child // it is the responsibility of ft_flush_some_child to unpin child
// //
if (child->height > 0 && fa->should_recursively_flush(child, fa->extra)) { if (child->height > 0 && fa->should_recursively_flush(child, fa->extra)) {
ft_flush_some_child_with_xid(ft, child, fa, oldest_referenced_xid); ft_flush_some_child(ft, child, fa);
} }
else { else {
toku_unpin_ftnode_off_client_thread(ft, child); toku_unpin_ftnode_off_client_thread(ft, child);
...@@ -1678,7 +1679,7 @@ void toku_ft_flush_some_child(FT ft, FTNODE parent, struct flusher_advice *fa) { ...@@ -1678,7 +1679,7 @@ void toku_ft_flush_some_child(FT ft, FTNODE parent, struct flusher_advice *fa) {
// Vanilla flush_some_child flushes from parent to child without // Vanilla flush_some_child flushes from parent to child without
// providing a meaningful oldest_referenced_xid. No simple garbage // providing a meaningful oldest_referenced_xid. No simple garbage
// collection is performed. // collection is performed.
return ft_flush_some_child_with_xid(ft, parent, fa, TXNID_NONE); return ft_flush_some_child(ft, parent, fa);
} }
static void static void
...@@ -1865,11 +1866,11 @@ static void flush_node_fun(void *fe_v) ...@@ -1865,11 +1866,11 @@ static void flush_node_fun(void *fe_v)
destroy_nonleaf_childinfo(fe->bnc); destroy_nonleaf_childinfo(fe->bnc);
// after the flush has completed, now check to see if the node needs flushing // after the flush has completed, now check to see if the node needs flushing
// If so, call ft_flush_some_child_with_xid on the node (because this flush intends to // If so, call ft_flush_some_child on the node (because this flush intends to
// pass a meaningful oldest referenced xid for simple garbage collection), and it is the // pass a meaningful oldest referenced xid for simple garbage collection), and it is the
// responsibility of the flush to unlock the node. otherwise, we unlock it here. // responsibility of the flush to unlock the node. otherwise, we unlock it here.
if (fe->node->height > 0 && toku_ft_nonleaf_is_gorged(fe->node, fe->h->h->nodesize)) { if (fe->node->height > 0 && toku_ft_nonleaf_is_gorged(fe->node, fe->h->h->nodesize)) {
ft_flush_some_child_with_xid(fe->h, fe->node, &fa, fe->oldest_referenced_xid); ft_flush_some_child(fe->h, fe->node, &fa);
} }
else { else {
toku_unpin_ftnode_off_client_thread(fe->h,fe->node); toku_unpin_ftnode_off_client_thread(fe->h,fe->node);
...@@ -1880,7 +1881,7 @@ static void flush_node_fun(void *fe_v) ...@@ -1880,7 +1881,7 @@ static void flush_node_fun(void *fe_v)
// bnc, which means we are tasked with flushing some // bnc, which means we are tasked with flushing some
// buffer in the node. // buffer in the node.
// It is the responsibility of flush some child to unlock the node // It is the responsibility of flush some child to unlock the node
ft_flush_some_child_with_xid(fe->h, fe->node, &fa, fe->oldest_referenced_xid); ft_flush_some_child(fe->h, fe->node, &fa);
} }
remove_background_job_from_cf(fe->h->cf); remove_background_job_from_cf(fe->h->cf);
toku_free(fe); toku_free(fe);
......
...@@ -2315,6 +2315,7 @@ void toku_bnc_flush_to_child( ...@@ -2315,6 +2315,7 @@ void toku_bnc_flush_to_child(
); );
remaining_memsize -= FIFO_CURRENT_ENTRY_MEMSIZE; remaining_memsize -= FIFO_CURRENT_ENTRY_MEMSIZE;
})); }));
child->oldest_known_referenced_xid = oldest_known_referenced_xid;
invariant(remaining_memsize == 0); invariant(remaining_memsize == 0);
if (stats_delta.numbytes || stats_delta.numrows) { if (stats_delta.numbytes || stats_delta.numrows) {
......
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