summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-02-06 15:29:26 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2012-02-06 15:29:41 -0500
commitef19c9dfaa99a2b78ed0f78aa4a44ed31636fdc4 (patch)
tree18faa1f2c0139ded2b8f3564b208dfd2c0b84010
parentc74ad4e55bf9142478192e5507555ac2c95e0985 (diff)
downloadpostgresql-ef19c9dfaa99a2b78ed0f78aa4a44ed31636fdc4.tar.gz
Fix postmaster to attempt restart after a hot-standby crash.
The postmaster was coded to treat any unexpected exit of the startup process (i.e., the WAL replay process) as a catastrophic crash, and not try to restart it. This was OK so long as the startup process could not have any sibling postmaster children. However, if a hot-standby backend crashes, we SIGQUIT the startup process along with everything else, and the resulting exit is hardly "unexpected". Treating it as such meant we failed to restart a standby server after any child crash at all, not only a crash of the WAL replay process as intended. Adjust that. Back-patch to 9.0 where hot standby was introduced.
-rw-r--r--src/backend/postmaster/postmaster.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 367aa0ca50..067edcfe29 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2391,13 +2391,18 @@ reaper(SIGNAL_ARGS)
}
/*
- * Any unexpected exit (including FATAL exit) of the startup
- * process is treated as a crash, except that we don't want to
- * reinitialize.
+ * After PM_STARTUP, any unexpected exit (including FATAL exit) of
+ * the startup process is catastrophic, so kill other children,
+ * and set RecoveryError so we don't try to reinitialize after
+ * they're gone. Exception: if FatalError is already set, that
+ * implies we previously sent the startup process a SIGQUIT, so
+ * that's probably the reason it died, and we do want to try to
+ * restart in that case.
*/
if (!EXIT_STATUS_0(exitstatus))
{
- RecoveryError = true;
+ if (!FatalError)
+ RecoveryError = true;
HandleChildCrash(pid, exitstatus,
_("startup process"));
continue;