Skip to content

Commit

Permalink
Fix cgroups2 handling when no memory limit is set
Browse files Browse the repository at this point in the history
  • Loading branch information
svenklemm committed Jul 2, 2024
1 parent f87ad8a commit 772345b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docker-entrypoint-initdb.d/001_timescaledb_tune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ if [ -z "${TS_TUNE_MEMORY:-}" ]; then
# Try with cgroups v2 first.
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
TS_TUNE_MEMORY=$(cat /sys/fs/cgroup/memory.max)
TS_CGROUPS_MAX_MEM=true
case ${TS_TUNE_MEMORY} in
max)
TS_TUNE_MEMORY=""
;;
*)
TS_CGROUPS_MAX_MEM=true
;;
esac
# cgroups v2 is not available, try with cgroups v1
elif [ -f /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then
TS_TUNE_MEMORY=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
Expand Down

0 comments on commit 772345b

Please sign in to comment.