Skip to content

Commit

Permalink
Failing test related to AOF rewrite buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern authored and antirez committed Sep 16, 2011
1 parent bdbf3ac commit 3aa4b00
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/integration/aof-race.tcl
Original file line number Diff line number Diff line change
@@ -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]
}
}
1 change: 1 addition & 0 deletions tests/test_helper.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ set ::all_tests {
integration/replication-2
integration/replication-3
integration/aof
integration/aof-race
unit/pubsub
unit/slowlog
unit/scripting
Expand Down

0 comments on commit 3aa4b00

Please sign in to comment.