MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / killAppendOnlyChild

Function killAppendOnlyChild

src/aof.cpp:228–245  ·  view source on GitHub ↗

Kills an AOFRW child process if exists */

Source from the content-addressed store, hash-verified

226
227/* Kills an AOFRW child process if exists */
228void 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. */

Callers 3

prepareForShutdownFunction · 0.85
stopAppendOnlyFunction · 0.85
startAppendOnlyFunction · 0.85

Calls 5

serverLogFunction · 0.85
aofRewriteBufferResetFunction · 0.85
aofRemoveTempFileFunction · 0.85
resetChildStateFunction · 0.85
aofClosePipesFunction · 0.85

Tested by

no test coverage detected