From 7902b97a3d5393ac1a5b8aff8402a56bd684b284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Fri, 21 Oct 2022 23:09:44 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-test:=20=D0=BF=D1=80=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= =?UTF-8?q?=20warmup.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test.cc b/test/test.cc index 6f620223..60fd6914 100644 --- a/test/test.cc +++ b/test/test.cc @@ -199,6 +199,19 @@ void testcase::txn_begin(bool readonly, MDBX_txn_flags_t flags) { log_trace("<< txn_begin(%s, 0x%04X)", readonly ? "read-only" : "read-write", flags); + + if (flipcoin_n(5)) { + const unsigned mask = + unsigned(MDBX_warmup_default | MDBX_warmup_force | MDBX_warmup_oomsafe | + MDBX_warmup_lock | MDBX_warmup_touchlimit); + static unsigned counter; + MDBX_warmup_flags_t warmup_flags = MDBX_warmup_flags_t( + (counter > MDBX_warmup_release) ? prng64() & mask : counter); + counter += 1; + int err = mdbx_env_warmup(db_guard.get(), txn, warmup_flags, 0); + log_trace("== counter %u, env_warmup(flags %u), rc %d", counter, + warmup_flags, err); + } } int testcase::breakable_commit() {