diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-07-20 00:47:53 +0000 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-07-20 00:47:53 +0000 |
commit | 5ffaa9005c451330bcde29d11a9385c0900ee707 (patch) | |
tree | 0e33f0f8054bd0523f7142a057e38569f11957e8 /src/backend/postmaster/postmaster.c | |
parent | 0839f312e92c7ab0aecb2c4133197a7da7c5fc39 (diff) | |
download | postgresql-5ffaa9005c451330bcde29d11a9385c0900ee707.tar.gz postgresql-5ffaa9005c451330bcde29d11a9385c0900ee707.zip |
Add restart_after_crash GUC.
Normally, we automatically restart after a backend crash, but in some
cases when PostgreSQL is invoked by clusterware it may be desirable to
suppress this behavior, so we provide an option which does this.
Since no existing GUC group quite fits, create a new group called
"error handling options" for this and the previously undocumented GUC
exit_on_error, which is now documented.
Review by Fujii Masao.
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index b367bc9ea10..7d48bb2545b 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.614 2010/07/06 19:18:57 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.615 2010/07/20 00:47:52 rhaas Exp $ * * NOTES * @@ -203,6 +203,7 @@ bool Db_user_namespace = false; bool enable_bonjour = false; char *bonjour_name; +bool restart_after_crash = true; /* PIDs of special child processes; 0 when not running */ static pid_t StartupPID = 0, @@ -3048,12 +3049,13 @@ PostmasterStateMachine(void) } /* - * If recovery failed, wait for all non-syslogger children to exit, and - * then exit postmaster. We don't try to reinitialize when recovery fails, - * because more than likely it will just fail again and we will keep - * trying forever. + * If recovery failed, or the user does not want an automatic restart after + * backend crashes, wait for all non-syslogger children to exit, and then + * exit postmaster. We don't try to reinitialize when recovery fails, + * because more than likely it will just fail again and we will keep trying + * forever. */ - if (RecoveryError && pmState == PM_NO_CHILDREN) + if (pmState == PM_NO_CHILDREN && (RecoveryError || !restart_after_crash)) ExitPostmaster(1); /* |