fix dict rehash tests introduced by #12802 broken by #12819 (#13009)

tests consistently fail on timeout (sleep that's too short).
it now takes more time because in #12819 we iterate on all dicts, not
just non-empty ones.
it passed the PR's CI because it skips the `slow` tag, which might have
been misplaced, but now it is probably required.
with the fix, the tests take quite a lot of time:
```
[ok]: Redis can trigger resizing (1860 ms)
[ok]: Redis can rewind and trigger smaller slot resizing (744 ms)
```
before #12819:
```
[ok]: Redis can trigger resizing (309 ms)
[ok]: Redis can rewind and trigger smaller slot resizing (295 ms)
```

failure:
https://github.com/redis/redis/actions/runs/7704158180/job/20995931735
```
*** [err]: expire scan should skip dictionaries with lot's of empty buckets in tests/unit/expire.tcl
scan didn't handle slot skipping logic.
*** [err]: Redis can trigger resizing in tests/unit/other.tcl
Expected '[Dictionary HT]
Hash table 0 stats (main hash table):
 table size: 128
 number of elements: 5
[Expires HT]
Hash table 0 stats (main hash table):
No stats available for empty dictionaries
' to match '*table size: 8*' (context: type eval line 29 cmd {assert_match "*table size: 8*" [r debug HTSTATS 0]} proc ::test) 
*** [err]: Redis can rewind and trigger smaller slot resizing in tests/unit/other.tcl
Expected '[Dictionary HT]
Hash table 0 stats (main hash table):
 table size: 256
 number of elements: 10
[Expires HT]
Hash table 0 stats (main hash table):
No stats available for empty dictionaries
' to match '*table size: 16*' (context: type eval line 27 cmd {assert_match "*table size: 16*" [r debug HTSTATS 0]} proc ::test) 
```
This commit is contained in:
Oran Agra 2024-01-30 14:32:38 +02:00 committed by GitHub
parent 45a35a79c7
commit 7c9f41b52b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 4 deletions

View File

@ -429,6 +429,7 @@ start_server {tags {"other external:skip"}} {
}
start_cluster 1 0 {tags {"other external:skip cluster slow"}} {
r config set dynamic-hz no hz 500
test "Redis can trigger resizing" {
r flushall
# hashslot(foo) is 12182
@ -456,8 +457,13 @@ start_cluster 1 0 {tags {"other external:skip cluster slow"}} {
fail "bgsave did not stop in time."
}
after 200;# waiting for serverCron
assert_match "*table size: 8*" [r debug HTSTATS 0]
# waiting for serverCron to resize the tables
wait_for_condition 1000 10 {
[string match {*table size: 8*} [r debug HTSTATS 0]]
} else {
puts [r debug HTSTATS 0]
fail "hash tables weren't resize."
}
} {} {needs:debug}
test "Redis can rewind and trigger smaller slot resizing" {
@ -485,8 +491,13 @@ start_cluster 1 0 {tags {"other external:skip cluster slow"}} {
fail "bgsave did not stop in time."
}
after 200;# waiting for serverCron
assert_match "*table size: 16*" [r debug HTSTATS 0]
# waiting for serverCron to resize the tables
wait_for_condition 1000 10 {
[string match {*table size: 16*} [r debug HTSTATS 0]]
} else {
puts [r debug HTSTATS 0]
fail "hash tables weren't resize."
}
} {} {needs:debug}
}