Use MARIADB_USAGE for MariaDB memory budget

This commit is contained in:
Marek Miklewicz
2026-06-13 21:00:45 +02:00
parent db01ba1ea0
commit 091ac31dee
2 changed files with 8 additions and 5 deletions
+4 -1
View File
@@ -203,7 +203,8 @@ assert_file_contains "$ROOT_DIR/my.cnf" 'query_cache_size=0'
assert_file_not_contains "$ROOT_DIR/my.cnf" 'query-cache-type'
assert_file_not_contains "$ROOT_DIR/my.cnf" 'query-cache-size'
assert_file_not_contains "$ROOT_DIR/my.cnf" 'innodb_file_format'
assert_file_contains "$ROOT_DIR/my-cnf-gen.sh" 'MARIADB_MEMORY_PERCENT=25'
assert_file_contains "$ROOT_DIR/my-cnf-gen.sh" 'MARIADB_USAGE="\$\{MARIADB_USAGE:-25\}"'
assert_file_not_contains "$ROOT_DIR/my-cnf-gen.sh" 'MARIADB_MEMORY_PERCENT'
assert_file_contains "$ROOT_DIR/my-cnf-gen.sh" 'MYSQL_GEN_MEM_MB'
assert_file_contains "$ROOT_DIR/my-cnf-gen.sh" 'MYSQL_GEN_CPU_CORES'
assert_file_contains "$ROOT_DIR/my-cnf-gen.sh" '/proc/meminfo'
@@ -231,6 +232,8 @@ MYSQL_GEN_MEM_MB=8192 MYSQL_GEN_CPU_CORES=4 "$ROOT_DIR/my-cnf-gen.sh" --output "
grep -qx 'innodb_buffer_pool_size=2G' "$generated_my_cnf" || fail "generated my.cnf should allocate 25% of 8G to InnoDB"
grep -qx 'max_connections=80' "$generated_my_cnf" || fail "generated my.cnf should keep low-RAM max_connections conservative"
grep -qx 'query_cache_size=0' "$generated_my_cnf" || fail "generated my.cnf should disable query cache"
MARIADB_USAGE=50 MYSQL_GEN_MEM_MB=8192 MYSQL_GEN_CPU_CORES=4 "$ROOT_DIR/my-cnf-gen.sh" --output "$generated_my_cnf"
grep -qx 'innodb_buffer_pool_size=4G' "$generated_my_cnf" || fail "MARIADB_USAGE override should change InnoDB allocation"
kv_file="$tmp_dir/example.conf"
printf 'ns1=old.example\nother=value\n' > "$kv_file"