Kills an AOFRW child process if exists */
| 213 | |
| 214 | /* Kills an AOFRW child process if exists */ |
| 215 | void killAppendOnlyChild(void) { |
| 216 | int statloc; |
| 217 | /* No AOFRW child? return. */ |
| 218 | if (server.child_type != CHILD_TYPE_AOF) return; |
| 219 | /* Kill AOFRW child, wait for child exit. */ |
| 220 | serverLog(LL_NOTICE,"Killing running AOF rewrite child: %ld", |
| 221 | (long) server.child_pid); |
| 222 | if (kill(server.child_pid,SIGUSR1) != -1) { |
| 223 | while(waitpid(-1, &statloc, 0) != server.child_pid); |
| 224 | } |
| 225 | /* Reset the buffer accumulating changes while the child saves. */ |
| 226 | aofRewriteBufferReset(); |
| 227 | aofRemoveTempFile(server.child_pid); |
| 228 | resetChildState(); |
| 229 | server.aof_rewrite_time_start = -1; |
| 230 | /* Close pipes used for IPC between the two processes. */ |
| 231 | aofClosePipes(); |
| 232 | } |
| 233 | |
| 234 | /* Called when the user switches from "appendonly yes" to "appendonly no" |
| 235 | * at runtime using the CONFIG command. */ |
no test coverage detected