mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-20 05:18:21 +08:00
mdbx-test: refine jitter
testcase.
Change-Id: If1a3774da2b8b29249d81a54799117646820c036
This commit is contained in:
parent
995a26cf19
commit
8cd7cfc65d
@ -15,22 +15,15 @@
|
|||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
bool testcase_jitter::run() {
|
bool testcase_jitter::run() {
|
||||||
|
int err;
|
||||||
|
size_t upper_limit = config.params.size_upper;
|
||||||
|
if (upper_limit < 1)
|
||||||
|
upper_limit = config.params.size_now * 2;
|
||||||
|
|
||||||
while (should_continue()) {
|
while (should_continue()) {
|
||||||
jitter_delay();
|
jitter_delay();
|
||||||
db_open();
|
db_open();
|
||||||
|
|
||||||
if (flipcoin()) {
|
|
||||||
jitter_delay();
|
|
||||||
txn_begin(true);
|
|
||||||
fetch_canary();
|
|
||||||
jitter_delay();
|
|
||||||
txn_end(flipcoin());
|
|
||||||
}
|
|
||||||
|
|
||||||
int err;
|
|
||||||
intptr_t upper_limit = config.params.size_upper;
|
|
||||||
if (upper_limit < 1)
|
|
||||||
upper_limit = config.params.size_now;
|
|
||||||
if (upper_limit < 1) {
|
if (upper_limit < 1) {
|
||||||
MDBX_envinfo info;
|
MDBX_envinfo info;
|
||||||
err = mdbx_env_info_ex(db_guard.get(), txn_guard.get(), &info,
|
err = mdbx_env_info_ex(db_guard.get(), txn_guard.get(), &info,
|
||||||
@ -42,30 +35,33 @@ bool testcase_jitter::run() {
|
|||||||
: INTPTR_MAX;
|
: INTPTR_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool xcoin = flipcoin();
|
if (flipcoin()) {
|
||||||
err = mdbx_env_set_geometry(db_guard.get(), -1, -1,
|
jitter_delay();
|
||||||
xcoin ? upper_limit / 2 : upper_limit * 3 / 2,
|
txn_begin(true);
|
||||||
-1, -1, -1);
|
fetch_canary();
|
||||||
if (err != MDBX_SUCCESS && err != MDBX_RESULT_TRUE &&
|
jitter_delay();
|
||||||
err != MDBX_MAP_FULL && err != MDBX_TOO_LARGE)
|
txn_end(flipcoin());
|
||||||
failure_perror("mdbx_env_set_geometry-1", err);
|
}
|
||||||
|
|
||||||
|
const bool coin4size = flipcoin();
|
||||||
jitter_delay();
|
jitter_delay();
|
||||||
txn_begin(mode_readonly());
|
txn_begin(mode_readonly());
|
||||||
jitter_delay();
|
jitter_delay();
|
||||||
if (!mode_readonly()) {
|
if (!mode_readonly()) {
|
||||||
fetch_canary();
|
fetch_canary();
|
||||||
update_canary(1);
|
update_canary(1);
|
||||||
/* TODO:
|
err = mdbx_env_set_geometry(
|
||||||
* - db_setsize()
|
db_guard.get(), -1, -1,
|
||||||
* ...
|
coin4size ? upper_limit * 2 / 3 : upper_limit * 3 / 2, -1, -1, -1);
|
||||||
*/
|
if (err != MDBX_SUCCESS && err != MDBX_RESULT_TRUE &&
|
||||||
|
err != MDBX_MAP_FULL && err != MDBX_TOO_LARGE)
|
||||||
|
failure_perror("mdbx_env_set_geometry-1", err);
|
||||||
}
|
}
|
||||||
txn_end(flipcoin());
|
txn_end(flipcoin());
|
||||||
|
|
||||||
err = mdbx_env_set_geometry(db_guard.get(), -1, -1,
|
err = mdbx_env_set_geometry(
|
||||||
!xcoin ? upper_limit / 2 : upper_limit * 3 / 2,
|
db_guard.get(), -1, -1,
|
||||||
-1, -1, -1);
|
!coin4size ? upper_limit * 2 / 3 : upper_limit * 3 / 2, -1, -1, -1);
|
||||||
if (err != MDBX_SUCCESS && err != MDBX_RESULT_TRUE &&
|
if (err != MDBX_SUCCESS && err != MDBX_RESULT_TRUE &&
|
||||||
err != MDBX_MAP_FULL && err != MDBX_TOO_LARGE)
|
err != MDBX_MAP_FULL && err != MDBX_TOO_LARGE)
|
||||||
failure_perror("mdbx_env_set_geometry-2", err);
|
failure_perror("mdbx_env_set_geometry-2", err);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user