From a761fd631fb882bf8213d80587179abde1e792c7 Mon Sep 17 00:00:00 2001 From: Leif Walsh <leif@tokutek.com> Date: Wed, 15 Aug 2012 18:57:38 +0000 Subject: [PATCH] refs #5367 fix verify to work with marked messages git-svn-id: file:///svn/toku/tokudb@46852 c7de825b-a66e-492c-adef-691d508d4ae1 --- ft/ft-verify.cc | 36 ++++++++++++++++++------ src/tests/threaded_stress_test_helpers.h | 2 +- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ft/ft-verify.cc b/ft/ft-verify.cc index eebe6395db8..fb662d126f3 100644 --- a/ft/ft-verify.cc +++ b/ft/ft-verify.cc @@ -127,10 +127,8 @@ struct verify_message_tree_extra { int keep_going_on_failure; }; -// template-only function, but must be extern -int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) - __attribute__((nonnull(3))); -int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) +__attribute__((nonnull(3))) +static int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) { int verbose = e->verbose; BLOCKNUM blocknum = e->blocknum; @@ -144,8 +142,10 @@ int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct ve VERIFY_ASSERTION(ft_msg_type_applies_once((enum ft_msg_type) entry->type), e->i, "message found in fresh or stale message tree that does not apply once"); if (e->is_fresh) { - VERIFY_ASSERTION(entry->is_fresh, - e->i, "message found in fresh message tree that is not fresh"); + // Disabling this assert because of + // marked messages in the fresh tree + //VERIFY_ASSERTION(entry->is_fresh, + // e->i, "message found in fresh message tree that is not fresh"); } else { VERIFY_ASSERTION(!entry->is_fresh, e->i, "message found in stale message tree that is fresh"); @@ -155,6 +155,19 @@ int verify_message_tree(const int32_t &offset, const uint32_t UU(idx), struct ve return result; } +__attribute__((nonnull(3))) +static int verify_marked_messages(const int32_t &offset, const uint32_t UU(idx), struct verify_message_tree_extra *const e) +{ + int verbose = e->verbose; + BLOCKNUM blocknum = e->blocknum; + int keep_going_on_failure = e->keep_going_on_failure; + int result = 0; + const struct fifo_entry *entry = toku_fifo_get_entry(e->fifo, offset); + VERIFY_ASSERTION(!entry->is_fresh, e->i, "marked message found in the fresh message tree that is fresh"); + done: + return result; +} + template<typename verify_omt_t> static int verify_sorted_by_key_msn(FT_HANDLE brt, FIFO fifo, const verify_omt_t &mt) { @@ -294,14 +307,19 @@ toku_verify_ftnode (FT_HANDLE brt, count = count_eq_key_msn(brt, bnc->buffer, bnc->fresh_message_tree, toku_fill_dbt(&keydbt, key, keylen), msn); if (is_fresh) { VERIFY_ASSERTION(count == 1, i, "a fresh message was not found in the fresh message tree"); + assert(count == 1); } else { - VERIFY_ASSERTION(count == 0, i, "a stale message was found in the fresh message tree"); + // Disabling this assert because of + // marked messages in the fresh 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); if (is_fresh) { VERIFY_ASSERTION(count == 0, i, "a fresh message was found in the stale message tree"); } else { - VERIFY_ASSERTION(count == 1, i, "a stale message was not found in the stale message tree"); + // Disabling this assert because of + // marked messages in the fresh tree + //VERIFY_ASSERTION(count == 1, i, "a stale message was not found in the stale message tree"); } } else { 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"); @@ -317,6 +335,8 @@ toku_verify_ftnode (FT_HANDLE brt, extra.is_fresh = false; r = bnc->stale_message_tree.iterate<struct verify_message_tree_extra, verify_message_tree>(&extra); if (r != 0) { result = r; goto done; } + r = bnc->fresh_message_tree.iterate_over_marked<struct verify_message_tree_extra, verify_marked_messages>(&extra); + if (r != 0) { result = r; goto done; } extra.broadcast = true; r = bnc->broadcast_list.iterate<struct verify_message_tree_extra, verify_message_tree>(&extra); if (r != 0) { result = r; goto done; } diff --git a/src/tests/threaded_stress_test_helpers.h b/src/tests/threaded_stress_test_helpers.h index 2c23905a885..58be68bad9c 100644 --- a/src/tests/threaded_stress_test_helpers.h +++ b/src/tests/threaded_stress_test_helpers.h @@ -890,7 +890,7 @@ static int UU() verify_op(DB_TXN* UU(txn), ARG UU(arg), void* UU(operation_extra int r = 0; for (int i = 0; i < arg->cli->num_DBs; i++) { DB* db = arg->dbp[i]; - r = db->verify_with_progress(db, NULL, NULL, 0, 0); + r = db->verify_with_progress(db, NULL, NULL, 1, 0); CKERR(r); } return r; -- 2.30.9