From 2219802bcaf6c3e1160ea3417755af131945cb16 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sat, 22 Jun 2019 02:00:52 +0300 Subject: [PATCH] mdbx-test: more for `ttl` testcase. Change-Id: I8a01963345a2e815ebb39a98939420b8edb53968 --- test/main.cc | 11 ++++++++--- test/test.vcxproj | 1 + test/ttl.cc | 14 ++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/test/main.cc b/test/main.cc index d93f0e11..9dc3eccb 100644 --- a/test/main.cc +++ b/test/main.cc @@ -37,7 +37,8 @@ void actor_params::set_defaults(const std::string &tmpdir) { table_flags = MDBX_DUPSORT; size_lower = -1; - size_now = intptr_t(1024) * 1024 * ((table_flags & MDBX_DUPSORT) ? 4 : 256); + size_now = + intptr_t(1024) * 1024 * ((table_flags & MDBX_DUPSORT) ? 256 : 1024); size_upper = -1; shrink_threshold = -1; growth_step = -1; @@ -61,8 +62,8 @@ void actor_params::set_defaults(const std::string &tmpdir) { datalen_min = mdbx_datalen_min(); datalen_max = std::min(mdbx_datalen_max(), 256u * 1024 + 42); - batch_read = 4; - batch_write = 4; + batch_read = 42; + batch_write = 42; delaystart = 0; waitfor_nops = 0; @@ -345,6 +346,10 @@ int main(int argc, char *const argv[]) { configure_actor(last_space_id, ac_append, value, params); continue; } + if (config::parse_option(argc, argv, narg, "ttl", nullptr)) { + configure_actor(last_space_id, ac_ttl, value, params); + continue; + } if (config::parse_option(argc, argv, narg, "failfast", global::config::failfast)) continue; diff --git a/test/test.vcxproj b/test/test.vcxproj index 9eb62cdc..93de00e3 100644 --- a/test/test.vcxproj +++ b/test/test.vcxproj @@ -181,6 +181,7 @@ + diff --git a/test/ttl.cc b/test/ttl.cc index dbc00146..14a6b128 100644 --- a/test/ttl.cc +++ b/test/ttl.cc @@ -56,14 +56,16 @@ bool testcase_ttl::run() { /* LY: для параметризации используем подходящие параметры, которые не имеют * здесь смысла в первоначальном значении */ - const unsigned window_max = config.params.batch_read; + const unsigned window_max = + (config.params.batch_read > 999) ? config.params.batch_read : 1000; + const unsigned count_max = + (config.params.batch_write > 999) ? config.params.batch_write : 1000; log_info("ttl: using `batch_read` value %u for window_max", window_max); - const unsigned count_max = config.params.batch_write; log_info("ttl: using `batch_write` value %u for count_max", count_max); keyvalue_maker.setup(config.params, config.actor_id, 0 /* thread_number */); - keygen::buffer key = keygen::alloc(config.params.keylen_max); - keygen::buffer data = keygen::alloc(config.params.datalen_max); + key = keygen::alloc(config.params.keylen_max); + data = keygen::alloc(config.params.datalen_max); const unsigned insert_flags = (config.params.table_flags & MDBX_DUPSORT) ? MDBX_NODUPDATA : MDBX_NODUPDATA | MDBX_NOOVERWRITE; @@ -85,7 +87,7 @@ bool testcase_ttl::run() { fifo.pop(); for (unsigned n = 0; n < tail_count; ++n) { log_trace("ttl: remove-tail %" PRIu64, serial); - generate_pair(tail_serial, key, data, 0); + generate_pair(tail_serial); int err = mdbx_del(txn_guard.get(), dbi, &key->value, &data->value); if (unlikely(err != MDBX_SUCCESS)) failure_perror("mdbx_del(tail)", err); @@ -102,7 +104,7 @@ bool testcase_ttl::run() { for (unsigned n = 0; n < head_count; ++n) { log_trace("ttl: insert-head %" PRIu64, serial); - generate_pair(serial, key, data, 0); + generate_pair(serial); int err = mdbx_put(txn_guard.get(), dbi, &key->value, &data->value, insert_flags); if (unlikely(err != MDBX_SUCCESS))