mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:54:14 +08:00
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:
parent
f355f247c3
commit
3fdd810653
@ -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))
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user