aboutsummaryrefslogtreecommitdiff
path: root/src/backend/postmaster/postmaster.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2014-11-25 20:13:30 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2014-11-25 20:13:30 +0000
commitaedccb1f6fef988af1d1a25b78151f3773954b4c (patch)
treec8c871067acee2eab8c838dad2449a0bf33ab975 /src/backend/postmaster/postmaster.c
parentbb1b8f694ad2efc35ebae2acfa2c18a2197b82a1 (diff)
downloadpostgresql-aedccb1f6fef988af1d1a25b78151f3773954b4c.tar.gz
postgresql-aedccb1f6fef988af1d1a25b78151f3773954b4c.zip
action_at_recovery_target recovery config option
action_at_recovery_target = pause | promote | shutdown Petr Jelinek Reviewed by Muhammad Asif Naeem, Fujji Masao and Simon Riggs
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r--src/backend/postmaster/postmaster.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 6220a8e6e47..5106f52e0e0 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -509,6 +509,7 @@ static void ShmemBackendArrayRemove(Backend *bn);
/* Macros to check exit status of a child process */
#define EXIT_STATUS_0(st) ((st) == 0)
#define EXIT_STATUS_1(st) (WIFEXITED(st) && WEXITSTATUS(st) == 1)
+#define EXIT_STATUS_3(st) (WIFEXITED(st) && WEXITSTATUS(st) == 3)
#ifndef WIN32
/*
@@ -2555,6 +2556,17 @@ reaper(SIGNAL_ARGS)
continue;
}
+ if (EXIT_STATUS_3(exitstatus))
+ {
+ ereport(LOG,
+ (errmsg("shutdown at recovery target")));
+ Shutdown = SmartShutdown;
+ TerminateChildren(SIGTERM);
+ pmState = PM_WAIT_BACKENDS;
+ /* PostmasterStateMachine logic does the rest */
+ continue;
+ }
+
/*
* Unexpected exit of startup process (including FATAL exit)
* during PM_STARTUP is treated as catastrophic. There are no