aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-04-11 00:54:45 +0000
committerBruce Momjian <bruce@momjian.us>2004-04-11 00:54:45 +0000
commit3c4ab3f51d927a75c97b59db3c7041ae3e2fa0a5 (patch)
treec8e71abcb592e59d4029718faed85662a9993709 /src/backend/tcop/postgres.c
parent1934055cbe0b4ae29f6008154eb8b34a30c83816 (diff)
downloadpostgresql-3c4ab3f51d927a75c97b59db3c7041ae3e2fa0a5.tar.gz
postgresql-3c4ab3f51d927a75c97b59db3c7041ae3e2fa0a5.zip
Exit backend from SIGTERM or FATAL by simulating client EOF, rather than
calling proc_exit() directly. This should make SIGTERM more reliable.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 6cece54b30b..09fc57b6ea1 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.398 2004/04/07 05:05:49 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.399 2004/04/11 00:54:44 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -2938,7 +2938,10 @@ PostgresMain(int argc, char *argv[], const char *username)
/*
* (3) read a command (loop blocks here)
*/
- firstchar = ReadCommand(&input_message);
+ if (!in_fatal_exit)
+ firstchar = ReadCommand(&input_message);
+ else
+ firstchar = EOF;
/*
* (4) disable async signal conditions again.
@@ -3170,7 +3173,8 @@ PostgresMain(int argc, char *argv[], const char *username)
* Otherwise it will fail to be called during other
* backend-shutdown scenarios.
*/
- proc_exit(0);
+ proc_exit(!in_fatal_exit ? 0 : proc_exit_inprogress ||
+ !IsUnderPostmaster);
case 'd': /* copy data */
case 'c': /* copy done */