Skip to content

Commit

Permalink
Fix wrong delay in test, and remove unnecesary wait.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Oct 19, 2023
1 parent 113f0be commit f6343e7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,12 @@ BOOST_AUTO_TEST_CASE( oom_flush_dirty_pages ) {

auto& pmf = db.get_pinnable_mapped_file();
pmf.set_oom_threshold(100); // set a low threshold so that we hit it with a 4GB file
pmf.set_oom_delay(1);
pmf.set_oom_delay(0);

size_t flush_count = 0;
for (size_t i=0; i<max_elems; ++i) {
db.create<book>( [i]( book& b ) { b.a = (int)i; b.b = (int)(i+1); } );
if (i % 1000 == 0) {
// we need to wait some time after clearing the soft-dirty bits from the task's PTEs
// for the next read to be accurate (see https://www.kernel.org/doc/Documentation/vm/soft-dirty.txt)
std::this_thread::sleep_for (std::chrono::milliseconds(2000));

if (auto res = db.check_memory_and_flush_if_needed()) {
std::cerr << "oom score: " << res->oom_score_before << '\n';
if (res->num_pages_written > 0) {
Expand Down

0 comments on commit f6343e7

Please sign in to comment.