MCPcopy Create free account
hub / github.com/apache/cloudberry / sigusr1_handler

Function sigusr1_handler

src/backend/postmaster/postmaster.c:5738–5964  ·  view source on GitHub ↗

* sigusr1_handler - handle signal conditions from child processes */

Source from the content-addressed store, hash-verified

5736 * sigusr1_handler - handle signal conditions from child processes
5737 */
5738static void
5739sigusr1_handler(SIGNAL_ARGS)
5740{
5741 int save_errno = errno;
5742
5743 /*
5744 * RECOVERY_STARTED and BEGIN_HOT_STANDBY signals are ignored in
5745 * unexpected states. If the startup process quickly starts up, completes
5746 * recovery, exits, we might process the death of the startup process
5747 * first. We don't want to go back to recovery in that case.
5748 */
5749 if (CheckPostmasterSignal(PMSIGNAL_RECOVERY_STARTED) &&
5750 pmState == PM_STARTUP && Shutdown == NoShutdown)
5751 {
5752 /* WAL redo has started. We're out of reinitialization. */
5753 bool promotion_requested = false;
5754
5755 FatalError = false;
5756 AbortStartTime = 0;
5757
5758 /*
5759 * Crank up the background tasks. It doesn't matter if this fails,
5760 * we'll just try again later.
5761 */
5762 Assert(CheckpointerPID == 0);
5763 CheckpointerPID = StartCheckpointer();
5764 Assert(BgWriterPID == 0);
5765 BgWriterPID = StartBackgroundWriter();
5766
5767 /*
5768 * Start the archiver if we're responsible for (re-)archiving received
5769 * files.
5770 */
5771 Assert(PgArchPID == 0);
5772 if (XLogArchivingAlways())
5773 PgArchPID = StartArchiver();
5774
5775 /*
5776 * GPDB: if promote trigger file exist we don't wish to convey
5777 * PM_STATUS_STANDBY, instead wish pg_ctl -w to wait till
5778 * connections can be actually accepted by the database.
5779 */
5780 if (PromoteTriggerFile != NULL && strcmp(PromoteTriggerFile, "") != 0)
5781 {
5782 struct stat stat_buf;
5783
5784 if (stat(PromoteTriggerFile, &stat_buf) == 0)
5785 promotion_requested = true;
5786 }
5787 /*
5788 * GPDB: Setting recovery_target_action
5789 * configuration parameter to 'promote' will also result
5790 * into promotion after recovery is completed.
5791 */
5792 if (recoveryTargetAction == RECOVERY_TARGET_ACTION_PROMOTE)
5793 promotion_requested = true;
5794
5795 /*

Callers

nothing calls this directly

Calls 15

CheckPostmasterSignalFunction · 0.85
AddToDataDirLockFileFunction · 0.85
maybe_start_bgworkersFunction · 0.85
CheckLogrotateSignalFunction · 0.85
signal_childFunction · 0.85
StartAutovacuumWorkerFunction · 0.85
StartLMWorkerFunction · 0.85
MaybeStartWalReceiverFunction · 0.85
FtsProbePIDFunction · 0.85
DtxRecoveryPIDFunction · 0.85

Tested by

no test coverage detected