Kills an AOFRW child process if exists */
| 226 | |
| 227 | /* Kills an AOFRW child process if exists */ |
| 228 | void killAppendOnlyChild(void) { |
| 229 | int statloc; |
| 230 | /* No AOFRW child? return. */ |
| 231 | if (g_pserver->child_type != CHILD_TYPE_AOF) return; |
| 232 | /* Kill AOFRW child, wait for child exit. */ |
| 233 | serverLog(LL_NOTICE,"Killing running AOF rewrite child: %ld", |
| 234 | (long) g_pserver->child_pid); |
| 235 | if (kill(g_pserver->child_pid,SIGUSR1) != -1) { |
| 236 | while(waitpid(-1, &statloc, 0) != g_pserver->child_pid); |
| 237 | } |
| 238 | /* Reset the buffer accumulating changes while the child saves. */ |
| 239 | aofRewriteBufferReset(); |
| 240 | aofRemoveTempFile(g_pserver->child_pid); |
| 241 | resetChildState(); |
| 242 | g_pserver->aof_rewrite_time_start = -1; |
| 243 | /* Close pipes used for IPC between the two processes. */ |
| 244 | aofClosePipes(); |
| 245 | } |
| 246 | |
| 247 | /* Called when the user switches from "appendonly yes" to "appendonly no" |
| 248 | * at runtime using the CONFIG command. */ |
no test coverage detected