mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-21 18:08:21 +08:00
mdbx-tests: add support for db-geometry params.
Change-Id: I4c527005bd7c5d585573536d299a8036c62eaaec
This commit is contained in:
parent
8acc1979bb
commit
c7a6e9c8ae
@ -357,8 +357,11 @@ void dump(const char *title) {
|
|||||||
: i->params.pathname_log.c_str());
|
: i->params.pathname_log.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info("database: %s, size %" PRIu64 "\n", i->params.pathname_db.c_str(),
|
log_info(
|
||||||
i->params.size);
|
"database: %s, size %" PRIu64 "[%" PRIi64 "..%" PRIi64 ", %i %i, %i]\n",
|
||||||
|
i->params.pathname_db.c_str(), i->params.size_now, i->params.size_lower,
|
||||||
|
i->params.size_upper, i->params.shrink_threshold, i->params.growth_step,
|
||||||
|
i->params.pagesize);
|
||||||
|
|
||||||
dump_verbs("mode", i->params.mode_flags, mode_bits);
|
dump_verbs("mode", i->params.mode_flags, mode_bits);
|
||||||
dump_verbs("table", i->params.table_flags, table_bits);
|
dump_verbs("table", i->params.table_flags, table_bits);
|
||||||
|
@ -216,7 +216,12 @@ struct actor_params_pod {
|
|||||||
|
|
||||||
unsigned mode_flags;
|
unsigned mode_flags;
|
||||||
unsigned table_flags;
|
unsigned table_flags;
|
||||||
uint64_t size;
|
int64_t size_lower;
|
||||||
|
int64_t size_now;
|
||||||
|
int64_t size_upper;
|
||||||
|
int32_t shrink_threshold;
|
||||||
|
int32_t growth_step;
|
||||||
|
int32_t pagesize;
|
||||||
|
|
||||||
unsigned test_duration;
|
unsigned test_duration;
|
||||||
unsigned test_nops;
|
unsigned test_nops;
|
||||||
|
36
test/main.cc
36
test/main.cc
@ -35,7 +35,13 @@ void actor_params::set_defaults(const std::string &tmpdir) {
|
|||||||
mode_flags = MDBX_NOSUBDIR | MDBX_WRITEMAP | MDBX_MAPASYNC | MDBX_NORDAHEAD |
|
mode_flags = MDBX_NOSUBDIR | MDBX_WRITEMAP | MDBX_MAPASYNC | MDBX_NORDAHEAD |
|
||||||
MDBX_NOMEMINIT | MDBX_COALESCE | MDBX_LIFORECLAIM;
|
MDBX_NOMEMINIT | MDBX_COALESCE | MDBX_LIFORECLAIM;
|
||||||
table_flags = MDBX_DUPSORT;
|
table_flags = MDBX_DUPSORT;
|
||||||
size = 1024 * 1024 * 4;
|
|
||||||
|
size_lower = -1;
|
||||||
|
size_now = 1024 * 1024 * 4;
|
||||||
|
size_upper = -1;
|
||||||
|
shrink_threshold = -1;
|
||||||
|
growth_step = -1;
|
||||||
|
pagesize = -1;
|
||||||
|
|
||||||
keygen.seed = 1;
|
keygen.seed = 1;
|
||||||
keygen.keycase = kc_random;
|
keygen.keycase = kc_random;
|
||||||
@ -150,8 +156,32 @@ int main(int argc, char *const argv[]) {
|
|||||||
if (config::parse_option(argc, argv, narg, "table", params.table_flags,
|
if (config::parse_option(argc, argv, narg, "table", params.table_flags,
|
||||||
config::table_bits))
|
config::table_bits))
|
||||||
continue;
|
continue;
|
||||||
if (config::parse_option(argc, argv, narg, "size", params.size,
|
|
||||||
config::binary, 4096 * 4))
|
if (config::parse_option(argc, argv, narg, "pagesize", params.pagesize,
|
||||||
|
mdbx_limits_pgsize_min(),
|
||||||
|
mdbx_limits_pgsize_max()))
|
||||||
|
continue;
|
||||||
|
if (config::parse_option(argc, argv, narg, "size-lower", params.size_lower,
|
||||||
|
mdbx_limits_dbsize_min(params.pagesize),
|
||||||
|
mdbx_limits_dbsize_max(params.pagesize)))
|
||||||
|
continue;
|
||||||
|
if (config::parse_option(argc, argv, narg, "size", params.size_now,
|
||||||
|
mdbx_limits_dbsize_min(params.pagesize),
|
||||||
|
mdbx_limits_dbsize_max(params.pagesize)))
|
||||||
|
continue;
|
||||||
|
if (config::parse_option(argc, argv, narg, "size-upper", params.size_upper,
|
||||||
|
mdbx_limits_dbsize_min(params.pagesize),
|
||||||
|
mdbx_limits_dbsize_max(params.pagesize)))
|
||||||
|
continue;
|
||||||
|
if (config::parse_option(argc, argv, narg, "shrink-threshold",
|
||||||
|
params.shrink_threshold, 0,
|
||||||
|
mdbx_limits_dbsize_max(params.pagesize) -
|
||||||
|
mdbx_limits_dbsize_min(params.pagesize)))
|
||||||
|
continue;
|
||||||
|
if (config::parse_option(argc, argv, narg, "growth-step",
|
||||||
|
params.growth_step, 0,
|
||||||
|
mdbx_limits_dbsize_max(params.pagesize) -
|
||||||
|
mdbx_limits_dbsize_min(params.pagesize)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (config::parse_option(argc, argv, narg, "keygen.width",
|
if (config::parse_option(argc, argv, narg, "keygen.width",
|
||||||
|
@ -149,7 +149,10 @@ void testcase::db_prepare() {
|
|||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
failure_perror("mdbx_env_set_oomfunc()", rc);
|
failure_perror("mdbx_env_set_oomfunc()", rc);
|
||||||
|
|
||||||
rc = mdbx_env_set_mapsize(env, (size_t)config.params.size);
|
rc = mdbx_env_set_geometry(env, config.params.size_lower,
|
||||||
|
config.params.size_now, config.params.size_upper,
|
||||||
|
config.params.shrink_threshold,
|
||||||
|
config.params.growth_step, config.params.pagesize);
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
failure_perror("mdbx_env_set_mapsize()", rc);
|
failure_perror("mdbx_env_set_mapsize()", rc);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user