Commit 7b3d8781 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4875] remove toku_mark_node_dirty since it's not really used anymore


git-svn-id: file:///svn/toku/tokudb@43886 c7de825b-a66e-492c-adef-691d508d4ae1
parent cda3e981
...@@ -495,7 +495,7 @@ handle_split_of_child( ...@@ -495,7 +495,7 @@ handle_split_of_child(
} }
) )
toku_mark_node_dirty(node); node->dirty = 1;
XREALLOC_N(node->n_children+1, node->bp); XREALLOC_N(node->n_children+1, node->bp);
XREALLOC_N(node->n_children, node->childkeys); XREALLOC_N(node->n_children, node->childkeys);
...@@ -899,8 +899,8 @@ ftleaf_split( ...@@ -899,8 +899,8 @@ ftleaf_split(
node->max_msn_applied_to_node_on_disk = max_msn_applied_to_node; node->max_msn_applied_to_node_on_disk = max_msn_applied_to_node;
B->max_msn_applied_to_node_on_disk = max_msn_applied_to_node; B->max_msn_applied_to_node_on_disk = max_msn_applied_to_node;
toku_mark_node_dirty(node); node->dirty = 1;
toku_mark_node_dirty(B); B->dirty = 1;
*nodea = node; *nodea = node;
*nodeb = B; *nodeb = B;
...@@ -971,8 +971,8 @@ ft_nonleaf_split( ...@@ -971,8 +971,8 @@ ft_nonleaf_split(
node->max_msn_applied_to_node_on_disk = max_msn_applied_to_node; node->max_msn_applied_to_node_on_disk = max_msn_applied_to_node;
B->max_msn_applied_to_node_on_disk = max_msn_applied_to_node; B->max_msn_applied_to_node_on_disk = max_msn_applied_to_node;
toku_mark_node_dirty(node); node->dirty = 1;
toku_mark_node_dirty(B); node->dirty = 1;
toku_assert_entire_node_in_memory(node); toku_assert_entire_node_in_memory(node);
toku_assert_entire_node_in_memory(B); toku_assert_entire_node_in_memory(B);
//VERIFY_NODE(t,node); //VERIFY_NODE(t,node);
...@@ -1064,8 +1064,8 @@ flush_this_child( ...@@ -1064,8 +1064,8 @@ flush_this_child(
assert(child->thisnodename.b!=0); assert(child->thisnodename.b!=0);
// VERIFY_NODE does not work off client thread as of now // VERIFY_NODE does not work off client thread as of now
//VERIFY_NODE(t, child); //VERIFY_NODE(t, child);
toku_mark_node_dirty(node); node->dirty = 1;
toku_mark_node_dirty(child); child->dirty = 1;
BP_WORKDONE(node, childnum) = 0; // this buffer is drained, no work has been done by its contents BP_WORKDONE(node, childnum) = 0; // this buffer is drained, no work has been done by its contents
NONLEAF_CHILDINFO bnc = BNC(node, childnum); NONLEAF_CHILDINFO bnc = BNC(node, childnum);
...@@ -1091,8 +1091,11 @@ merge_leaf_nodes(FTNODE a, FTNODE b) ...@@ -1091,8 +1091,11 @@ merge_leaf_nodes(FTNODE a, FTNODE b)
// This way, whatever deltas are accumulated in the basements are // This way, whatever deltas are accumulated in the basements are
// applied to the in_memory_stats in the header if they have not already // applied to the in_memory_stats in the header if they have not already
// been (if nodes are clean). // been (if nodes are clean).
toku_mark_node_dirty(a); // TODO(leif): this is no longer the way in_memory_stats is
toku_mark_node_dirty(b); // maintained. verify that it's ok to move this just before the unpin
// and then do that.
a->dirty = 1;
b->dirty = 1;
// this BOOL states if the last basement node in a has any items or not // this BOOL states if the last basement node in a has any items or not
// If it does, then it stays in the merge. If it does not, the last basement node // If it does, then it stays in the merge. If it does not, the last basement node
...@@ -1241,8 +1244,8 @@ maybe_merge_pinned_nonleaf_nodes( ...@@ -1241,8 +1244,8 @@ maybe_merge_pinned_nonleaf_nodes(
b->totalchildkeylens = 0; b->totalchildkeylens = 0;
b->n_children = 0; b->n_children = 0;
toku_mark_node_dirty(a); a->dirty = 1;
toku_mark_node_dirty(b); b->dirty = 1;
*did_merge = TRUE; *did_merge = TRUE;
*did_rebalance = FALSE; *did_rebalance = FALSE;
...@@ -1283,7 +1286,7 @@ maybe_merge_pinned_nodes( ...@@ -1283,7 +1286,7 @@ maybe_merge_pinned_nodes(
toku_assert_entire_node_in_memory(parent); toku_assert_entire_node_in_memory(parent);
toku_assert_entire_node_in_memory(a); toku_assert_entire_node_in_memory(a);
toku_assert_entire_node_in_memory(b); toku_assert_entire_node_in_memory(b);
toku_mark_node_dirty(parent); // just to make sure parent->dirty = 1; // just to make sure
{ {
MSN msna = a->max_msn_applied_to_node_on_disk; MSN msna = a->max_msn_applied_to_node_on_disk;
MSN msnb = b->max_msn_applied_to_node_on_disk; MSN msnb = b->max_msn_applied_to_node_on_disk;
...@@ -1415,13 +1418,13 @@ ft_merge_child( ...@@ -1415,13 +1418,13 @@ ft_merge_child(
(node->n_children-childnumb)*sizeof(node->childkeys[0])); (node->n_children-childnumb)*sizeof(node->childkeys[0]));
REALLOC_N(node->n_children-1, node->childkeys); REALLOC_N(node->n_children-1, node->childkeys);
assert(BP_BLOCKNUM(node, childnuma).b == childa->thisnodename.b); assert(BP_BLOCKNUM(node, childnuma).b == childa->thisnodename.b);
toku_mark_node_dirty(childa); // just to make sure childa->dirty = 1; // just to make sure
toku_mark_node_dirty(childb); // just to make sure childb->dirty = 1; // just to make sure
} else { } else {
// If we didn't merge the nodes, then we need the correct pivot. // If we didn't merge the nodes, then we need the correct pivot.
toku_copyref_dbt(&node->childkeys[childnuma], splitk); toku_copyref_dbt(&node->childkeys[childnuma], splitk);
node->totalchildkeylens += node->childkeys[childnuma].size; node->totalchildkeylens += node->childkeys[childnuma].size;
toku_mark_node_dirty(node); node->dirty = 1;
} }
} }
// //
...@@ -1522,7 +1525,7 @@ flush_some_child( ...@@ -1522,7 +1525,7 @@ flush_some_child(
if (toku_bnc_n_entries(BNC(parent, childnum)) > 0) { if (toku_bnc_n_entries(BNC(parent, childnum)) > 0) {
if (!parent->dirty) { if (!parent->dirty) {
dirtied++; dirtied++;
toku_mark_node_dirty(parent); parent->dirty = 1;
} }
// detach buffer // detach buffer
BP_WORKDONE(parent, childnum) = 0; // this buffer is drained, no work has been done by its contents BP_WORKDONE(parent, childnum) = 0; // this buffer is drained, no work has been done by its contents
...@@ -1567,7 +1570,7 @@ flush_some_child( ...@@ -1567,7 +1570,7 @@ flush_some_child(
if (bnc != NULL) { if (bnc != NULL) {
if (!child->dirty) { if (!child->dirty) {
dirtied++; dirtied++;
toku_mark_node_dirty(child); child->dirty = 1;
} }
// do the actual flush // do the actual flush
r = toku_bnc_flush_to_child( r = toku_bnc_flush_to_child(
...@@ -1717,7 +1720,7 @@ static void flush_node_fun(void *fe_v) ...@@ -1717,7 +1720,7 @@ static void flush_node_fun(void *fe_v)
// read them back in, or just do the regular partial fetch. If we // read them back in, or just do the regular partial fetch. If we
// don't, that means fe->node is a parent, so we need to do this anyway. // don't, that means fe->node is a parent, so we need to do this anyway.
bring_node_fully_into_memory(fe->node,fe->h); bring_node_fully_into_memory(fe->node,fe->h);
toku_mark_node_dirty(fe->node); fe->node->dirty = 1;
struct flusher_advice fa; struct flusher_advice fa;
struct flush_status_update_extra fste; struct flush_status_update_extra fste;
...@@ -1829,7 +1832,7 @@ flush_node_on_background_thread(FT h, FTNODE parent) ...@@ -1829,7 +1832,7 @@ flush_node_on_background_thread(FT h, FTNODE parent)
// //
// can detach buffer and unpin root here // can detach buffer and unpin root here
// //
toku_mark_node_dirty(parent); parent->dirty = 1;
BP_WORKDONE(parent, childnum) = 0; // this buffer is drained, no work has been done by its contents BP_WORKDONE(parent, childnum) = 0; // this buffer is drained, no work has been done by its contents
NONLEAF_CHILDINFO bnc = BNC(parent, childnum); NONLEAF_CHILDINFO bnc = BNC(parent, childnum);
set_BNC(parent, childnum, toku_create_empty_nl()); set_BNC(parent, childnum, toku_create_empty_nl());
......
...@@ -492,11 +492,6 @@ void toku_ft_nonleaf_append_child(FTNODE node, FTNODE child, const DBT *pivotkey ...@@ -492,11 +492,6 @@ void toku_ft_nonleaf_append_child(FTNODE node, FTNODE child, const DBT *pivotkey
// append a cmd to a nonleaf node child buffer // append a cmd to a nonleaf node child buffer
void toku_ft_append_to_child_buffer(ft_compare_func compare_fun, DESCRIPTOR desc, FTNODE node, int childnum, enum ft_msg_type type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val); void toku_ft_append_to_child_buffer(ft_compare_func compare_fun, DESCRIPTOR desc, FTNODE node, int childnum, enum ft_msg_type type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val);
// Mark a node as dirty and update statistics in header.
// Other than the node's constructor, this should be the ONLY place
// a brt node is marked as dirty.
void toku_mark_node_dirty(FTNODE node);
STAT64INFO_S toku_get_and_clear_basement_stats(FTNODE leafnode); STAT64INFO_S toku_get_and_clear_basement_stats(FTNODE leafnode);
...@@ -845,8 +840,6 @@ typedef enum { ...@@ -845,8 +840,6 @@ typedef enum {
FT_CREATE_NONLEAF, // number of nonleaf nodes created FT_CREATE_NONLEAF, // number of nonleaf nodes created
FT_DESTROY_LEAF, // number of leaf nodes destroyed FT_DESTROY_LEAF, // number of leaf nodes destroyed
FT_DESTROY_NONLEAF, // number of nonleaf nodes destroyed FT_DESTROY_NONLEAF, // number of nonleaf nodes destroyed
FT_DIRTY_LEAF, // number of times leaf nodes are dirtied when previously clean
FT_DIRTY_NONLEAF, // number of times nonleaf nodes are dirtied when previously clean
FT_MSG_BYTES_IN, // how many bytes of messages injected at root (for all trees) FT_MSG_BYTES_IN, // how many bytes of messages injected at root (for all trees)
FT_MSG_BYTES_OUT, // how many bytes of messages flushed from h1 nodes to leaves FT_MSG_BYTES_OUT, // how many bytes of messages flushed from h1 nodes to leaves
FT_MSG_BYTES_CURR, // how many bytes of messages currently in trees (estimate) FT_MSG_BYTES_CURR, // how many bytes of messages currently in trees (estimate)
......
...@@ -174,8 +174,6 @@ status_init(void) ...@@ -174,8 +174,6 @@ status_init(void)
STATUS_INIT(FT_CREATE_NONLEAF, UINT64, "nonleaf nodes created"); STATUS_INIT(FT_CREATE_NONLEAF, UINT64, "nonleaf nodes created");
STATUS_INIT(FT_DESTROY_LEAF, UINT64, "leaf nodes destroyed"); STATUS_INIT(FT_DESTROY_LEAF, UINT64, "leaf nodes destroyed");
STATUS_INIT(FT_DESTROY_NONLEAF, UINT64, "nonleaf nodes destroyed"); STATUS_INIT(FT_DESTROY_NONLEAF, UINT64, "nonleaf nodes destroyed");
STATUS_INIT(FT_DIRTY_LEAF, UINT64, "leaf node transitions clean -> dirty");
STATUS_INIT(FT_DIRTY_NONLEAF, UINT64, "nonleaf node transitions clean -> dirty");
STATUS_INIT(FT_MSG_BYTES_IN, UINT64, "bytes of messages injected at root (all trees)"); STATUS_INIT(FT_MSG_BYTES_IN, UINT64, "bytes of messages injected at root (all trees)");
STATUS_INIT(FT_MSG_BYTES_OUT, UINT64, "bytes of messages flushed from h1 nodes to leaves"); STATUS_INIT(FT_MSG_BYTES_OUT, UINT64, "bytes of messages flushed from h1 nodes to leaves");
STATUS_INIT(FT_MSG_BYTES_CURR, UINT64, "bytes of messages currently in trees (estimate)"); STATUS_INIT(FT_MSG_BYTES_CURR, UINT64, "bytes of messages currently in trees (estimate)");
...@@ -580,22 +578,6 @@ toku_get_and_clear_basement_stats(FTNODE leafnode) { ...@@ -580,22 +578,6 @@ toku_get_and_clear_basement_stats(FTNODE leafnode) {
return deltas; return deltas;
} }
// This is the ONLY place where a node is marked as dirty, other than toku_initialize_empty_ftnode().
void
toku_mark_node_dirty(FTNODE node) {
// If node is a leafnode, and if it has any basements, and if it is clean, then:
// update the header with the aggregate of the deltas in the basements (do NOT clear the deltas).
if (!node->dirty) {
if (node->height == 0) {
STATUS_VALUE(FT_DIRTY_LEAF)++;
}
else {
STATUS_VALUE(FT_DIRTY_NONLEAF)++;
}
}
node->dirty = 1;
}
static void ft_status_update_flush_reason(FTNODE node, BOOL for_checkpoint) { static void ft_status_update_flush_reason(FTNODE node, BOOL for_checkpoint) {
if (node->height == 0) { if (node->height == 0) {
if (for_checkpoint) { if (for_checkpoint) {
...@@ -1318,7 +1300,7 @@ ft_init_new_root(FT h, FTNODE nodea, FTNODE nodeb, DBT splitk, CACHEKEY *rootp, ...@@ -1318,7 +1300,7 @@ ft_init_new_root(FT h, FTNODE nodea, FTNODE nodeb, DBT splitk, CACHEKEY *rootp,
} }
BP_STATE(newroot,0) = PT_AVAIL; BP_STATE(newroot,0) = PT_AVAIL;
BP_STATE(newroot,1) = PT_AVAIL; BP_STATE(newroot,1) = PT_AVAIL;
toku_mark_node_dirty(newroot); newroot->dirty = 1;
toku_unpin_ftnode(h, nodea); toku_unpin_ftnode(h, nodea);
toku_unpin_ftnode(h, nodeb); toku_unpin_ftnode(h, nodeb);
//printf("%s:%d put %lld\n", __FILE__, __LINE__, newroot_diskoff); //printf("%s:%d put %lld\n", __FILE__, __LINE__, newroot_diskoff);
...@@ -1354,7 +1336,7 @@ toku_ft_nonleaf_append_child(FTNODE node, FTNODE child, const DBT *pivotkey) { ...@@ -1354,7 +1336,7 @@ toku_ft_nonleaf_append_child(FTNODE node, FTNODE child, const DBT *pivotkey) {
invariant(childnum > 0); invariant(childnum > 0);
init_childkey(node, childnum-1, pivotkey); init_childkey(node, childnum-1, pivotkey);
} }
toku_mark_node_dirty(node); node->dirty = 1;
} }
static void static void
...@@ -1871,7 +1853,7 @@ toku_ft_append_to_child_buffer(ft_compare_func compare_fun, DESCRIPTOR desc, FTN ...@@ -1871,7 +1853,7 @@ toku_ft_append_to_child_buffer(ft_compare_func compare_fun, DESCRIPTOR desc, FTN
assert(BP_STATE(node,childnum) == PT_AVAIL); assert(BP_STATE(node,childnum) == PT_AVAIL);
int r = toku_bnc_insert_msg(BNC(node, childnum), key->data, key->size, val->data, val->size, type, msn, xids, is_fresh, desc, compare_fun); int r = toku_bnc_insert_msg(BNC(node, childnum), key->data, key->size, val->data, val->size, type, msn, xids, is_fresh, desc, compare_fun);
invariant_zero(r); invariant_zero(r);
toku_mark_node_dirty(node); node->dirty = 1;
} }
static void ft_nonleaf_cmd_once_to_child (ft_compare_func compare_fun, DESCRIPTOR desc, FTNODE node, unsigned int childnum, FT_MSG cmd, bool is_fresh) static void ft_nonleaf_cmd_once_to_child (ft_compare_func compare_fun, DESCRIPTOR desc, FTNODE node, unsigned int childnum, FT_MSG cmd, bool is_fresh)
...@@ -2371,7 +2353,7 @@ void toku_ft_leaf_apply_cmd( ...@@ -2371,7 +2353,7 @@ void toku_ft_leaf_apply_cmd(
// be reapplied later), we mark the node as dirty and // be reapplied later), we mark the node as dirty and
// take the opportunity to update node->max_msn_applied_to_node_on_disk. // take the opportunity to update node->max_msn_applied_to_node_on_disk.
// //
toku_mark_node_dirty(node); node->dirty = 1;
// //
// we cannot blindly update node->max_msn_applied_to_node_on_disk, // we cannot blindly update node->max_msn_applied_to_node_on_disk,
......
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