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

closes #5180 fix ft_verify so it doesn't call the comparison function on...

closes #5180 fix ft_verify so it doesn't call the comparison function on broadcast messages, which don't have keys

git-svn-id: file:///svn/toku/tokudb@45201 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3c72e807
...@@ -101,11 +101,8 @@ get_ith_leafentry (BASEMENTNODE bn, int i) { ...@@ -101,11 +101,8 @@ get_ith_leafentry (BASEMENTNODE bn, int i) {
struct count_msgs_extra { struct count_msgs_extra {
int count; int count;
DBT *key;
MSN msn; MSN msn;
FIFO fifo; FIFO fifo;
DESCRIPTOR desc;
ft_compare_func cmp;
}; };
static int static int
...@@ -114,10 +111,7 @@ count_msgs(OMTVALUE v, u_int32_t UU(idx), void *ve) ...@@ -114,10 +111,7 @@ count_msgs(OMTVALUE v, u_int32_t UU(idx), void *ve)
struct count_msgs_extra *e = ve; struct count_msgs_extra *e = ve;
long offset = (long) v; long offset = (long) v;
const struct fifo_entry *entry = toku_fifo_get_entry(e->fifo, offset); const struct fifo_entry *entry = toku_fifo_get_entry(e->fifo, offset);
DBT dbt; if (entry->msn.msn == e->msn.msn) {
const DBT *buffer_key = fill_dbt_for_fifo_entry(&dbt, entry);
FAKE_DB(db, e->desc);
if (entry->msn.msn == e->msn.msn && e->cmp(&db, e->key, buffer_key) == 0) {
e->count++; e->count++;
} }
return 0; return 0;
...@@ -285,44 +279,27 @@ toku_verify_ftnode (FT_HANDLE brt, ...@@ -285,44 +279,27 @@ toku_verify_ftnode (FT_HANDLE brt,
VERIFY_ASSERTION(r==0, i, "A message in the buffer is out of place"); VERIFY_ASSERTION(r==0, i, "A message in the buffer is out of place");
VERIFY_ASSERTION((msn.msn > last_msn.msn), i, "msn per msg must be monotonically increasing toward newer messages in buffer"); VERIFY_ASSERTION((msn.msn > last_msn.msn), i, "msn per msg must be monotonically increasing toward newer messages in buffer");
VERIFY_ASSERTION((msn.msn <= this_msn.msn), i, "all messages must have msn within limit of this node's max_msn_applied_to_node_in_memory"); VERIFY_ASSERTION((msn.msn <= this_msn.msn), i, "all messages must have msn within limit of this node's max_msn_applied_to_node_in_memory");
int count; if (ft_msg_type_applies_once(type)) {
DBT keydbt; int count;
count = count_eq_key_msn(brt, bnc->buffer, bnc->fresh_message_tree, toku_fill_dbt(&keydbt, key, keylen), msn); DBT keydbt;
if (ft_msg_type_applies_all(type) || ft_msg_type_does_nothing(type)) { toku_fill_dbt(&keydbt, key, keylen);
VERIFY_ASSERTION(count == 0, i, "a broadcast message was found in the fresh message tree"); count = count_eq_key_msn(brt, bnc->buffer, bnc->fresh_message_tree, toku_fill_dbt(&keydbt, key, keylen), msn);
} else {
VERIFY_ASSERTION(ft_msg_type_applies_once(type), i, "a message was found that does not apply either to all or to only one key");
if (is_fresh) { if (is_fresh) {
VERIFY_ASSERTION(count == 1, i, "a fresh message was not found in the fresh message tree"); VERIFY_ASSERTION(count == 1, i, "a fresh message was not found in the fresh message tree");
} else { } else {
VERIFY_ASSERTION(count == 0, i, "a stale message was found in the fresh message tree"); VERIFY_ASSERTION(count == 0, i, "a stale message was found in the fresh message tree");
} }
} count = count_eq_key_msn(brt, bnc->buffer, bnc->stale_message_tree, &keydbt, msn);
count = count_eq_key_msn(brt, bnc->buffer, bnc->stale_message_tree, &keydbt, msn);
if (ft_msg_type_applies_all(type) || ft_msg_type_does_nothing(type)) {
VERIFY_ASSERTION(count == 0, i, "a broadcast message was found in the stale message tree");
} else {
VERIFY_ASSERTION(ft_msg_type_applies_once(type), i, "a message was found that does not apply either to all or to only one key");
if (is_fresh) { if (is_fresh) {
VERIFY_ASSERTION(count == 0, i, "a fresh message was found in the stale message tree"); VERIFY_ASSERTION(count == 0, i, "a fresh message was found in the stale message tree");
} else { } else {
VERIFY_ASSERTION(count == 1, i, "a stale message was not found in the stale message tree"); VERIFY_ASSERTION(count == 1, i, "a stale message was not found in the stale message tree");
} }
}
struct count_msgs_extra extra = { .count = 0, .key = &keydbt,
.msn = msn, .fifo = bnc->buffer,
.desc = &brt->ft->cmp_descriptor, .cmp = brt->ft->compare_fun };
extra.count = 0;
toku_omt_iterate(bnc->broadcast_list, count_msgs, &extra);
if (ft_msg_type_applies_all(type) || ft_msg_type_does_nothing(type)) {
VERIFY_ASSERTION(extra.count == 1, i, "a broadcast message was not found in the broadcast list");
} else { } else {
VERIFY_ASSERTION(ft_msg_type_applies_once(type), i, "a message was found that does not apply either to all or to only one key"); VERIFY_ASSERTION(ft_msg_type_applies_all(type) || ft_msg_type_does_nothing(type), i, "a message was found that does not apply either to all or to only one key");
if (is_fresh) { struct count_msgs_extra extra = { .count = 0, .msn = msn, .fifo = bnc->buffer };
VERIFY_ASSERTION(extra.count == 0, i, "a broadcast message was found in the fresh message tree"); toku_omt_iterate(bnc->broadcast_list, count_msgs, &extra);
} else { VERIFY_ASSERTION(extra.count == 1, i, "a broadcast message was not found in the broadcast list");
VERIFY_ASSERTION(extra.count == 0, i, "a broadcast message was found in the fresh message tree");
}
} }
last_msn = msn; last_msn = msn;
})); }));
......
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