]> git.saurik.com Git - redis.git/blob - tests/integration/aof-race.tcl
TODO file removed.
[redis.git] / tests / integration / aof-race.tcl
1 set defaults { appendonly {yes} appendfilename {appendonly.aof} }
2 set server_path [tmpdir server.aof]
3 set aof_path "$server_path/appendonly.aof"
4
5 proc start_server_aof {overrides code} {
6 upvar defaults defaults srv srv server_path server_path
7 set config [concat $defaults $overrides]
8 start_server [list overrides $config] $code
9 }
10
11 tags {"aof"} {
12 # Specific test for a regression where internal buffers were not properly
13 # cleaned after a child responsible for an AOF rewrite exited. This buffer
14 # was subsequently appended to the new AOF, resulting in duplicate commands.
15 start_server_aof [list dir $server_path] {
16 set client [redis [srv host] [srv port]]
17 set bench [open "|src/redis-benchmark -q -p [srv port] -c 20 -n 20000 incr foo" "r+"]
18 after 100
19
20 # Benchmark should be running by now: start background rewrite
21 $client bgrewriteaof
22
23 # Read until benchmark pipe reaches EOF
24 while {[string length [read $bench]] > 0} {}
25
26 # Check contents of foo
27 assert_equal 20000 [$client get foo]
28 }
29
30 # Restart server to replay AOF
31 start_server_aof [list dir $server_path] {
32 set client [redis [srv host] [srv port]]
33 assert_equal 20000 [$client get foo]
34 }
35 }