mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Fix dict resize allow test (#13016)
Ci report this failure: ``` *** [err]: Don't rehash if used memory exceeds maxmemory after rehash in tests/unit/maxmemory.tcl Expected '4098' to equal or match '4002' WARNING: the new maxmemory value set via CONFIG SET (1176088) is smaller than the current memory usage (1231083) ``` It can be seen from the log that used_memory changed before we set maxmemory. The reason is that in #12819, in cron, in addition to trying to shrink, we will also tyring to expand. The dict was expanded by cron before we set maxmemory, causing the test to fail. Before setting maxmemory, we only add 4095 keys to avoid triggering resize.
This commit is contained in:
parent
6016973ac0
commit
9a7d311855
@ -421,11 +421,16 @@ start_server {tags {"maxmemory external:skip"}} {
|
||||
r config set maxmemory-policy allkeys-random
|
||||
|
||||
# Next rehash size is 8192, that will eat 64k memory
|
||||
populate 4096 "" 1
|
||||
populate 4095 "" 1
|
||||
|
||||
set used [s used_memory]
|
||||
set limit [expr {$used + 10*1024}]
|
||||
r config set maxmemory $limit
|
||||
|
||||
# Adding a key to meet the 1:1 radio.
|
||||
r set k0 v0
|
||||
# The dict has reached 4096, it can be resized in tryResizeHashTables in cron,
|
||||
# or we add a key to let it check whether it can be resized.
|
||||
r set k1 v1
|
||||
# Next writing command will trigger evicting some keys if last
|
||||
# command trigger DB dict rehash
|
||||
|
Loading…
Reference in New Issue
Block a user