Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lidezhu committed Jun 16, 2023
1 parent b713439 commit cc2038d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
5 changes: 2 additions & 3 deletions dbms/src/Storages/Page/V3/PageDirectoryFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ void PageDirectoryFactory<Trait>::loadEdit(const PageDirectoryPtr & dir, const P
{
for (const auto & r : edit.getRecords())
{
if (r.version < max_applied_ver)
continue;
max_applied_ver = r.version;
if (max_applied_ver < r.version)
max_applied_ver = r.version;

if (dump_entries)
LOG_INFO(Logger::get(), "{}", r);
Expand Down
39 changes: 21 additions & 18 deletions dbms/src/Storages/Page/V3/tests/gtest_page_storage_gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,28 +269,31 @@ try
}

FailPointHelper::enableFailPoint(FailPoints::force_ps_wal_compact);
auto sp_gc = getSyncPoint();
auto th_gc = std::async([&]() {
auto done_full_gc = page_storage->gcImpl(/* not_skip */ true, nullptr, nullptr);
ASSERT_EQ(expectFullGCExecute(), done_full_gc);
});
// let's compact the WAL logs
sp_gc.waitAndPause();

{
// the delete timing is decide by `sp_gc`
WriteBatch batch;
batch.delPage(ref_page_id2);
batch.delPage(ref_page_id3);
batch.delPage(ref_page_id4);
page_storage->write(std::move(batch));
}
auto sp_gc = getSyncPoint();
auto th_gc = std::async([&]() {
auto done_full_gc = page_storage->gcImpl(/* not_skip */ true, nullptr, nullptr);
ASSERT_EQ(expectFullGCExecute(), done_full_gc);
});
// let's compact the WAL logs
sp_gc.waitAndPause();

// let's try full gc
sp_gc.next();
th_gc.get();
{
// the delete timing is decide by `sp_gc`
WriteBatch batch;
batch.delPage(ref_page_id2);
batch.delPage(ref_page_id3);
batch.delPage(ref_page_id4);
page_storage->write(std::move(batch));
}

// let's try full gc
sp_gc.next();
th_gc.get();
}

// wal compact again
page_storage->gcImpl(/* not_skip */ true, nullptr, nullptr);
page_storage->page_directory->tryDumpSnapshot(nullptr, true);

LOG_INFO(log, "close and restore WAL from disk");
Expand Down

0 comments on commit cc2038d

Please sign in to comment.