mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-01 23:14:14 +08:00
mdbx-test: more for ttl
testcase.
Change-Id: I8a01963345a2e815ebb39a98939420b8edb53968
This commit is contained in:
parent
be0ec1d38d
commit
2219802bca
11
test/main.cc
11
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;
|
||||
|
@ -181,6 +181,7 @@
|
||||
<ClInclude Include="utils.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ttl.cc" />
|
||||
<ClCompile Include="append.cc" />
|
||||
<ClCompile Include="cases.cc" />
|
||||
<ClCompile Include="chrono.cc" />
|
||||
|
14
test/ttl.cc
14
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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user