mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Only set vm.max_map_count if greater than default (#31512)
So the issue here is that we want to avoid setting vm.max_map_count if it is already equal to the desired value (the bootstrap check requires 262144). The reason we want to avoid this is because in some use-cases using sysctl to set this will fail. In this case, we want to enable users to set this value externally and then allow that to cause using sysctl to set the value to be skipped so that cases where using sysctl will fail to no longer fail.
This commit is contained in:
parent
9ac81a1322
commit
909a18add7
@ -122,7 +122,7 @@ case "$1" in
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count -a "$MAX_MAP_COUNT" -ge $(cat /proc/sys/vm/max_map_count) ]; then
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count -a "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
|
@ -90,7 +90,7 @@ start() {
|
||||
if [ -n "$MAX_LOCKED_MEMORY" ]; then
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count -a "$MAX_MAP_COUNT" -ge $(cat /proc/sys/vm/max_map_count) ]; then
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count -a "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
|
@ -178,8 +178,7 @@ setup() {
|
||||
}
|
||||
|
||||
# Ensures that if $MAX_MAP_COUNT is greater than the set vaule on the OS
|
||||
# we do not attempt to update it this should cover equality as well as I think
|
||||
# we can trust that equality operators work as intended.
|
||||
# we do not attempt to update it.
|
||||
@test "[INIT.D] sysctl is not run when it already has a larger or equal value set" {
|
||||
# intentionally set to the default +1
|
||||
sysctl -q -w vm.max_map_count=262145
|
||||
|
Loading…
x
Reference in New Issue
Block a user