mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-19 19:39:26 +08:00
mdbx: merge branch 'master' into devel
.
This commit is contained in:
@@ -14,6 +14,7 @@ GEOMETRY_JITTER=yes
|
||||
BANNER="$(which banner 2>/dev/null | echo echo)"
|
||||
UNAME="$(uname -s 2>/dev/null || echo Unknown)"
|
||||
DB_UPTO_MB=17408
|
||||
PAGESIZE=min
|
||||
|
||||
while [ -n "$1" ]
|
||||
do
|
||||
@@ -33,6 +34,7 @@ do
|
||||
echo "--dir PATH Specifies directory for test DB and other files (it will be cleared)"
|
||||
echo "--db-upto-mb NN Limits upper size of test DB to the NN megabytes"
|
||||
echo "--no-geometry-jitter Disable jitter for geometry upper-size"
|
||||
echo "--pagesize NN Use specified page size (256 is minimal and used by default) "
|
||||
echo "--help Print this usage help and exit"
|
||||
exit -2
|
||||
;;
|
||||
@@ -109,6 +111,39 @@ do
|
||||
--no-geometry-jitter)
|
||||
GEOMETRY_JITTER=no
|
||||
;;
|
||||
--pagesize)
|
||||
case "$2" in
|
||||
min|max|256|512|1024|2048|4096|8192|16386|32768|65536)
|
||||
PAGESIZE=$2
|
||||
;;
|
||||
1|1k|1K|k|K)
|
||||
PAGESIZE=$((1024*1))
|
||||
;;
|
||||
2|2k|2K)
|
||||
PAGESIZE=$((1024*2))
|
||||
;;
|
||||
4|4k|4K)
|
||||
PAGESIZE=$((1024*4))
|
||||
;;
|
||||
8|8k|8K)
|
||||
PAGESIZE=$((1024*8))
|
||||
;;
|
||||
16|16k|16K)
|
||||
PAGESIZE=$((1024*16))
|
||||
;;
|
||||
32|32k|32K)
|
||||
PAGESIZE=$((1024*32))
|
||||
;;
|
||||
64|64k|64K)
|
||||
PAGESIZE=$((1024*64))
|
||||
;;
|
||||
*)
|
||||
echo "Invalig page size '$2'"
|
||||
exit -2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option '$1'"
|
||||
exit -2
|
||||
@@ -346,65 +381,65 @@ for nops in 10 33 100 333 1000 3333 10000 33333 100000 333333 1000000 3333333 10
|
||||
|
||||
split=30
|
||||
caption="Probe #$((++count)) int-key,with-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) int-key,int-data, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.integer --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.integer --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) with-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
|
||||
split=24
|
||||
caption="Probe #$((++count)) int-key,with-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) int-key,int-data, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.integer --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.integer --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) with-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
|
||||
split=16
|
||||
caption="Probe #$((++count)) int-key,w/o-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,-data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,-data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) int-key,with-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) int-key,int-data, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.integer --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.integer --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) w/o-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=-data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=-data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) with-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
|
||||
split=4
|
||||
caption="Probe #$((++count)) int-key,w/o-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,-data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,-data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) int-key,int-data, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.integer --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=+key.integer,+data.integer --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
caption="Probe #$((++count)) w/o-dups, split=${split}, case $((++subcase)) of ${cases}" probe \
|
||||
--pagesize=min --size-upper-upto=${db_size_mb}M --table=-data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
|
||||
--pagesize=$PAGESIZE --size-upper-upto=${db_size_mb}M --table=-data.dups --keygen.split=${split} --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
|
||||
--nops=$nops --batch.write=$wbatch --mode=$(bits2options $bits)${syncmodes[count%3]} \
|
||||
--keygen.seed=${seed}
|
||||
done # options
|
||||
|
66
test/test.cc
66
test/test.cc
@@ -1189,28 +1189,29 @@ bool testcase::check_batch_get() {
|
||||
char dump_key[128], dump_value[128];
|
||||
char dump_key_batch[128], dump_value_batch[128];
|
||||
|
||||
MDBX_cursor *cursor;
|
||||
int err = mdbx_cursor_open(txn_guard.get(), dbi, &cursor);
|
||||
if (err != MDBX_SUCCESS)
|
||||
failure_perror("mdbx_cursor_open()", err);
|
||||
MDBX_cursor *check_cursor;
|
||||
int check_err = mdbx_cursor_open(txn_guard.get(), dbi, &check_cursor);
|
||||
if (check_err != MDBX_SUCCESS)
|
||||
failure_perror("mdbx_cursor_open()", check_err);
|
||||
|
||||
MDBX_cursor *batch_cursor;
|
||||
err = mdbx_cursor_open(txn_guard.get(), dbi, &batch_cursor);
|
||||
if (err != MDBX_SUCCESS)
|
||||
failure_perror("mdbx_cursor_open()", err);
|
||||
int batch_err = mdbx_cursor_open(txn_guard.get(), dbi, &batch_cursor);
|
||||
if (batch_err != MDBX_SUCCESS)
|
||||
failure_perror("mdbx_cursor_open()", batch_err);
|
||||
|
||||
bool rc = true;
|
||||
MDBX_val pairs[42];
|
||||
size_t count = 0xDeadBeef;
|
||||
err = mdbx_cursor_get_batch(batch_cursor, &count, pairs, ARRAY_LENGTH(pairs),
|
||||
MDBX_FIRST);
|
||||
bool rc = true;
|
||||
MDBX_cursor_op batch_op;
|
||||
batch_err = mdbx_cursor_get_batch(batch_cursor, &count, pairs,
|
||||
ARRAY_LENGTH(pairs), batch_op = MDBX_FIRST);
|
||||
size_t i, n = 0;
|
||||
while (err == MDBX_SUCCESS) {
|
||||
while (batch_err == MDBX_SUCCESS || batch_err == MDBX_RESULT_TRUE) {
|
||||
for (i = 0; i < count; i += 2) {
|
||||
mdbx::slice k, v;
|
||||
int err2 = mdbx_cursor_get(cursor, &k, &v, MDBX_NEXT);
|
||||
if (err2 != MDBX_SUCCESS)
|
||||
failure_perror("mdbx_cursor_open()", err2);
|
||||
check_err = mdbx_cursor_get(check_cursor, &k, &v, MDBX_NEXT);
|
||||
if (check_err != MDBX_SUCCESS)
|
||||
failure_perror("batch-verify: mdbx_cursor_get(MDBX_NEXT)", check_err);
|
||||
if (k != pairs[i] || v != pairs[i + 1]) {
|
||||
log_error(
|
||||
"batch-get pair mismatch %zu/%zu: sequential{%s, %s} != "
|
||||
@@ -1224,29 +1225,32 @@ bool testcase::check_batch_get() {
|
||||
}
|
||||
}
|
||||
n += i / 2;
|
||||
err = mdbx_cursor_get_batch(batch_cursor, &count, pairs,
|
||||
ARRAY_LENGTH(pairs), MDBX_NEXT);
|
||||
batch_op = (batch_err == MDBX_RESULT_TRUE) ? MDBX_GET_CURRENT : MDBX_NEXT;
|
||||
batch_err = mdbx_cursor_get_batch(batch_cursor, &count, pairs,
|
||||
ARRAY_LENGTH(pairs), batch_op);
|
||||
}
|
||||
if (err != MDBX_NOTFOUND)
|
||||
failure_perror("mdbx_cursor_get_batch()", err);
|
||||
|
||||
err = mdbx_cursor_eof(batch_cursor);
|
||||
if (err != MDBX_RESULT_TRUE) {
|
||||
log_error("batch-get %s cursor not-eof %d", "batch", err);
|
||||
rc = false;
|
||||
}
|
||||
err = mdbx_cursor_on_last(batch_cursor);
|
||||
if (err != MDBX_RESULT_TRUE) {
|
||||
log_error("batch-get %s cursor not-on-last %d", "batch", err);
|
||||
if (batch_err != MDBX_NOTFOUND) {
|
||||
log_error("mdbx_cursor_get_batch(), op %u, err %d", batch_op, batch_err);
|
||||
rc = false;
|
||||
}
|
||||
|
||||
err = mdbx_cursor_on_last(cursor);
|
||||
if (err != MDBX_RESULT_TRUE) {
|
||||
log_error("batch-get %s cursor not-on-last %d", "checked", err);
|
||||
batch_err = mdbx_cursor_eof(batch_cursor);
|
||||
if (batch_err != MDBX_RESULT_TRUE) {
|
||||
log_error("batch-get %s-cursor not-eof %d", "batch", batch_err);
|
||||
rc = false;
|
||||
}
|
||||
mdbx_cursor_close(cursor);
|
||||
batch_err = mdbx_cursor_on_last(batch_cursor);
|
||||
if (batch_err != MDBX_RESULT_TRUE) {
|
||||
log_error("batch-get %s-cursor not-on-last %d", "batch", batch_err);
|
||||
rc = false;
|
||||
}
|
||||
|
||||
check_err = mdbx_cursor_on_last(check_cursor);
|
||||
if (check_err != MDBX_RESULT_TRUE) {
|
||||
log_error("batch-get %s-cursor not-on-last %d", "checked", check_err);
|
||||
rc = false;
|
||||
}
|
||||
mdbx_cursor_close(check_cursor);
|
||||
mdbx_cursor_close(batch_cursor);
|
||||
return rc;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
msync(start)
|
||||
fun:msync
|
||||
...
|
||||
fun:mdbx_sync_locked
|
||||
fun:mdbx_sync_locked*
|
||||
}
|
||||
{
|
||||
msync-whole-mmap-2
|
||||
@@ -12,7 +12,7 @@
|
||||
msync(start)
|
||||
fun:msync
|
||||
...
|
||||
fun:mdbx_env_sync_internal
|
||||
fun:mdbx_env_sync_internal*
|
||||
}
|
||||
{
|
||||
msync-whole-mmap-3
|
||||
@@ -20,7 +20,7 @@
|
||||
msync(start)
|
||||
fun:msync
|
||||
...
|
||||
fun:mdbx_mapresize
|
||||
fun:mdbx_mapresize*
|
||||
}
|
||||
{
|
||||
msync-wipe-steady
|
||||
@@ -28,7 +28,7 @@
|
||||
msync(start)
|
||||
fun:msync
|
||||
...
|
||||
fun:mdbx_wipe_steady
|
||||
fun:mdbx_wipe_steady*
|
||||
}
|
||||
|
||||
# memcmp() inside mdbx_iov_write() as workaround for todo4recovery://erased_by_github/libmdbx/issues/269
|
||||
|
Reference in New Issue
Block a user