mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
RDB AOF preamble: test it in the aofrw unit.
This commit is contained in:
parent
764cc69e2b
commit
dacb69ed00
@ -4,60 +4,63 @@ start_server {tags {"aofrw"}} {
|
||||
r config set auto-aof-rewrite-percentage 0 ; # Disable auto-rewrite.
|
||||
waitForBgrewriteaof r
|
||||
|
||||
test {AOF rewrite during write load} {
|
||||
# Start a write load for 10 seconds
|
||||
set master [srv 0 client]
|
||||
set master_host [srv 0 host]
|
||||
set master_port [srv 0 port]
|
||||
set load_handle0 [start_write_load $master_host $master_port 10]
|
||||
set load_handle1 [start_write_load $master_host $master_port 10]
|
||||
set load_handle2 [start_write_load $master_host $master_port 10]
|
||||
set load_handle3 [start_write_load $master_host $master_port 10]
|
||||
set load_handle4 [start_write_load $master_host $master_port 10]
|
||||
foreach rdbpre {yes no} {
|
||||
r config set aof-use-rdb-preamble $rdbpre
|
||||
test "AOF rewrite during write load: RDB preamble=$rdbpre" {
|
||||
# Start a write load for 10 seconds
|
||||
set master [srv 0 client]
|
||||
set master_host [srv 0 host]
|
||||
set master_port [srv 0 port]
|
||||
set load_handle0 [start_write_load $master_host $master_port 10]
|
||||
set load_handle1 [start_write_load $master_host $master_port 10]
|
||||
set load_handle2 [start_write_load $master_host $master_port 10]
|
||||
set load_handle3 [start_write_load $master_host $master_port 10]
|
||||
set load_handle4 [start_write_load $master_host $master_port 10]
|
||||
|
||||
# Make sure the instance is really receiving data
|
||||
wait_for_condition 50 100 {
|
||||
[r dbsize] > 0
|
||||
} else {
|
||||
fail "No write load detected."
|
||||
# Make sure the instance is really receiving data
|
||||
wait_for_condition 50 100 {
|
||||
[r dbsize] > 0
|
||||
} else {
|
||||
fail "No write load detected."
|
||||
}
|
||||
|
||||
# After 3 seconds, start a rewrite, while the write load is still
|
||||
# active.
|
||||
after 3000
|
||||
r bgrewriteaof
|
||||
waitForBgrewriteaof r
|
||||
|
||||
# Let it run a bit more so that we'll append some data to the new
|
||||
# AOF.
|
||||
after 1000
|
||||
|
||||
# Stop the processes generating the load if they are still active
|
||||
stop_write_load $load_handle0
|
||||
stop_write_load $load_handle1
|
||||
stop_write_load $load_handle2
|
||||
stop_write_load $load_handle3
|
||||
stop_write_load $load_handle4
|
||||
|
||||
# Make sure that we remain the only connected client.
|
||||
# This step is needed to make sure there are no pending writes
|
||||
# that will be processed between the two "debug digest" calls.
|
||||
wait_for_condition 50 100 {
|
||||
[llength [split [string trim [r client list]] "\n"]] == 1
|
||||
} else {
|
||||
puts [r client list]
|
||||
fail "Clients generating loads are not disconnecting"
|
||||
}
|
||||
|
||||
# Get the data set digest
|
||||
set d1 [r debug digest]
|
||||
|
||||
# Load the AOF
|
||||
r debug loadaof
|
||||
set d2 [r debug digest]
|
||||
|
||||
# Make sure they are the same
|
||||
assert {$d1 eq $d2}
|
||||
}
|
||||
|
||||
# After 3 seconds, start a rewrite, while the write load is still
|
||||
# active.
|
||||
after 3000
|
||||
r bgrewriteaof
|
||||
waitForBgrewriteaof r
|
||||
|
||||
# Let it run a bit more so that we'll append some data to the new
|
||||
# AOF.
|
||||
after 1000
|
||||
|
||||
# Stop the processes generating the load if they are still active
|
||||
stop_write_load $load_handle0
|
||||
stop_write_load $load_handle1
|
||||
stop_write_load $load_handle2
|
||||
stop_write_load $load_handle3
|
||||
stop_write_load $load_handle4
|
||||
|
||||
# Make sure that we remain the only connected client.
|
||||
# This step is needed to make sure there are no pending writes
|
||||
# that will be processed between the two "debug digest" calls.
|
||||
wait_for_condition 50 100 {
|
||||
[llength [split [string trim [r client list]] "\n"]] == 1
|
||||
} else {
|
||||
puts [r client list]
|
||||
fail "Clients generating loads are not disconnecting"
|
||||
}
|
||||
|
||||
# Get the data set digest
|
||||
set d1 [r debug digest]
|
||||
|
||||
# Load the AOF
|
||||
r debug loadaof
|
||||
set d2 [r debug digest]
|
||||
|
||||
# Make sure they are the same
|
||||
assert {$d1 eq $d2}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user