summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-08-24 15:39:39 +0200
committerantirez <antirez@gmail.com>2016-08-24 15:39:39 +0200
commitdacb69ed007b9b1a0767cac420904b7af020f9e4 (patch)
treee24991342505b8f661bc454b6e877df3be641979 /tests
parent764cc69e2bf447e72fc0858818c8fbd741feb525 (diff)
downloadredis-dacb69ed007b9b1a0767cac420904b7af020f9e4.tar.gz
RDB AOF preamble: test it in the aofrw unit.aofrdb
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/aofrw.tcl101
1 files changed, 52 insertions, 49 deletions
diff --git a/tests/unit/aofrw.tcl b/tests/unit/aofrw.tcl
index 4fdbdc6c6..c5430eedc 100644
--- a/tests/unit/aofrw.tcl
+++ b/tests/unit/aofrw.tcl
@@ -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]
-
- # Make sure the instance is really receiving data
- wait_for_condition 50 100 {
- [r dbsize] > 0
- } else {
- fail "No write load detected."
- }
+ 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."
+ }
- # After 3 seconds, start a rewrite, while the write load is still
- # active.
- after 3000
- r bgrewriteaof
- waitForBgrewriteaof r
+ # 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"
+ }
- # Let it run a bit more so that we'll append some data to the new
- # AOF.
- after 1000
+ # Get the data set digest
+ set d1 [r debug digest]
- # 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
+ # Load the AOF
+ r debug loadaof
+ set d2 [r debug digest]
- # 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"
+ # Make sure they are the same
+ assert {$d1 eq $d2}
}
-
- # 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}
}
}