mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
improve the stability and correctness of "Test child sending info" (#9562)
Since we measure the COW size in this test by changing some keys and reading the reported COW size, we need to ensure that the "dismiss mechanism" (#8974) will not free memory and reduce the COW size. For that, this commit changes the size of the keys to 512B (less than a page). and because some keys may fall into the same page, we are modifying ten keys on each iteration and check for at least 50% change in the COW size.
This commit is contained in:
parent
6f4f31f167
commit
5becb7c9c6
@ -228,7 +228,8 @@ start_server {} {
|
||||
|
||||
# Our COW metrics (Private_Dirty) work only on Linux
|
||||
set system_name [string tolower [exec uname -s]]
|
||||
if {$system_name eq {linux}} {
|
||||
set page_size [exec getconf PAGESIZE]
|
||||
if {$system_name eq {linux} && $page_size == 4096} {
|
||||
|
||||
start_server {overrides {save ""}} {
|
||||
test {Test child sending info} {
|
||||
@ -245,9 +246,11 @@ start_server {overrides {save ""}} {
|
||||
r config set rdb-key-save-delay 200
|
||||
r config set loglevel debug
|
||||
|
||||
# populate the db with 10k keys of 4k each
|
||||
# populate the db with 10k keys of 512B each (since we want to measure the COW size by
|
||||
# changing some keys and read the reported COW size, we are using small key size to prevent from
|
||||
# the "dismiss mechanism" free memory and reduce the COW size)
|
||||
set rd [redis_deferring_client 0]
|
||||
set size 4096
|
||||
set size 500 ;# aim for the 512 bin (sds overhead)
|
||||
set cmd_count 10000
|
||||
for {set k 0} {$k < $cmd_count} {incr k} {
|
||||
$rd set key$k [string repeat A $size]
|
||||
@ -270,6 +273,7 @@ start_server {overrides {save ""}} {
|
||||
# on each iteration, we will write some key to the server to trigger copy-on-write, and
|
||||
# wait to see that it reflected in INFO.
|
||||
set iteration 1
|
||||
set key_idx 0
|
||||
while 1 {
|
||||
# take samples before writing new data to the server
|
||||
set cow_size [s current_cow_size]
|
||||
@ -283,12 +287,19 @@ start_server {overrides {save ""}} {
|
||||
}
|
||||
|
||||
# trigger copy-on-write
|
||||
r setrange key$iteration 0 [string repeat B $size]
|
||||
set modified_keys 16
|
||||
for {set k 0} {$k < $modified_keys} {incr k} {
|
||||
r setrange key$key_idx 0 [string repeat B $size]
|
||||
incr key_idx 1
|
||||
}
|
||||
|
||||
# changing 16 keys (512B each) will create at least 8192 COW (2 pages), but we don't want the test
|
||||
# to be too strict, so we check for a change of at least 4096 bytes
|
||||
set exp_cow [expr $cow_size + 4096]
|
||||
# wait to see that current_cow_size value updated (as long as the child is in progress)
|
||||
wait_for_condition 80 100 {
|
||||
[s rdb_bgsave_in_progress] == 0 ||
|
||||
[s current_cow_size] >= $cow_size + $size &&
|
||||
[s current_cow_size] >= $exp_cow &&
|
||||
[s current_save_keys_processed] > $keys_processed &&
|
||||
[s current_fork_perc] > 0
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user