diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2011-08-17 18:09:01 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2011-09-16 11:24:08 +0200 |
commit | b9a65682fb0b09498215319a2e53a0bf450f6560 (patch) | |
tree | 5c2d6217fca28e4ad5ea51826fc2e9536f380c8a /tests | |
parent | e3d1c8b080cd2128c97d567cb9168fd2cdb748cb (diff) | |
download | redis-b9a65682fb0b09498215319a2e53a0bf450f6560.tar.gz |
Failing test related to AOF rewrite buffers
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/aof-race.tcl | 35 | ||||
-rw-r--r-- | tests/test_helper.tcl | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/integration/aof-race.tcl b/tests/integration/aof-race.tcl new file mode 100644 index 000000000..207f20739 --- /dev/null +++ b/tests/integration/aof-race.tcl @@ -0,0 +1,35 @@ +set defaults { appendonly {yes} appendfilename {appendonly.aof} } +set server_path [tmpdir server.aof] +set aof_path "$server_path/appendonly.aof" + +proc start_server_aof {overrides code} { + upvar defaults defaults srv srv server_path server_path + set config [concat $defaults $overrides] + start_server [list overrides $config] $code +} + +tags {"aof"} { + # Specific test for a regression where internal buffers were not properly + # cleaned after a child responsible for an AOF rewrite exited. This buffer + # was subsequently appended to the new AOF, resulting in duplicate commands. + start_server_aof [list dir $server_path] { + set client [redis [srv host] [srv port]] + set bench [open "|src/redis-benchmark -q -p [srv port] -c 20 -n 20000 incr foo" "r+"] + after 100 + + # Benchmark should be running by now: start background rewrite + $client bgrewriteaof + + # Read until benchmark pipe reaches EOF + while {[string length [read $bench]] > 0} {} + + # Check contents of foo + assert_equal 20000 [$client get foo] + } + + # Restart server to replay AOF + start_server_aof [list dir $server_path] { + set client [redis [srv host] [srv port]] + assert_equal 20000 [$client get foo] + } +} diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 3a72d84af..9549a469a 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -29,6 +29,7 @@ set ::all_tests { integration/replication-2 integration/replication-3 integration/aof + integration/aof-race unit/pubsub unit/slowlog unit/maxmemory |