Skip to content

Commit

Permalink
fix dict rehash tests introduced by redis#12802 broken by redis#12819 (
Browse files Browse the repository at this point in the history
…redis#13009)

tests consistently fail on timeout (sleep that's too short).
it now takes more time because in redis#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 redis#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) 
```
  • Loading branch information
oranagra authored Jan 30, 2024
1 parent 45a35a7 commit 7c9f41b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests/unit/other.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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}
}

Expand Down

0 comments on commit 7c9f41b

Please sign in to comment.