mirror of https://mirror.osredm.com/root/redis.git
Avoid starting defrag after config resetstat for defrag test (#13399)
If `config resetstat` is executed and a defrag is started after it, the `total_active_defrag_time` will not be 0. When we start the defrag again, we will skip the following steps: 1. waiting for the defrag to start. (s total_active_defrag_time is equal 0) 2. waiting for the test to complete. (active_defrag_running is euqal 0) which result in the test failed. --------- Co-authored-by: oranagra <oran@redislabs.com>
This commit is contained in:
parent
ad9277238f
commit
d39548c854
|
@ -37,6 +37,18 @@ start_server {tags {"memefficiency external:skip"}} {
|
||||||
}
|
}
|
||||||
|
|
||||||
run_solo {defrag} {
|
run_solo {defrag} {
|
||||||
|
proc wait_for_defrag_stop {maxtries delay} {
|
||||||
|
wait_for_condition $maxtries $delay {
|
||||||
|
[s active_defrag_running] eq 0
|
||||||
|
} else {
|
||||||
|
after 120 ;# serverCron only updates the info once in 100ms
|
||||||
|
puts [r info memory]
|
||||||
|
puts [r info stats]
|
||||||
|
puts [r memory malloc-stats]
|
||||||
|
fail "defrag didn't stop."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proc test_active_defrag {type} {
|
proc test_active_defrag {type} {
|
||||||
if {[string match {*jemalloc*} [s mem_allocator]] && [r debug mallctl arenas.page] <= 8192} {
|
if {[string match {*jemalloc*} [s mem_allocator]] && [r debug mallctl arenas.page] <= 8192} {
|
||||||
test "Active defrag main dictionary: $type" {
|
test "Active defrag main dictionary: $type" {
|
||||||
|
@ -90,14 +102,7 @@ run_solo {defrag} {
|
||||||
r config set active-defrag-cycle-max 75
|
r config set active-defrag-cycle-max 75
|
||||||
|
|
||||||
# Wait for the active defrag to stop working.
|
# Wait for the active defrag to stop working.
|
||||||
wait_for_condition 2000 100 {
|
wait_for_defrag_stop 2000 100
|
||||||
[s active_defrag_running] eq 0
|
|
||||||
} else {
|
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
|
||||||
puts [r info memory]
|
|
||||||
puts [r memory malloc-stats]
|
|
||||||
fail "defrag didn't stop."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Test the fragmentation is lower.
|
# Test the fragmentation is lower.
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
after 120 ;# serverCron only updates the info once in 100ms
|
||||||
|
@ -180,9 +185,10 @@ run_solo {defrag} {
|
||||||
test "Active defrag eval scripts: $type" {
|
test "Active defrag eval scripts: $type" {
|
||||||
r flushdb
|
r flushdb
|
||||||
r script flush sync
|
r script flush sync
|
||||||
r config resetstat
|
|
||||||
r config set hz 100
|
r config set hz 100
|
||||||
r config set activedefrag no
|
r config set activedefrag no
|
||||||
|
wait_for_defrag_stop 500 100
|
||||||
|
r config resetstat
|
||||||
r config set active-defrag-threshold-lower 5
|
r config set active-defrag-threshold-lower 5
|
||||||
r config set active-defrag-cycle-min 65
|
r config set active-defrag-cycle-min 65
|
||||||
r config set active-defrag-cycle-max 75
|
r config set active-defrag-cycle-max 75
|
||||||
|
@ -240,14 +246,7 @@ run_solo {defrag} {
|
||||||
}
|
}
|
||||||
|
|
||||||
# wait for the active defrag to stop working
|
# wait for the active defrag to stop working
|
||||||
wait_for_condition 500 100 {
|
wait_for_defrag_stop 500 100
|
||||||
[s active_defrag_running] eq 0
|
|
||||||
} else {
|
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
|
||||||
puts [r info memory]
|
|
||||||
puts [r memory malloc-stats]
|
|
||||||
fail "defrag didn't stop."
|
|
||||||
}
|
|
||||||
|
|
||||||
# test the fragmentation is lower
|
# test the fragmentation is lower
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
after 120 ;# serverCron only updates the info once in 100ms
|
||||||
|
@ -265,9 +264,10 @@ run_solo {defrag} {
|
||||||
|
|
||||||
test "Active defrag big keys: $type" {
|
test "Active defrag big keys: $type" {
|
||||||
r flushdb
|
r flushdb
|
||||||
r config resetstat
|
|
||||||
r config set hz 100
|
r config set hz 100
|
||||||
r config set activedefrag no
|
r config set activedefrag no
|
||||||
|
wait_for_defrag_stop 500 100
|
||||||
|
r config resetstat
|
||||||
r config set active-defrag-max-scan-fields 1000
|
r config set active-defrag-max-scan-fields 1000
|
||||||
r config set active-defrag-threshold-lower 5
|
r config set active-defrag-threshold-lower 5
|
||||||
r config set active-defrag-cycle-min 65
|
r config set active-defrag-cycle-min 65
|
||||||
|
@ -362,14 +362,7 @@ run_solo {defrag} {
|
||||||
}
|
}
|
||||||
|
|
||||||
# wait for the active defrag to stop working
|
# wait for the active defrag to stop working
|
||||||
wait_for_condition 500 100 {
|
wait_for_defrag_stop 500 100
|
||||||
[s active_defrag_running] eq 0
|
|
||||||
} else {
|
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
|
||||||
puts [r info memory]
|
|
||||||
puts [r memory malloc-stats]
|
|
||||||
fail "defrag didn't stop."
|
|
||||||
}
|
|
||||||
|
|
||||||
# test the fragmentation is lower
|
# test the fragmentation is lower
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
after 120 ;# serverCron only updates the info once in 100ms
|
||||||
|
@ -406,9 +399,10 @@ run_solo {defrag} {
|
||||||
|
|
||||||
test "Active defrag pubsub: $type" {
|
test "Active defrag pubsub: $type" {
|
||||||
r flushdb
|
r flushdb
|
||||||
r config resetstat
|
|
||||||
r config set hz 100
|
r config set hz 100
|
||||||
r config set activedefrag no
|
r config set activedefrag no
|
||||||
|
wait_for_defrag_stop 500 100
|
||||||
|
r config resetstat
|
||||||
r config set active-defrag-threshold-lower 5
|
r config set active-defrag-threshold-lower 5
|
||||||
r config set active-defrag-cycle-min 65
|
r config set active-defrag-cycle-min 65
|
||||||
r config set active-defrag-cycle-max 75
|
r config set active-defrag-cycle-max 75
|
||||||
|
@ -467,14 +461,7 @@ run_solo {defrag} {
|
||||||
}
|
}
|
||||||
|
|
||||||
# wait for the active defrag to stop working
|
# wait for the active defrag to stop working
|
||||||
wait_for_condition 500 100 {
|
wait_for_defrag_stop 500 100
|
||||||
[s active_defrag_running] eq 0
|
|
||||||
} else {
|
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
|
||||||
puts [r info memory]
|
|
||||||
puts [r memory malloc-stats]
|
|
||||||
fail "defrag didn't stop."
|
|
||||||
}
|
|
||||||
|
|
||||||
# test the fragmentation is lower
|
# test the fragmentation is lower
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
after 120 ;# serverCron only updates the info once in 100ms
|
||||||
|
@ -505,9 +492,10 @@ run_solo {defrag} {
|
||||||
|
|
||||||
test "Active Defrag HFE: $type" {
|
test "Active Defrag HFE: $type" {
|
||||||
r flushdb
|
r flushdb
|
||||||
r config resetstat
|
|
||||||
r config set hz 100
|
r config set hz 100
|
||||||
r config set activedefrag no
|
r config set activedefrag no
|
||||||
|
wait_for_defrag_stop 500 100
|
||||||
|
r config resetstat
|
||||||
# TODO: Lower the threshold after defraging the ebuckets.
|
# TODO: Lower the threshold after defraging the ebuckets.
|
||||||
# Now just to ensure that the reference is updated correctly.
|
# Now just to ensure that the reference is updated correctly.
|
||||||
r config set active-defrag-threshold-lower 12
|
r config set active-defrag-threshold-lower 12
|
||||||
|
@ -581,14 +569,7 @@ run_solo {defrag} {
|
||||||
}
|
}
|
||||||
|
|
||||||
# wait for the active defrag to stop working
|
# wait for the active defrag to stop working
|
||||||
wait_for_condition 500 100 {
|
wait_for_defrag_stop 500 100
|
||||||
[s active_defrag_running] eq 0
|
|
||||||
} else {
|
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
|
||||||
puts [r info memory]
|
|
||||||
puts [r memory malloc-stats]
|
|
||||||
fail "defrag didn't stop."
|
|
||||||
}
|
|
||||||
|
|
||||||
# test the fragmentation is lower
|
# test the fragmentation is lower
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
after 120 ;# serverCron only updates the info once in 100ms
|
||||||
|
@ -605,9 +586,10 @@ run_solo {defrag} {
|
||||||
if {$type eq "standalone"} { ;# skip in cluster mode
|
if {$type eq "standalone"} { ;# skip in cluster mode
|
||||||
test "Active defrag big list: $type" {
|
test "Active defrag big list: $type" {
|
||||||
r flushdb
|
r flushdb
|
||||||
r config resetstat
|
|
||||||
r config set hz 100
|
r config set hz 100
|
||||||
r config set activedefrag no
|
r config set activedefrag no
|
||||||
|
wait_for_defrag_stop 500 100
|
||||||
|
r config resetstat
|
||||||
r config set active-defrag-max-scan-fields 1000
|
r config set active-defrag-max-scan-fields 1000
|
||||||
r config set active-defrag-threshold-lower 5
|
r config set active-defrag-threshold-lower 5
|
||||||
r config set active-defrag-cycle-min 65
|
r config set active-defrag-cycle-min 65
|
||||||
|
@ -661,15 +643,7 @@ run_solo {defrag} {
|
||||||
}
|
}
|
||||||
|
|
||||||
# wait for the active defrag to stop working
|
# wait for the active defrag to stop working
|
||||||
wait_for_condition 500 100 {
|
wait_for_defrag_stop 500 100
|
||||||
[s active_defrag_running] eq 0
|
|
||||||
} else {
|
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
|
||||||
puts [r info memory]
|
|
||||||
puts [r info stats]
|
|
||||||
puts [r memory malloc-stats]
|
|
||||||
fail "defrag didn't stop."
|
|
||||||
}
|
|
||||||
|
|
||||||
# test the fragmentation is lower
|
# test the fragmentation is lower
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
after 120 ;# serverCron only updates the info once in 100ms
|
||||||
|
@ -721,9 +695,10 @@ run_solo {defrag} {
|
||||||
# this test is more consistent on a fresh server with no history
|
# this test is more consistent on a fresh server with no history
|
||||||
start_server {tags {"defrag"} overrides {save ""}} {
|
start_server {tags {"defrag"} overrides {save ""}} {
|
||||||
r flushdb
|
r flushdb
|
||||||
r config resetstat
|
|
||||||
r config set hz 100
|
r config set hz 100
|
||||||
r config set activedefrag no
|
r config set activedefrag no
|
||||||
|
wait_for_defrag_stop 500 100
|
||||||
|
r config resetstat
|
||||||
r config set active-defrag-max-scan-fields 1000
|
r config set active-defrag-max-scan-fields 1000
|
||||||
r config set active-defrag-threshold-lower 5
|
r config set active-defrag-threshold-lower 5
|
||||||
r config set active-defrag-cycle-min 65
|
r config set active-defrag-cycle-min 65
|
||||||
|
@ -789,15 +764,7 @@ run_solo {defrag} {
|
||||||
}
|
}
|
||||||
|
|
||||||
# wait for the active defrag to stop working
|
# wait for the active defrag to stop working
|
||||||
wait_for_condition 500 100 {
|
wait_for_defrag_stop 500 100
|
||||||
[s active_defrag_running] eq 0
|
|
||||||
} else {
|
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
|
||||||
puts [r info memory]
|
|
||||||
puts [r info stats]
|
|
||||||
puts [r memory malloc-stats]
|
|
||||||
fail "defrag didn't stop."
|
|
||||||
}
|
|
||||||
|
|
||||||
# test the fragmentation is lower
|
# test the fragmentation is lower
|
||||||
after 120 ;# serverCron only updates the info once in 100ms
|
after 120 ;# serverCron only updates the info once in 100ms
|
||||||
|
|
Loading…
Reference in New Issue