summaryrefslogtreecommitdiff
path: root/libs/libmdbx/src/test/gc.sh
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-08-25 12:49:45 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-08-25 12:49:45 +0300
commitc2216a4278bbbc3fb01e6bfb25ddaf8ad48c4e1e (patch)
tree7415b5b5a140cdf291a259b0b5da6cc61cc60d70 /libs/libmdbx/src/test/gc.sh
parent94fb75230352ce8729e9b0ace42e81c6d494a6fd (diff)
merge with recent libmdbx
Diffstat (limited to 'libs/libmdbx/src/test/gc.sh')
-rw-r--r--libs/libmdbx/src/test/gc.sh35
1 files changed, 35 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..84f31a50e7
--- /dev/null
+++ b/libs/libmdbx/src/test/gc.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+set -euo pipefail
+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[@]}"
+}
+
+for nops in {7..1}; do
+ for ((wbatch=nops; wbatch > 0; --wbatch)); do
+ for ((bits=2**${#options[@]}; --bits >= 0; )); do
+ echo "=================================== $(date)"
+ rm -f ${TESTDB_PREFIX}*
+ echo --nops=$( rep9 $nops ) --batch.write=$( rep9 $wbatch ) --mode=$(bits2list options $bits)
+ ./mdbx_test --pathname=${TESTDB_PREFIX} --pagesize=min --size=8G --keylen.min=1 --keylen.max=250 --datalen.min=1 --datalen.max=1500 \
+ --nops=$( rep9 $nops ) --batch.write=$( rep9 $wbatch ) --mode=$(bits2list options $bits) \
+ --keygen.seed=$(date +%N) --hill | bzip2 -c > ${TESTDB_PREFIX}.log.bz2
+ ./mdbx_chk -nvv ${TESTDB_PREFIX} | tee ${TESTDB_PREFIX}-chk.log
+ done
+ done
+done
+
+echo "=== ALL DONE ====================== $(date)"