1 start_server
{tags
{"aofrw"}} {
3 test
{Turning off AOF kills the background writing child
if any
} {
4 r config
set appendonly yes
8 r config
set appendonly no
10 set result
[exec cat
[srv
0 stdout
] | tail
-n1]
11 } {*Killing
*AOF
*child
*}
13 foreach d
{string int
} {
14 foreach e
{ziplist linkedlist
} {
15 test
"AOF rewrite of list with $e encoding, $d data" {
17 if {$e eq
{ziplist
}} {set len
10} else {set len
1000}
18 for {set j
0} {$j < $len} {incr j
} {
20 set data
[randstring
0 16 alpha
]
22 set data
[randomInt
4000000000]
26 assert_equal
[r object
encoding key
] $e
27 set d1
[r debug digest
]
31 set d2
[r debug digest
]
33 error "assertion:$d1 is not equal to $d2"
39 foreach d
{string int
} {
40 foreach e
{intset hashtable
} {
41 test
"AOF rewrite of set with $e encoding, $d data" {
43 if {$e eq
{intset
}} {set len
10} else {set len
1000}
44 for {set j
0} {$j < $len} {incr j
} {
46 set data
[randstring
0 16 alpha
]
48 set data
[randomInt
4000000000]
53 assert_equal
[r object
encoding key
] $e
55 set d1
[r debug digest
]
59 set d2
[r debug digest
]
61 error "assertion:$d1 is not equal to $d2"
67 foreach d
{string int
} {
68 foreach e
{ziplist hashtable
} {
69 test
"AOF rewrite of hash with $e encoding, $d data" {
71 if {$e eq
{ziplist
}} {set len
10} else {set len
1000}
72 for {set j
0} {$j < $len} {incr j
} {
74 set data
[randstring
0 16 alpha
]
76 set data
[randomInt
4000000000]
78 r hset key
$data $data
80 assert_equal
[r object
encoding key
] $e
81 set d1
[r debug digest
]
85 set d2
[r debug digest
]
87 error "assertion:$d1 is not equal to $d2"
93 foreach d
{string int
} {
94 foreach e
{ziplist skiplist
} {
95 test
"AOF rewrite of zset with $e encoding, $d data" {
97 if {$e eq
{ziplist
}} {set len
10} else {set len
1000}
98 for {set j
0} {$j < $len} {incr j
} {
100 set data
[randstring
0 16 alpha
]
102 set data
[randomInt
4000000000]
104 r zadd key
[expr rand
()] $data
106 assert_equal
[r object
encoding key
] $e
107 set d1
[r debug digest
]
109 waitForBgrewriteaof r
111 set d2
[r debug digest
]
113 error "assertion:$d1 is not equal to $d2"
119 test
{BGREWRITEAOF is delayed
if BGSAVE is in progress
} {
125 assert_match
{*scheduled
*} [lindex $res 1]
126 assert_match
{*bgrewriteaof_scheduled
:1*} [lindex $res 2]
127 while {[string match
{*bgrewriteaof_scheduled
:1*} [r
info persistence
]]} {
132 test
{BGREWRITEAOF is refused
if already in progress
} {
139 assert_match
{*ERR
*already
*} $e
140 while {[string match
{*bgrewriteaof_scheduled
:1*} [r
info persistence
]]} {