mdbx-tests: add support for db-geometry params.

Change-Id: I4c527005bd7c5d585573536d299a8036c62eaaec
This commit is contained in:
Leonid Yuriev 2018-08-22 00:55:21 +03:00
parent 8acc1979bb
commit c7a6e9c8ae
4 changed files with 48 additions and 7 deletions

View File

@ -357,8 +357,11 @@ void dump(const char *title) {
: i->params.pathname_log.c_str());
}
log_info("database: %s, size %" PRIu64 "\n", i->params.pathname_db.c_str(),
i->params.size);
log_info(
"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("table", i->params.table_flags, table_bits);

View File

@ -216,7 +216,12 @@ struct actor_params_pod {
unsigned mode_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_nops;

View File

@ -35,7 +35,13 @@ void actor_params::set_defaults(const std::string &tmpdir) {
mode_flags = MDBX_NOSUBDIR | MDBX_WRITEMAP | MDBX_MAPASYNC | MDBX_NORDAHEAD |
MDBX_NOMEMINIT | MDBX_COALESCE | MDBX_LIFORECLAIM;
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.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,
config::table_bits))
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;
if (config::parse_option(argc, argv, narg, "keygen.width",

View File

@ -149,7 +149,10 @@ void testcase::db_prepare() {
if (unlikely(rc != MDBX_SUCCESS))
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))
failure_perror("mdbx_env_set_mapsize()", rc);