Unverified Commit d25dc089 authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

Solve issues with tracking test in external mode (#9726)

The issue was that setting maxmemory to used_memory and expecting
eviction is insufficient, since we need to take
mem_not_counted_for_evict into consideration.

This test got broken by #9166
parent 78025c4a
...@@ -428,7 +428,7 @@ start_server {tags {"tracking network"}} { ...@@ -428,7 +428,7 @@ start_server {tags {"tracking network"}} {
# make the previous test is really done before sampling used_memory # make the previous test is really done before sampling used_memory
wait_lazyfree_done r wait_lazyfree_done r
set used [s used_memory] set used [expr {[s used_memory] - [s mem_not_counted_for_evict]}]
set limit [expr {$used+100*1024}] set limit [expr {$used+100*1024}]
set old_policy [lindex [r config get maxmemory-policy] 1] set old_policy [lindex [r config get maxmemory-policy] 1]
r config set maxmemory $limit r config set maxmemory $limit
...@@ -440,7 +440,7 @@ start_server {tags {"tracking network"}} { ...@@ -440,7 +440,7 @@ start_server {tags {"tracking network"}} {
# We use SETBIT here, so we can set a big key and get the used_memory # We use SETBIT here, so we can set a big key and get the used_memory
# bigger than maxmemory. Next command will evict volatile keys. We # bigger than maxmemory. Next command will evict volatile keys. We
# can't use SET, as SET uses big input buffer, so it will fail. # can't use SET, as SET uses big input buffer, so it will fail.
r setbit big-key 1000000 0 r setbit big-key 1600000 0 ;# this will consume 200kb
# volatile-key is evicted before response. # volatile-key is evicted before response.
set res [r getbit big-key 0] set res [r getbit big-key 0]
assert_equal $res {invalidate volatile-key} assert_equal $res {invalidate volatile-key}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment