From 844e39ebef3c1226d92fff0b71d90ac20d8518d3 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Mon, 17 Sep 2018 13:21:05 +0300 Subject: [PATCH] mdbx-test: seeding keygen with actor_id for better spreading. --- test/hill.cc | 2 +- test/keygen.cc | 4 ++-- test/keygen.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/hill.cc b/test/hill.cc index abccf9c7..10cb3089 100644 --- a/test/hill.cc +++ b/test/hill.cc @@ -53,7 +53,7 @@ bool testcase_hill::run() { */ /* TODO: работа в несколько потоков */ - keyvalue_maker.setup(config.params, 0 /* thread_number */); + keyvalue_maker.setup(config.params, config.actor_id, 0 /* thread_number */); keygen::buffer a_key = keygen::alloc(config.params.keylen_max); keygen::buffer a_data_0 = keygen::alloc(config.params.datalen_max); diff --git a/test/keygen.cc b/test/keygen.cc index 0b68194d..c7a70606 100644 --- a/test/keygen.cc +++ b/test/keygen.cc @@ -142,7 +142,7 @@ void __hot maker::pair(serial_t serial, const buffer &key, buffer &value, } } -void maker::setup(const config::actor_params_pod &actor, +void maker::setup(const config::actor_params_pod &actor, unsigned actor_id, unsigned thread_number) { key_essentials.flags = actor.table_flags & (MDBX_INTEGERKEY | MDBX_REVERSEKEY | MDBX_DUPSORT); @@ -161,7 +161,7 @@ void maker::setup(const config::actor_params_pod &actor, assert(thread_number < 2); (void)thread_number; mapping = actor.keygen; - salt = actor.keygen.seed * UINT64_C(14653293970879851569); + salt = (actor.keygen.seed + actor_id) * UINT64_C(14653293970879851569); // FIXME: TODO base = 0; diff --git a/test/keygen.h b/test/keygen.h index 449165ae..bbd97b29 100644 --- a/test/keygen.h +++ b/test/keygen.h @@ -119,7 +119,8 @@ public: void pair(serial_t serial, const buffer &key, buffer &value, serial_t value_age); - void setup(const config::actor_params_pod &actor, unsigned thread_number); + void setup(const config::actor_params_pod &actor, unsigned actor_id, + unsigned thread_number); bool increment(serial_t &serial, int delta); };