Skip to content

Commit

Permalink
Fixed non-release build duplication of down_buf_count
Browse files Browse the repository at this point in the history
  • Loading branch information
hkadayam committed Aug 2, 2024
1 parent 2be0b6c commit 69992b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
7 changes: 5 additions & 2 deletions src/lib/index/index_cp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,11 @@ void IndexCPContext::process_txn_record(txn_record const* rec, std::map< BlkId,
if (found) { return buf; }
real_up_buf->m_down_buffers.emplace_back(buf);
#endif
real_up_buf->m_wait_for_down_buffers.increment(1);
buf->m_up_buffer = real_up_buf;

if (buf->m_up_buffer != real_up_buf) {
real_up_buf->m_wait_for_down_buffers.increment(1);
buf->m_up_buffer = real_up_buf;
}
}
return buf;
};
Expand Down
20 changes: 11 additions & 9 deletions src/tests/test_index_crash_recovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,20 @@ struct IndexCrashTest : public test_common::HSTestHelper, BtreeTestHelper< TestT
void reapply_after_crash() {
ShadowMap< K, V > snapshot_map{this->m_shadow_map.max_keys()};
snapshot_map.load(m_shadow_filename);
LOGINFO("\tSnapshot before crash\n{}", snapshot_map.to_string());
LOGDEBUG("\tSnapshot before crash\n{}", snapshot_map.to_string());
auto diff = this->m_shadow_map.diff(snapshot_map);

// visualize tree after crash
// std::string recovered_tree_filename = "tree_after_crash_" + to_string(rand() % 100) + ".dot";
// this->visualize_keys(recovered_tree_filename);
// LOGINFO(" tree after recovered stored in {}", recovered_tree_filename);

std::string dif_str = "KEY \tADDITION\n";
for (const auto& [k, addition] : diff) {
dif_str += fmt::format(" {} \t{}\n", k.key(), addition);
}
// visualize tree after crash
std::string recovered_tree_filename = "tree_after_crash_" + to_string(rand() % 100) + ".dot";
// this->visualize_keys(recovered_tree_filename);
LOGINFO(" tree after recovered stored in {}", recovered_tree_filename);
// test_common::HSTestHelper::trigger_cp(true);
LOGINFO("Diff between shadow map and snapshot map\n{}\n", dif_str);
LOGDEBUG("Diff between shadow map and snapshot map\n{}\n", dif_str);

for (const auto& [k, addition] : diff) {
// this->print_keys(fmt::format("reapply: before inserting key {}", k.key()));
// this->visualize_keys(recovered_tree_filename);
Expand Down Expand Up @@ -244,8 +246,8 @@ TYPED_TEST(IndexCrashTest, SplitOnLeftEdge) {
this->set_basic_flip("crash_flush_on_split_at_left_child");
this->visualize_keys("tree_before_insert.dot");
for (auto k = num_entries / 4; k < num_entries / 2; ++k) {
LOGINFO("inserting key {}", k);
this->visualize_keys("tree_before_" + to_string(k) + ".dot");
// LOGINFO("inserting key {}", k);
// this->visualize_keys("tree_before_" + to_string(k) + ".dot");
this->put(k, btree_put_type::INSERT, true /* expect_success */);
}
this->visualize_keys("tree_before_crash.dot");
Expand Down

0 comments on commit 69992b6

Please sign in to comment.