mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00: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.
|
r config set auto-aof-rewrite-percentage 0 ; # Disable auto-rewrite.
|
||||||
waitForBgrewriteaof r
|
waitForBgrewriteaof r
|
||||||
|
|
||||||
test {AOF rewrite during write load} {
|
foreach rdbpre {yes no} {
|
||||||
# Start a write load for 10 seconds
|
r config set aof-use-rdb-preamble $rdbpre
|
||||||
set master [srv 0 client]
|
test "AOF rewrite during write load: RDB preamble=$rdbpre" {
|
||||||
set master_host [srv 0 host]
|
# Start a write load for 10 seconds
|
||||||
set master_port [srv 0 port]
|
set master [srv 0 client]
|
||||||
set load_handle0 [start_write_load $master_host $master_port 10]
|
set master_host [srv 0 host]
|
||||||
set load_handle1 [start_write_load $master_host $master_port 10]
|
set master_port [srv 0 port]
|
||||||
set load_handle2 [start_write_load $master_host $master_port 10]
|
set load_handle0 [start_write_load $master_host $master_port 10]
|
||||||
set load_handle3 [start_write_load $master_host $master_port 10]
|
set load_handle1 [start_write_load $master_host $master_port 10]
|
||||||
set load_handle4 [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
|
# Make sure the instance is really receiving data
|
||||||
wait_for_condition 50 100 {
|
wait_for_condition 50 100 {
|
||||||
[r dbsize] > 0
|
[r dbsize] > 0
|
||||||
} else {
|
} else {
|
||||||
fail "No write load detected."
|
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…
x
Reference in New Issue
Block a user