aboutsummaryrefslogtreecommitdiff
path: root/examples/redis-unstable/tests/integration/aof-race.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'examples/redis-unstable/tests/integration/aof-race.tcl')
-rw-r--r--examples/redis-unstable/tests/integration/aof-race.tcl37
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/redis-unstable/tests/integration/aof-race.tcl b/examples/redis-unstable/tests/integration/aof-race.tcl
new file mode 100644
index 0000000..839858b
--- /dev/null
+++ b/examples/redis-unstable/tests/integration/aof-race.tcl
@@ -0,0 +1,37 @@
1source tests/support/aofmanifest.tcl
2set defaults { appendonly {yes} appendfilename {appendonly.aof} appenddirname {appendonlydir} aof-use-rdb-preamble {no} }
3set server_path [tmpdir server.aof]
4
5tags {"aof external:skip"} {
6 # Specific test for a regression where internal buffers were not properly
7 # cleaned after a child responsible for an AOF rewrite exited. This buffer
8 # was subsequently appended to the new AOF, resulting in duplicate commands.
9 start_server_aof [list dir $server_path] {
10 set client [redis [srv host] [srv port] 0 $::tls]
11 set bench [open "|src/redis-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"]
12
13 wait_for_condition 100 1 {
14 [$client get foo] > 0
15 } else {
16 # Don't care if it fails.
17 }
18
19 # Benchmark should be running by now: start background rewrite
20 $client bgrewriteaof
21
22 # Read until benchmark pipe reaches EOF
23 while {[string length [read $bench]] > 0} {}
24
25 waitForBgrewriteaof $client
26
27 # Check contents of foo
28 assert_equal 20000 [$client get foo]
29 }
30
31 # Restart server to replay AOF
32 start_server_aof [list dir $server_path] {
33 set client [redis [srv host] [srv port] 0 $::tls]
34 wait_done_loading $client
35 assert_equal 20000 [$client get foo]
36 }
37}