2018-03-25 11:03:38 +00:00
|
|
|
set defaults { appendonly {yes} appendfilename {appendonly.aof} aof-use-rdb-preamble {no} }
|
2011-08-17 16:09:01 +00:00
|
|
|
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] {
|
2019-09-12 07:56:54 +00:00
|
|
|
set client [redis [srv host] [srv port] 0 $::tls]
|
|
|
|
set bench [open "|src/redis-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"]
|
|
|
|
|
2011-08-17 16:09:01 +00:00
|
|
|
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] {
|
2019-09-12 07:56:54 +00:00
|
|
|
set client [redis [srv host] [srv port] 0 $::tls]
|
2011-08-17 16:09:01 +00:00
|
|
|
assert_equal 20000 [$client get foo]
|
|
|
|
}
|
|
|
|
}
|