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 wait_for_condition
50 100 {
11 [string match
{*Killing
*AOF
*child
*} [exec tail
-n5 < [srv
0 stdout
]]]
13 fail
"Can't find 'Killing AOF child' into recent logs"
17 foreach d
{string int
} {
18 foreach e
{ziplist linkedlist
} {
19 test
"AOF rewrite of list with $e encoding, $d data" {
21 if {$e eq
{ziplist
}} {set len
10} else {set len
1000}
22 for {set j
0} {$j < $len} {incr j
} {
24 set data
[randstring
0 16 alpha
]
26 set data
[randomInt
4000000000]
30 assert_equal
[r object
encoding key
] $e
31 set d1
[r debug digest
]
35 set d2
[r debug digest
]
37 error "assertion:$d1 is not equal to $d2"
43 foreach d
{string int
} {
44 foreach e
{intset hashtable
} {
45 test
"AOF rewrite of set with $e encoding, $d data" {
47 if {$e eq
{intset
}} {set len
10} else {set len
1000}
48 for {set j
0} {$j < $len} {incr j
} {
50 set data
[randstring
0 16 alpha
]
52 set data
[randomInt
4000000000]
57 assert_equal
[r object
encoding key
] $e
59 set d1
[r debug digest
]
63 set d2
[r debug digest
]
65 error "assertion:$d1 is not equal to $d2"
71 foreach d
{string int
} {
72 foreach e
{ziplist hashtable
} {
73 test
"AOF rewrite of hash with $e encoding, $d data" {
75 if {$e eq
{ziplist
}} {set len
10} else {set len
1000}
76 for {set j
0} {$j < $len} {incr j
} {
78 set data
[randstring
0 16 alpha
]
80 set data
[randomInt
4000000000]
82 r hset key
$data $data
84 assert_equal
[r object
encoding key
] $e
85 set d1
[r debug digest
]
89 set d2
[r debug digest
]
91 error "assertion:$d1 is not equal to $d2"
97 foreach d
{string int
} {
98 foreach e
{ziplist skiplist
} {
99 test
"AOF rewrite of zset with $e encoding, $d data" {
101 if {$e eq
{ziplist
}} {set len
10} else {set len
1000}
102 for {set j
0} {$j < $len} {incr j
} {
103 if {$d eq
{string}} {
104 set data
[randstring
0 16 alpha
]
106 set data
[randomInt
4000000000]
108 r zadd key
[expr rand
()] $data
110 assert_equal
[r object
encoding key
] $e
111 set d1
[r debug digest
]
113 waitForBgrewriteaof r
115 set d2
[r debug digest
]
117 error "assertion:$d1 is not equal to $d2"
123 test
{BGREWRITEAOF is delayed
if BGSAVE is in progress
} {
129 assert_match
{*scheduled
*} [lindex $res 1]
130 assert_match
{*aof_rewrite_scheduled
:1*} [lindex $res 2]
131 while {[string match
{*aof_rewrite_scheduled
:1*} [r
info persistence
]]} {
136 test
{BGREWRITEAOF is refused
if already in progress
} {
143 assert_match
{*ERR
*already
*} $e
144 while {[string match
{*aof_rewrite_scheduled
:1*} [r
info persistence
]]} {