Skip to content

Commit

Permalink
Improve the HFE deframent test to cover listpackex and eblist
Browse files Browse the repository at this point in the history
  • Loading branch information
sundb committed May 14, 2024
1 parent ebbb291 commit 8db938b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/unit/memefficiency.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -508,28 +508,34 @@ run_solo {defrag} {
r config resetstat
r config set hz 100
r config set activedefrag no
r config set active-defrag-threshold-lower 5
r config set active-defrag-threshold-lower 10 ;# TODO: Lower the threshold after defraging the ebuckets
r config set active-defrag-cycle-min 65
r config set active-defrag-cycle-max 75
r config set active-defrag-ignore-bytes 1500kb
r config set maxmemory 0
r config set hash-max-listpack-value 512

# Populate memory with interleaving hash field of same size
# TODO: Coverage for listpack and list ebuckets.
set n 50000
set dummy_field "[string repeat x 400]"
set rd [redis_deferring_client]
for {set j 0} {$j < $n} {incr j} {
$rd hset h f$j $dummy_field
$rd hexpire h$j 9999999 1 f$j
$rd hexpire h 9999999 1 f$j
$rd set k$j $dummy_field
}
assert_encoding hashtable h
for {set j 0} {$j < $n} {incr j} {
$rd read ; # Discard hset replies
$rd read ; # Discard hexpire replies
$rd read ; # Discard set replies
}

# Coverage for listpackex and eblist.
r hset h_lpex f0 $dummy_field
r hexpire h_lpex 9999999 1 f0
assert_encoding listpackex h_lpex

after 120 ;# serverCron only updates the info once in 100ms
if {$::verbose} {
puts "used [s allocator_allocated]"
Expand Down

0 comments on commit 8db938b

Please sign in to comment.