diff --git a/persistent-data/data-structures/btree_damage_visitor.h b/persistent-data/data-structures/btree_damage_visitor.h index 03dfde5..2a8a85b 100644 --- a/persistent-data/data-structures/btree_damage_visitor.h +++ b/persistent-data/data-structures/btree_damage_visitor.h @@ -55,7 +55,7 @@ namespace persistent_data { return r; } - // remembe 'end' is the one-past-the-end value, so + // remember 'end' is the one-past-the-end value, so // take the last key in the leaf and add one. maybe_range64 good_leaf(block_address begin, block_address end) { maybe_range64 r; @@ -192,8 +192,11 @@ namespace persistent_data { void visit_values(btree_path const &path, node_ref const &n) { unsigned nr = n.get_nr_entries(); - for (unsigned i = 0; i < nr; i++) - value_visitor_.visit(path, n.value_at(i)); + for (unsigned i = 0; i < nr; i++) { + btree_path p2(path); + p2.push_back(n.key_at(i)); + value_visitor_.visit(p2, n.value_at(i)); + } } bool check_internal(node_location const &loc, diff --git a/unit-tests/btree_damage_visitor_t.cc b/unit-tests/btree_damage_visitor_t.cc index 48076c0..6afb42a 100644 --- a/unit-tests/btree_damage_visitor_t.cc +++ b/unit-tests/btree_damage_visitor_t.cc @@ -351,7 +351,9 @@ namespace { void expect_value_range(uint64_t begin, uint64_t end) { while (begin < end) { - EXPECT_CALL(value_visitor_, visit(EmptyPath(), Eq(thing(begin, begin + 1234)))).Times(1); + btree_path path; + path.push_back(begin); + EXPECT_CALL(value_visitor_, visit(Eq(path), Eq(thing(begin, begin + 1234)))).Times(1); begin++; } } @@ -360,8 +362,10 @@ namespace { expect_value_range(0, nr); } - void expect_value(unsigned n) { - EXPECT_CALL(value_visitor_, visit(EmptyPath(), Eq(thing(n, n + 1234)))).Times(1); + void expect_value(uint64_t n) { + btree_path path; + path.push_back(n); + EXPECT_CALL(value_visitor_, visit(Eq(path), Eq(thing(n, n + 1234)))).Times(1); } void expect_damage(range keys) { @@ -415,6 +419,7 @@ namespace { uint64_t key[2] = {sub_tree, i}; btree_path path; path.push_back(sub_tree); + path.push_back(i); EXPECT_CALL(value_visitor_, visit(Eq(path), Eq(key_to_value(key)))); } @@ -436,6 +441,7 @@ namespace { btree_path p2; p2.push_back(sub_tree); + p2.push_back(i); EXPECT_CALL(value_visitor_, visit(Eq(p2), Eq(key_to_value(key)))); } }