attempt to fix tracking test issue with external tests due to lazy free (#9722)

The External tests started failing recently for unclear reason:
```
*** [err]: Tracking invalidation message of eviction keys should be before response in tests/unit/tracking.tcl
Expected '0' to be equal to 'invalidate volatile-key' (context: type eval line 21 cmd {assert_equal $res {invalidate volatile-key}} proc ::test)
```

I suspect the issue is that the used_memory sample is taken while a lazy free is still being processed.
This commit is contained in:
Oran Agra 2021-11-02 16:42:53 +02:00 committed by GitHub
parent d5ca72e38b
commit 87321deb3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -113,6 +113,14 @@ proc wait_done_loading r {
}
}
proc wait_lazyfree_done r {
wait_for_condition 50 100 {
[status $r lazyfree_pending_objects] == 0
} else {
fail "lazyfree isn't done"
}
}
# count current log lines in server's stdout
proc count_log_lines {srv_idx} {
set _ [string trim [exec wc -l < [srv $srv_idx stdout]]]

View File

@ -20,11 +20,7 @@ start_server {tags {"lazyfree"}} {
test "FLUSHDB ASYNC can reclaim memory in background" {
# make the previous test is really done before sampling used_memory
wait_for_condition 50 100 {
[s lazyfree_pending_objects] == 0
} else {
fail "lazyfree isn't done"
}
wait_lazyfree_done r
set orig_mem [s used_memory]
set args {}

View File

@ -424,6 +424,10 @@ start_server {tags {"tracking network"}} {
r CLIENT TRACKING off
r HELLO 3
r CLIENT TRACKING on
# make the previous test is really done before sampling used_memory
wait_lazyfree_done r
set used [s used_memory]
set limit [expr {$used+100*1024}]
set old_policy [lindex [r config get maxmemory-policy] 1]