From 9b4bfbdc2cd74342d9febb74c93acad1d4de84ca Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 20 Jun 2001 18:07:56 +0000 Subject: Handle reading of startup packet and authentication exchange after forking a new postmaster child process. This should eliminate problems with authentication blocking (e.g., ident, SSL init) and also reduce problems with the accept queue filling up under heavy load. The option to send elog output to a different file per backend (postgres -o) has been disabled for now because the initialization would have to happen in a different order and it's not clear we want to keep this anyway. --- src/backend/tcop/postgres.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 2692053a39d..476c2f72c3a 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.222 2001/06/19 23:40:10 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.223 2001/06/20 18:07:55 petere Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -45,6 +45,7 @@ #include "libpq/pqformat.h" #include "libpq/pqsignal.h" #include "miscadmin.h" +#include "libpq/auth.h" #include "nodes/print.h" #include "optimizer/cost.h" #include "optimizer/planner.h" @@ -1142,11 +1143,13 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha */ if (!IsUnderPostmaster) { + SetProcessingMode(InitProcessing); EnableExceptionHandling(true); MemoryContextInit(); } - SetProcessingMode(InitProcessing); + if (IsUnderPostmaster) + ClientAuthentication(MyProcPort); /* might not return */ /* * Set default values for command-line options. @@ -1567,13 +1570,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha * restart... */ } pq_init(); /* initialize libpq at backend startup */ - whereToSendOutput = Remote; BaseInit(); } else { /* interactive case: database name can be last arg on command line */ - whereToSendOutput = Debug; if (errs || argc - optind > 1) { fprintf(stderr, "%s: invalid command line arguments\nTry -? for help.\n", argv[0]); @@ -1709,7 +1710,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.222 $ $Date: 2001/06/19 23:40:10 $\n"); + puts("$Revision: 1.223 $ $Date: 2001/06/20 18:07:55 $\n"); } /* -- cgit v1.2.3