File tree 3 files changed +30
-2
lines changed
distribution/packages/src
qa/vagrant/src/test/resources/packaging/tests
3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ case "$1" in
122
122
ulimit -l $MAX_LOCKED_MEMORY
123
123
fi
124
124
125
- if [ -n " $MAX_MAP_COUNT " -a -f /proc/sys/vm/max_map_count ]; then
125
+ 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
126
126
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
127
127
fi
128
128
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ start() {
90
90
if [ -n " $MAX_LOCKED_MEMORY " ]; then
91
91
ulimit -l $MAX_LOCKED_MEMORY
92
92
fi
93
- if [ -n " $MAX_MAP_COUNT " -a -f /proc/sys/vm/max_map_count ]; then
93
+ 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
94
94
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
95
95
fi
96
96
Original file line number Diff line number Diff line change @@ -163,3 +163,31 @@ setup() {
163
163
assert_file_exist /var/log/elasticsearch/gc.log.0.current
164
164
stop_elasticsearch_service
165
165
}
166
+
167
+ # Ensures that if $MAX_MAP_COUNT is less than the set value on the OS
168
+ # it will be updated
169
+ @test " [INIT.D] sysctl is run when the value set is too small" {
170
+ # intentionally a ridiculously low number
171
+ sysctl -q -w vm.max_map_count=100
172
+ start_elasticsearch_service
173
+ max_map_count=$( sysctl -n vm.max_map_count)
174
+ stop_elasticsearch_service
175
+
176
+ [ $max_map_count = 262144 ]
177
+
178
+ }
179
+
180
+ # Ensures that if $MAX_MAP_COUNT is greater than the set vaule on the OS
181
+ # we do not attempt to update it this should cover equality as well as I think
182
+ # we can trust that equality operators work as intended.
183
+ @test " [INIT.D] sysctl is not run when it already has a larger or equal value set" {
184
+ # intentionally set to the default +1
185
+ sysctl -q -w vm.max_map_count=262145
186
+ start_elasticsearch_service
187
+ max_map_count=$( sysctl -n vm.max_map_count)
188
+ stop_elasticsearch_service
189
+
190
+ # default value +1
191
+ [ $max_map_count = 262145 ]
192
+
193
+ }
You can’t perform that action at this time.
0 commit comments