From 7db9c40fe04290bb8b8c4dc10050ccfe3142dc9b 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: Wed, 23 Apr 2025 23:00:27 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-tests:=20=D1=83=D1=81=D1=82=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B0=20max-dbi=20=D0=B4=D0=BB=D1=8F=20extra?= =?UTF-8?q?/cursor-closing.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/extra/cursor_closing.c++ | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/extra/cursor_closing.c++ b/test/extra/cursor_closing.c++ index df8278ce..fe234d7a 100644 --- a/test/extra/cursor_closing.c++ +++ b/test/extra/cursor_closing.c++ @@ -23,7 +23,13 @@ #define RELIEF_FACTOR 1 #endif -#define NN (1000 / RELIEF_FACTOR) +static const auto NN = 1000u / RELIEF_FACTOR; + +#if defined(__cpp_lib_latch) && __cpp_lib_latch >= 201907L +static const auto N = std::min(17u, std::thread::hardware_concurrency()); +#else +static const auto N = 3u; +#endif static void logger_nofmt(MDBX_log_level_t loglevel, const char *function, int line, const char *msg, unsigned length) noexcept { @@ -263,7 +269,7 @@ void case1_write_cycle(mdbx::txn_managed txn, std::deque &dbi, pre.unbind(); if (!pre.txn()) pre.bind(txn, dbi[prng(dbi.size())]); - for (auto i = 0; i < NN; ++i) { + for (auto i = 0u; i < NN; ++i) { auto k = mdbx::default_buffer::wrap(prng(NN)); auto v = mdbx::default_buffer::wrap(prng(NN)); if (pre.find_multivalue(k, v, false)) @@ -321,11 +327,6 @@ bool case1(mdbx::env env) { bool ok = true; std::deque dbi; std::vector cursors; -#if defined(__cpp_lib_latch) && __cpp_lib_latch >= 201907L - static const auto N = std::thread::hardware_concurrency(); -#else - static const auto N = 3u; -#endif for (auto t = 0u; t < N; ++t) { auto txn = env.start_write(); auto table = txn.create_map(std::to_string(t), mdbx::key_mode::ordinal, mdbx::value_mode::multi_samelength); @@ -392,7 +393,7 @@ int doit() { mdbx::env::remove(db_filename); mdbx::env_managed env(db_filename, mdbx::env_managed::create_parameters(), - mdbx::env::operate_parameters(42, 0, mdbx::env::nested_transactions)); + mdbx::env::operate_parameters(N + 2, 0, mdbx::env::nested_transactions)); bool ok = case0(env); ok = case1(env) && ok;