From 26eb4ce397411729be7abc6a9996dbda77df3c37 Mon Sep 17 00:00:00 2001 From: Harkrishn Patro Date: Sun, 22 Oct 2023 01:56:45 -0700 Subject: [PATCH] Fix defrag test (#12674) Fixing issues started after #11695 when the defrag tests are being executed in cluster mode too. For some reason, it looks like the defragmentation is over too quickly, before the test is able to detect that it's running. so now instead of waiting to see that it's active, we wait to see that it did some work ``` [err]: Active defrag big list: cluster in tests/unit/memefficiency.tcl defrag not started. [err]: Active defrag big keys: cluster in tests/unit/memefficiency.tcl defrag didn't stop. ``` --- tests/unit/memefficiency.tcl | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/tests/unit/memefficiency.tcl b/tests/unit/memefficiency.tcl index 1a558c3f9..0fad0fba7 100644 --- a/tests/unit/memefficiency.tcl +++ b/tests/unit/memefficiency.tcl @@ -71,8 +71,12 @@ run_solo {defrag} { # Wait for the active defrag to start working (decision once a # second). wait_for_condition 50 100 { - [s active_defrag_running] ne 0 + [s total_active_defrag_time] ne 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 not started." } @@ -218,8 +222,12 @@ run_solo {defrag} { # wait for the active defrag to start working (decision once a second) wait_for_condition 50 100 { - [s active_defrag_running] ne 0 + [s total_active_defrag_time] ne 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 not started." } @@ -336,8 +344,12 @@ run_solo {defrag} { if {[r config get activedefrag] eq "activedefrag yes"} { # wait for the active defrag to start working (decision once a second) wait_for_condition 50 100 { - [s active_defrag_running] ne 0 + [s total_active_defrag_time] ne 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 not started." } @@ -432,8 +444,12 @@ run_solo {defrag} { if {[r config get activedefrag] eq "activedefrag yes"} { # wait for the active defrag to start working (decision once a second) wait_for_condition 50 100 { - [s active_defrag_running] ne 0 + [s total_active_defrag_time] ne 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 not started." } @@ -552,8 +568,12 @@ run_solo {defrag} { if {[r config get activedefrag] eq "activedefrag yes"} { # wait for the active defrag to start working (decision once a second) wait_for_condition 50 100 { - [s active_defrag_running] ne 0 + [s total_active_defrag_time] ne 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 not started." }