diff --git a/test/nested.cc b/test/nested.cc index 335b22bc..dfa5bfcc 100644 --- a/test/nested.cc +++ b/test/nested.cc @@ -24,6 +24,20 @@ bool testcase_nested::setup() { return false; } + constexpr unsigned reduce_nops_threshold = 5000; + if (nops_target > reduce_nops_threshold) { + unsigned batching = config.params.batch_read + config.params.batch_write; + unsigned reduce_nops = + reduce_nops_threshold + + 5 * unsigned(sqrt(nops_target - reduce_nops_threshold + + nops_target / (batching ? batching : 1))); + if (reduce_nops >= config.signal_nops) { + log_notice("nested: return target-nops from %u to %u", nops_target, + reduce_nops); + nops_target = reduce_nops; + } + } + keyvalue_maker.setup(config.params, config.actor_id, 0 /* thread_number */); key = keygen::alloc(config.params.keylen_max); data = keygen::alloc(config.params.datalen_max); @@ -83,6 +97,7 @@ void testcase_nested::push_txn() { std::swap(txn_guard, std::get<0>(stack.top())); log_verbose("begin level#%zu txn #%" PRIu64 ", flags 0x%x, serial %" PRIu64, stack.size(), mdbx_txn_id(txn), flags, serial); + report(1); } bool testcase_nested::pop_txn(bool abort) { @@ -122,6 +137,7 @@ bool testcase_nested::pop_txn(bool abort) { std::swap(speculum, std::get<3>(stack.top())); } stack.pop(); + report(1); return should_continue; } @@ -171,6 +187,7 @@ bool testcase_nested::trim_tail(unsigned window_width) { if (unlikely(!keyvalue_maker.increment(tail_serial, 1))) failure("nested: unexpected key-space overflow on the tail"); } + report(1); } } else if (!fifo.empty()) { log_verbose("nested: purge state %" PRIu64 " - %" PRIu64 ", fifo-items %zu", @@ -178,6 +195,7 @@ bool testcase_nested::trim_tail(unsigned window_width) { fifo.size()); db_table_clear(dbi, txn_guard.get()); fifo.clear(); + report(1); } return true; } @@ -208,6 +226,7 @@ retry: } } + report(1); return true; } @@ -276,8 +295,6 @@ bool testcase_nested::run() { log_notice("nested: bailout after head-grow"); return false; } - - report(1); } while (!stack.empty()) diff --git a/test/test.cc b/test/test.cc index 4cc4e286..1fc0a073 100644 --- a/test/test.cc +++ b/test/test.cc @@ -398,8 +398,7 @@ bool testcase::should_continue(bool check_timeout_only) const { result = false; } - if (!check_timeout_only && config.params.test_nops && - nops_completed >= config.params.test_nops) + if (!check_timeout_only && nops_target && nops_completed >= nops_target) result = false; if (result) diff --git a/test/test.h b/test/test.h index 8194b057..2a66e37c 100644 --- a/test/test.h +++ b/test/test.h @@ -148,6 +148,7 @@ protected: bool signalled{false}; bool need_speculum_assign{false}; + unsigned nops_target{config.params.test_nops}; size_t nops_completed{0}; chrono::time start_timestamp; keygen::buffer key; @@ -229,10 +230,13 @@ public: }; class testcase_ttl : public testcase { + using inherited = testcase; + public: testcase_ttl(const actor_config &config, const mdbx_pid_t pid) : testcase(config, pid) {} bool run() override; + bool setup() override; }; class testcase_hill : public testcase { diff --git a/test/ttl.cc b/test/ttl.cc index a410d943..3a0a3f51 100644 --- a/test/ttl.cc +++ b/test/ttl.cc @@ -16,6 +16,27 @@ #include #include +bool testcase_ttl::setup() { + if (!inherited::setup()) + return false; + + constexpr unsigned reduce_nops_threshold = 10000; + if (nops_target > reduce_nops_threshold) { + unsigned batching = config.params.batch_read + config.params.batch_write; + unsigned reduce_nops = + reduce_nops_threshold + (nops_target - reduce_nops_threshold + + nops_target / (batching ? batching : 1)) / + 5; + if (reduce_nops >= config.signal_nops) { + log_notice("ttl: return target-nops from %u to %u", nops_target, + reduce_nops); + nops_target = reduce_nops; + } + } + + return true; +} + static unsigned edge2window(uint64_t edge, unsigned window_max) { const double rnd = u64_to_double1(bleach64(edge)); const unsigned window = window_max - std::lrint(std::pow(window_max, rnd)); @@ -108,11 +129,13 @@ bool testcase_ttl::run() { if (unlikely(!keyvalue_maker.increment(tail_serial, 1))) failure("ttl: unexpected key-space overflow on the tail"); } + report(1); } } else { log_trace("ttl: purge state"); db_table_clear(dbi); fifo.clear(); + report(1); } err = breakable_restart();