Commit 9d6f6e30 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 c29ccbff
...@@ -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,13 +2104,10 @@ void toku_apply_cmd_to_leaf( ...@@ -2105,13 +2104,10 @@ 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
// 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) { 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,
...@@ -2128,13 +2124,9 @@ void toku_apply_cmd_to_leaf( ...@@ -2128,13 +2124,9 @@ void toku_apply_cmd_to_leaf(
brt_status.msn_discards++; brt_status.msn_discards++;
} }
} }
}
else if (brt_msg_applies_all(cmd)) { else if (brt_msg_applies_all(cmd)) {
bool bn_made_change = false; bool bn_made_change = false;
for (int childnum=0; childnum<node->n_children; childnum++) { 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) { 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,
...@@ -2153,7 +2145,6 @@ void toku_apply_cmd_to_leaf( ...@@ -2153,7 +2145,6 @@ void toku_apply_cmd_to_leaf(
} }
} }
} }
}
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