"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/unit/oom-score-adj.tcl" between
redis-6.0.7.tar.gz and redis-6.0.8.tar.gz

About: redis is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

oom-score-adj.tcl  (redis-6.0.7):oom-score-adj.tcl  (redis-6.0.8)
skipping to change at line 17 skipping to change at line 17
if {$pid == ""} { if {$pid == ""} {
set pid [srv 0 pid] set pid [srv 0 pid]
} }
set fd [open "/proc/$pid/oom_score_adj" "r"] set fd [open "/proc/$pid/oom_score_adj" "r"]
set val [gets $fd] set val [gets $fd]
close $fd close $fd
return $val return $val
} }
proc get_child_pid {} {
set pid [srv 0 pid]
set fd [open "|ps --ppid $pid -o pid" "r"]
set child_pid [string trim [lindex [split [read $fd] \n] 1]]
close $fd
return $child_pid
}
test {CONFIG SET oom-score-adj works as expected} { test {CONFIG SET oom-score-adj works as expected} {
set base [get_oom_score_adj] set base [get_oom_score_adj]
# Enable oom-score-adj, check defaults # Enable oom-score-adj, check defaults
r config set oom-score-adj-values "10 20 30" r config set oom-score-adj-values "10 20 30"
r config set oom-score-adj yes r config set oom-score-adj yes
assert {[get_oom_score_adj] == [expr $base + 10]} assert {[get_oom_score_adj] == [expr $base + 10]}
# Modify current class # Modify current class
skipping to change at line 47 skipping to change at line 38
assert {[get_oom_score_adj] == [expr $base + 15]} assert {[get_oom_score_adj] == [expr $base + 15]}
# Check replica class # Check replica class
r replicaof localhost 1 r replicaof localhost 1
assert {[get_oom_score_adj] == [expr $base + 20]} assert {[get_oom_score_adj] == [expr $base + 20]}
r replicaof no one r replicaof no one
assert {[get_oom_score_adj] == [expr $base + 15]} assert {[get_oom_score_adj] == [expr $base + 15]}
# Check child process # Check child process
r set key-a value-a r set key-a value-a
r config set rdb-key-save-delay 100000 r config set rdb-key-save-delay 1000000
r bgsave r bgsave
set child_pid [get_child_pid] set child_pid [get_child_pid 0]
assert {[get_oom_score_adj $child_pid] == [expr $base + 30]} assert {[get_oom_score_adj $child_pid] == [expr $base + 30]}
} }
# Failed oom-score-adj tests can only run unprivileged # Failed oom-score-adj tests can only run unprivileged
if {$user_id != 0} { if {$user_id != 0} {
test {CONFIG SET oom-score-adj handles configuration failures} { test {CONFIG SET oom-score-adj handles configuration failures} {
# Bad config # Bad config
r config set oom-score-adj no r config set oom-score-adj no
r config set oom-score-adj-values "-1000 -1000 -1000" r config set oom-score-adj-values "-1000 -1000 -1000"
 End of changes. 3 change blocks. 
11 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)