summaryrefslogtreecommitdiff
path: root/libs/libmdbx/src/test/gc.sh
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-09-14 16:33:56 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-09-14 16:33:56 +0300
commit50d176bfe78d4b5ffd829a874e503facef398e7d (patch)
tree3048927747b53a7c79ef73a5671d9ec912322382 /libs/libmdbx/src/test/gc.sh
parentcc03b109287f4c818a4d6df09cbfa48784e1e4a6 (diff)
merge with libmdbx release
Diffstat (limited to 'libs/libmdbx/src/test/gc.sh')
-rw-r--r--libs/libmdbx/src/test/gc.sh81
1 files changed, 81 insertions, 0 deletions
diff --git a/libs/libmdbx/src/test/gc.sh b/libs/libmdbx/src/test/gc.sh
new file mode 100644
index 0000000000..bddd92af24
--- /dev/null
+++ b/libs/libmdbx/src/test/gc.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+set -euo pipefail
+make check
+TESTDB_PREFIX=${1:-/dev/shm/mdbx-gc-test}.
+
+function rep9 { printf "%*s" $1 '' | tr ' ' '9'; }
+function join { local IFS="$1"; shift; echo "$*"; }
+function bit2option { local -n arr=$1; (( ($2&(1<<$3)) != 0 )) && echo -n '+' || echo -n '-'; echo "${arr[$3]}"; }
+
+options=(writemap coalesce lifo)
+
+function bits2list {
+ local -n arr=$1
+ local i
+ local list=()
+ for ((i=0; i<${#arr[@]}; ++i)) do
+ list[$i]=$(bit2option $1 $2 $i)
+ done
+ join , "${list[@]}"
+}
+
+function probe {
+ echo "=============================================== $(date)"
+ echo "${caption}: $*"
+ rm -f ${TESTDB_PREFIX}* \
+ && ./mdbx_test --pathname=${TESTDB_PREFIX}db "$@" | lz4 > log.lz4 \
+ && ./mdbx_chk -nvvv ${TESTDB_PREFIX}db | tee ${TESTDB_PREFIX}chk \
+ || (echo "FAILED"; exit 1)
+}
+
+###############################################################################
+
+caption="Failfast #1" probe \
+ --pagesize=min --size=6G --table=+data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
+ --nops=99999 --batch.write=9 --mode=-writemap,-coalesce,+lifo --keygen.seed=248240655 --hill
+
+caption="Failfast #2" probe \
+ --pagesize=min --size=6G --table=-data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
+ --nops=999999 --batch.write=999 --mode=+writemap,+coalesce,+lifo --keygen.seed=259083046 --hill
+
+caption="Failfast #3" probe \
+ --pagesize=min --size=6G --table=-data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
+ --nops=999999 --batch.write=999 --mode=+writemap,+coalesce,+lifo --keygen.seed=522365681 --hill
+
+caption="Failfast #4" probe \
+ --pagesize=min --size=6G --table=-data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
+ --nops=999999 --batch.write=9999 --mode=-writemap,+coalesce,+lifo --keygen.seed=866083781 --hill
+
+caption="Failfast #5" probe \
+ --pagesize=min --size=6G --table=-data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
+ --nops=999999 --batch.write=999 --mode=+writemap,-coalesce,+lifo --keygen.seed=246539192 --hill
+
+caption="Failfast #6" probe \
+ --pagesize=min --size=6G --table=-data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
+ --nops=999999 --batch.write=999 --mode=+writemap,+coalesce,+lifo --keygen.seed=540406278 --hill
+
+caption="Failfast #7" probe \
+ --pagesize=min --size=6G --table=+data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
+ --nops=999999 --batch.write=999 --mode=-writemap,+coalesce,+lifo --keygen.seed=619798690 --hill
+
+count=0
+for nops in {2..7}; do
+ for ((wbatch=nops-1; wbatch > 0; --wbatch)); do
+ loops=$((1111/nops + 2))
+ for ((rep=0; rep++ < loops; )); do
+ for ((bits=2**${#options[@]}; --bits >= 0; )); do
+ seed=$(date +%N)
+ caption="Probe #$((++count)) w/o-dups, repeat ${rep} of ${loops}" probe \
+ --pagesize=min --size=6G --table=-data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=1111 \
+ --nops=$( rep9 $nops ) --batch.write=$( rep9 $wbatch ) --mode=$(bits2list options $bits) \
+ --keygen.seed=${seed} --hill
+ caption="Probe #$((++count)) with-dups, repeat ${rep} of ${loops}" probe \
+ --pagesize=min --size=6G --table=+data.dups --keylen.min=min --keylen.max=max --datalen.min=min --datalen.max=max \
+ --nops=$( rep9 $nops ) --batch.write=$( rep9 $wbatch ) --mode=$(bits2list options $bits) \
+ --keygen.seed=${seed} --hill
+ done
+ done
+ done
+done
+
+echo "=== ALL DONE ====================== $(date)"