mdbx-test: engage mdbx_env_set_syncperiod() & mdbx_env_set_syncbytes().

Related to https://github.com/erthink/libmdbx/issues/248.
This commit is contained in:
Leonid Yuriev 2021-12-03 17:04:10 +03:00 committed by Леонид Юрьев (Leonid Yuriev)
parent f355f247c3
commit 3fdd810653
2 changed files with 28 additions and 0 deletions

View File

@ -189,6 +189,26 @@ bool testcase_nested::stochastic_breakable_restart_with_nested(
(flipcoin() || txn_underutilization_x256(txn_guard.get()) < 42))
should_continue &= pop_txn();
if (flipcoin_x3()) {
unsigned period;
int err = mdbx_env_get_syncperiod(db_guard.get(), &period);
if (unlikely(err != MDBX_SUCCESS))
failure_perror("mdbx_env_get_syncperiod()", err);
size_t bytes;
err = mdbx_env_get_syncbytes(db_guard.get(), &bytes);
if (unlikely(err != MDBX_SUCCESS))
failure_perror("mdbx_env_get_syncbytes()", err);
err = mdbx_env_set_syncperiod(db_guard.get(), period ^ 42);
if (unlikely(err != MDBX_SUCCESS) && err != MDBX_BUSY)
failure_perror("mdbx_env_set_syncperiod()", err);
err = mdbx_env_set_syncbytes(db_guard.get(), bytes ^ 42000);
if (unlikely(err != MDBX_SUCCESS) && err != MDBX_BUSY)
failure_perror("mdbx_env_set_syncbytes()", err);
}
if (should_continue)
while (stack.empty() ||
(is_nested_txn_available() && flipcoin() && stack.size() < 5))

View File

@ -164,6 +164,14 @@ void testcase::db_open() {
if (unlikely(rc != MDBX_SUCCESS))
failure_perror("mdbx_env_open()", rc);
rc = mdbx_env_set_syncperiod(db_guard.get(), unsigned(0.042 * 65536));
if (unlikely(rc != MDBX_SUCCESS) && rc != MDBX_BUSY)
failure_perror("mdbx_env_set_syncperiod()", rc);
rc = mdbx_env_set_syncbytes(db_guard.get(), INT_MAX / 421);
if (unlikely(rc != MDBX_SUCCESS) && rc != MDBX_BUSY)
failure_perror("mdbx_env_set_syncbytes()", rc);
log_trace("<< db_open");
}