* sigusr1_handler - handle signal conditions from child processes */
| 5736 | * sigusr1_handler - handle signal conditions from child processes |
| 5737 | */ |
| 5738 | static void |
| 5739 | sigusr1_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 | /* |
nothing calls this directly
no test coverage detected