mdbx-test: add --dont-check-ram-size option to stochastic scripts.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-11-10 00:17:48 +03:00
parent bc80fbbeea
commit 90f39c88a0
2 changed files with 36 additions and 17 deletions

View File

@ -11,6 +11,7 @@ BANNER="$(which banner 2>/dev/null | echo echo)"
UNAME="$(uname -s 2>/dev/null || echo Unknown)"
DB_UPTO_MB=17408
PAGESIZE=min
DONT_CHECK_RAM=no
while [ -n "$1" ]
do
@ -31,6 +32,7 @@ do
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 "--dont-check-ram-size Don't check available RAM "
echo "--help Print this usage help and exit"
exit -2
;;
@ -140,6 +142,9 @@ do
esac
shift
;;
--dont-check-ram-size)
DONT_CHECK_RAM=yes
;;
*)
echo "Unknown option '$1'"
exit -2
@ -246,11 +251,15 @@ rm -f ${TESTDB_DIR}/*
# 2. estimate reasonable RAM space for test-db
echo "=== ${ram_avail_mb}M RAM available"
ram_reserve4logs_mb=1234
if [ $ram_avail_mb -lt $ram_reserve4logs_mb ]; then
echo "=== At least ${ram_reserve4logs_mb}Mb RAM required"
exit 3
fi
if [ $DONT_CHECK_RAM = yes ]; then
db_size_mb=$DB_UPTO_MB
ram_reserve4logs_mb=64
else
ram_reserve4logs_mb=1234
if [ $ram_avail_mb -lt $ram_reserve4logs_mb ]; then
echo "=== At least ${ram_reserve4logs_mb}Mb RAM required"
exit 3
fi
#
# В режимах отличных от MDBX_WRITEMAP изменения до записи в файл
@ -270,9 +279,10 @@ fi
# that malloc() will not return the allocated memory to the
# system immediately, as well some space is required for logs.
#
db_size_mb=$(((ram_avail_mb - ram_reserve4logs_mb) / 4))
if [ $db_size_mb -gt $DB_UPTO_MB ]; then
db_size_mb=$DB_UPTO_MB
db_size_mb=$(((ram_avail_mb - ram_reserve4logs_mb) / 4))
if [ $db_size_mb -gt $DB_UPTO_MB ]; then
db_size_mb=$DB_UPTO_MB
fi
fi
echo "=== use ${db_size_mb}M for DB"

View File

@ -11,7 +11,7 @@ BANNER="$(which banner 2>/dev/null | echo echo)"
UNAME="$(uname -s 2>/dev/null || echo Unknown)"
DB_UPTO_MB=17408
PAGESIZE=min
DONT_CHECK_RAM=no
while [ -n "$1" ]
do
@ -32,6 +32,7 @@ do
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 "--dont-check-ram-size Don't check available RAM "
echo "--help Print this usage help and exit"
exit -2
;;
@ -141,6 +142,9 @@ do
esac
shift
;;
--dont-check-ram-size)
DONT_CHECK_RAM=yes
;;
*)
echo "Unknown option '$1'"
exit -2
@ -247,11 +251,15 @@ rm -f ${TESTDB_DIR}/*
# 2. estimate reasonable RAM space for test-db
echo "=== ${ram_avail_mb}M RAM available"
ram_reserve4logs_mb=1234
if [ $ram_avail_mb -lt $ram_reserve4logs_mb ]; then
echo "=== At least ${ram_reserve4logs_mb}Mb RAM required"
exit 3
fi
if [ $DONT_CHECK_RAM = yes ]; then
db_size_mb=$DB_UPTO_MB
ram_reserve4logs_mb=64
else
ram_reserve4logs_mb=1234
if [ $ram_avail_mb -lt $ram_reserve4logs_mb ]; then
echo "=== At least ${ram_reserve4logs_mb}Mb RAM required"
exit 3
fi
#
# В режимах отличных от MDBX_WRITEMAP изменения до записи в файл
@ -271,9 +279,10 @@ fi
# that malloc() will not return the allocated memory to the
# system immediately, as well some space is required for logs.
#
db_size_mb=$(((ram_avail_mb - ram_reserve4logs_mb) / 4))
if [ $db_size_mb -gt $DB_UPTO_MB ]; then
db_size_mb=$DB_UPTO_MB
db_size_mb=$(((ram_avail_mb - ram_reserve4logs_mb) / 4))
if [ $db_size_mb -gt $DB_UPTO_MB ]; then
db_size_mb=$DB_UPTO_MB
fi
fi
echo "=== use ${db_size_mb}M for DB"