reset the last_leaf counts every time we enter a new subtree

This commit is contained in:
Joe Thornber 2011-09-02 14:28:42 +01:00
parent e727bc943a
commit c39f782deb

View File

@ -78,6 +78,9 @@ namespace persistent_data {
if (already_visited(n))
return false;
if (!key)
new_root(level);
check_block_nr(n);
check_max_entries(n);
check_nr_entries(n, !key);
@ -92,12 +95,16 @@ namespace persistent_data {
if (already_visited(n))
return false;
if (!key)
new_root(level);
check_block_nr(n);
check_max_entries(n);
check_nr_entries(n, !key);
check_ordered_keys(n);
check_parent_key(key, n);
check_leaf_key(level, n);
return true;
}
@ -107,6 +114,9 @@ namespace persistent_data {
if (already_visited(n))
return false;
if (!key)
new_root(level);
check_block_nr(n);
check_max_entries(n);
check_nr_entries(n, !key);
@ -239,6 +249,12 @@ namespace persistent_data {
last_leaf_key_[level] = n.key_at(n.get_nr_entries() - 1);
}
void new_root(unsigned level) {
// we're starting a new subtree, so should
// reset the last_leaf value.
last_leaf_key_[level] = boost::optional<uint64_t>();
}
block_counter &counter_;
std::set<block_address> seen_;
error_set::ptr errs_;