From 90f39c88a0c585086a792a5ac26fc566508a2619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Thu, 10 Nov 2022 00:17:48 +0300 Subject: [PATCH] mdbx-test: add `--dont-check-ram-size` option to stochastic scripts. --- test/long_stochastic.sh | 26 ++++++++++++++++++-------- test/stochastic_small.sh | 27 ++++++++++++++++++--------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/test/long_stochastic.sh b/test/long_stochastic.sh index 1dc2b8d2..906bacee 100755 --- a/test/long_stochastic.sh +++ b/test/long_stochastic.sh @@ -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" diff --git a/test/stochastic_small.sh b/test/stochastic_small.sh index 4a886bbf..50497f85 100755 --- a/test/stochastic_small.sh +++ b/test/stochastic_small.sh @@ -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"