mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 22:34:12 +08:00
mdbx-test: add --random-writemap[=YES|no]
option.
Change-Id: Ie83f64d4a7e199f828540f029c2c47deddb05c01
This commit is contained in:
parent
6439a95b65
commit
0fb127b935
@ -373,6 +373,8 @@ void dump(const char *title) {
|
|||||||
i->params.pagesize);
|
i->params.pagesize);
|
||||||
|
|
||||||
dump_verbs("mode", i->params.mode_flags, mode_bits);
|
dump_verbs("mode", i->params.mode_flags, mode_bits);
|
||||||
|
log_verbose("random-writemap: %s\n",
|
||||||
|
i->params.random_writemap ? "Yes" : "No");
|
||||||
dump_verbs("table", i->params.table_flags, table_bits);
|
dump_verbs("table", i->params.table_flags, table_bits);
|
||||||
|
|
||||||
if (i->params.test_nops)
|
if (i->params.test_nops)
|
||||||
|
@ -265,9 +265,10 @@ struct actor_params_pod {
|
|||||||
keygen_params_pod keygen;
|
keygen_params_pod keygen;
|
||||||
|
|
||||||
uint8_t loglevel{0};
|
uint8_t loglevel{0};
|
||||||
bool drop_table{0};
|
bool drop_table{false};
|
||||||
bool ignore_dbfull{0};
|
bool ignore_dbfull{false};
|
||||||
bool speculum{0};
|
bool speculum{false};
|
||||||
|
bool random_writemap{true};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct actor_config_pod {
|
struct actor_config_pod {
|
||||||
|
@ -101,6 +101,7 @@ void __noreturn usage(void) {
|
|||||||
" notls == MDBX_NOTLS\n"
|
" notls == MDBX_NOTLS\n"
|
||||||
" nordahead == MDBX_NORDAHEAD\n"
|
" nordahead == MDBX_NORDAHEAD\n"
|
||||||
" nomeminit == MDBX_NOMEMINIT\n"
|
" nomeminit == MDBX_NOMEMINIT\n"
|
||||||
|
" --random-writemap[=YES|no] Toggle MDBX_WRITEMAP randomly\n"
|
||||||
"Key-value space/table options:\n"
|
"Key-value space/table options:\n"
|
||||||
" --table={[+-]FLAG}[,[+-]FLAG]...\n"
|
" --table={[+-]FLAG}[,[+-]FLAG]...\n"
|
||||||
" key.reverse == MDBX_REVERSEKEY\n"
|
" key.reverse == MDBX_REVERSEKEY\n"
|
||||||
@ -165,6 +166,7 @@ void actor_params::set_defaults(const std::string &tmpdir) {
|
|||||||
drop_table = false;
|
drop_table = false;
|
||||||
ignore_dbfull = false;
|
ignore_dbfull = false;
|
||||||
speculum = false;
|
speculum = false;
|
||||||
|
random_writemap = true;
|
||||||
|
|
||||||
max_readers = 42;
|
max_readers = 42;
|
||||||
max_tables = 42;
|
max_tables = 42;
|
||||||
@ -259,6 +261,9 @@ int main(int argc, char *const argv[]) {
|
|||||||
if (config::parse_option(argc, argv, narg, "mode", params.mode_flags,
|
if (config::parse_option(argc, argv, narg, "mode", params.mode_flags,
|
||||||
config::mode_bits))
|
config::mode_bits))
|
||||||
continue;
|
continue;
|
||||||
|
if (config::parse_option(argc, argv, narg, "random-writemap",
|
||||||
|
params.random_writemap))
|
||||||
|
continue;
|
||||||
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)) {
|
||||||
if ((params.table_flags & MDBX_DUPFIXED) == 0)
|
if ((params.table_flags & MDBX_DUPFIXED) == 0)
|
||||||
|
@ -144,8 +144,14 @@ void testcase::db_open() {
|
|||||||
db_prepare();
|
db_prepare();
|
||||||
|
|
||||||
jitter_delay(true);
|
jitter_delay(true);
|
||||||
|
|
||||||
|
unsigned mode = (unsigned)config.params.mode_flags;
|
||||||
|
if (config.params.random_writemap && flipcoin())
|
||||||
|
mode ^= MDBX_WRITEMAP;
|
||||||
|
|
||||||
|
actual_db_mode = mode;
|
||||||
int rc = mdbx_env_open(db_guard.get(), config.params.pathname_db.c_str(),
|
int rc = mdbx_env_open(db_guard.get(), config.params.pathname_db.c_str(),
|
||||||
(unsigned)config.params.mode_flags, 0640);
|
mode, 0640);
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
failure_perror("mdbx_env_open()", rc);
|
failure_perror("mdbx_env_open()", rc);
|
||||||
|
|
||||||
|
@ -169,8 +169,9 @@ protected:
|
|||||||
static int oom_callback(MDBX_env *env, mdbx_pid_t pid, mdbx_tid_t tid,
|
static int oom_callback(MDBX_env *env, mdbx_pid_t pid, mdbx_tid_t tid,
|
||||||
uint64_t txn, unsigned gap, size_t space, int retry);
|
uint64_t txn, unsigned gap, size_t space, int retry);
|
||||||
|
|
||||||
|
unsigned actual_db_mode{0};
|
||||||
bool is_nested_txn_available() const {
|
bool is_nested_txn_available() const {
|
||||||
return (config.params.mode_flags & MDBX_WRITEMAP) == 0;
|
return (actual_db_mode & MDBX_WRITEMAP) == 0;
|
||||||
}
|
}
|
||||||
void kick_progress(bool active) const;
|
void kick_progress(bool active) const;
|
||||||
void db_prepare();
|
void db_prepare();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user