Commit 6bf59eff authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4924], assert that entire node is in memory in toku_apply_cmd_to_leaf

git-svn-id: file:///svn/toku/tokudb@37958 c7de825b-a66e-492c-adef-691d508d4ae1
parent 683695be
...@@ -2089,9 +2089,8 @@ static const struct pivot_bounds infinite_bounds = {.lower_bound_exclusive=NULL, ...@@ -2089,9 +2089,8 @@ static const struct pivot_bounds infinite_bounds = {.lower_bound_exclusive=NULL,
// Effect: applies the cmd to the leaf if the appropriate basement node is in memory. // Effect: applies the cmd to the leaf if the appropriate basement node is in memory.
// If the appropriate basement node is not in memory, then nothing gets applied // This function is called during message injection and/or flushing, so the entire
// If the appropriate basement node must be in memory, it is the caller's responsibility to ensure // node MUST be in memory.
// that it is
void toku_apply_cmd_to_leaf( void toku_apply_cmd_to_leaf(
brt_compare_func compare_fun, brt_compare_func compare_fun,
brt_update_func update_fun, brt_update_func update_fun,
...@@ -2105,55 +2104,47 @@ void toku_apply_cmd_to_leaf( ...@@ -2105,55 +2104,47 @@ void toku_apply_cmd_to_leaf(
) )
{ {
VERIFY_NODE(t, node); VERIFY_NODE(t, node);
// ignore messages that have already been applied to this leaf toku_assert_entire_node_in_memory(node);
if (brt_msg_applies_once(cmd)) { if (brt_msg_applies_once(cmd)) {
unsigned int childnum = toku_brtnode_which_child(node, cmd->u.id.key, desc, compare_fun); unsigned int childnum = toku_brtnode_which_child(node, cmd->u.id.key, desc, compare_fun);
// only apply the message if we have an available basement node that is up to date if (cmd->msn.msn > BLB(node, childnum)->max_msn_applied.msn) {
// we know it is up to date if partition_requires_msg_application returns FALSE BLB(node, childnum)->max_msn_applied = cmd->msn;
if (BP_STATE(node,childnum) == PT_AVAIL) { brt_leaf_put_cmd(compare_fun,
update_fun,
desc,
node,
BLB(node, childnum),
cmd,
made_change,
workdone,
snapshot_txnids,
live_list_reverse);
} else {
brt_status.msn_discards++;
}
}
else if (brt_msg_applies_all(cmd)) {
bool bn_made_change = false;
for (int childnum=0; childnum<node->n_children; childnum++) {
if (cmd->msn.msn > BLB(node, childnum)->max_msn_applied.msn) { if (cmd->msn.msn > BLB(node, childnum)->max_msn_applied.msn) {
BLB(node, childnum)->max_msn_applied = cmd->msn; BLB(node, childnum)->max_msn_applied = cmd->msn;
brt_leaf_put_cmd(compare_fun, brt_leaf_put_cmd(compare_fun,
update_fun, update_fun,
desc, desc,
node, node,
BLB(node, childnum), BLB(node, childnum),
cmd, cmd,
made_change, &bn_made_change,
workdone, workdone,
snapshot_txnids, snapshot_txnids,
live_list_reverse); live_list_reverse);
if (bn_made_change) *made_change = 1;
} else { } else {
brt_status.msn_discards++; brt_status.msn_discards++;
} }
} }
} }
else if (brt_msg_applies_all(cmd)) {
bool bn_made_change = false;
for (int childnum=0; childnum<node->n_children; childnum++) {
// only apply the message if we have an available basement node that is up to date
// we know it is up to date if partition_requires_msg_application returns FALSE
if (BP_STATE(node,childnum) == PT_AVAIL) {
if (cmd->msn.msn > BLB(node, childnum)->max_msn_applied.msn) {
BLB(node, childnum)->max_msn_applied = cmd->msn;
brt_leaf_put_cmd(compare_fun,
update_fun,
desc,
node,
BLB(node, childnum),
cmd,
&bn_made_change,
workdone,
snapshot_txnids,
live_list_reverse);
if (bn_made_change) *made_change = 1;
} else {
brt_status.msn_discards++;
}
}
}
}
else if (!brt_msg_does_nothing(cmd)) { else if (!brt_msg_does_nothing(cmd)) {
assert(FALSE); assert(FALSE);
} }
......
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