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. */
| 3687 | * the child did not exit for sn error, but because we wanted), and performs |
| 3688 | * the cleanup needed. */ |
| 3689 | void 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 | |
| 3718 | struct rdbSaveSocketThreadArgs |
| 3719 | { |
no test coverage detected