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

Function killRDBChild

src/rdb.cpp:3689–3716  ·  view source on GitHub ↗

Kill the RDB saving child using SIGUSR1 (so that the parent will know * the child did not exit for sn error, but because we wanted), and performs * the cleanup needed. */

Source from the content-addressed store, hash-verified

3687 * the child did not exit for sn error, but because we wanted), and performs
3688 * the cleanup needed. */
3689void killRDBChild(bool fSynchronous) {
3690 serverAssert(GlobalLocksAcquired());
3691
3692 if (cserver.fForkBgSave) {
3693 kill(g_pserver->child_pid,SIGUSR1);
3694 } else {
3695 g_pserver->rdbThreadVars.fRdbThreadCancel = true;
3696 if (g_pserver->rdb_child_type == RDB_CHILD_TYPE_SOCKET) {
3697 // Wake up the thread so it can exit
3698 auto t = write(g_pserver->rdb_child_exit_pipe, &cserver.fForkBgSave, 1);
3699 UNUSED(t);
3700 // Flush out the rdb pipe in case the writer thread is blocked
3701 unblockChildThreadIfNecessary();
3702 }
3703 if (fSynchronous)
3704 {
3705 aeReleaseLock();
3706 serverAssert(!GlobalLocksAcquired());
3707 void *result;
3708 int err = pthread_join(g_pserver->rdbThreadVars.rdb_child_thread, &result);
3709 if (err) {
3710 serverLog(LL_WARNING, "RDB child thread could not be joined: %s", strerror(err));
3711 }
3712 g_pserver->rdbThreadVars.fRdbThreadCancel = false;
3713 aeAcquireLock();
3714 }
3715 }
3716}
3717
3718struct rdbSaveSocketThreadArgs
3719{

Callers 5

flushAllDataAndResetRDBFunction · 0.85
rdbPipeReadHandlerFunction · 0.85
readSyncBulkPayloadRdbFunction · 0.85
prepareForShutdownFunction · 0.85
freeClientFunction · 0.85

Calls 5

GlobalLocksAcquiredFunction · 0.85
aeReleaseLockFunction · 0.85
serverLogFunction · 0.85
aeAcquireLockFunction · 0.85

Tested by

no test coverage detected