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/utils/init/miscinit.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/backend/utils/init/miscinit.c') diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index df46469f000..4f2b940b7ea 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.71 2001/06/14 01:09:22 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.72 2001/06/20 18:07:56 petere Exp $ * *------------------------------------------------------------------------- */ @@ -28,6 +28,7 @@ #include "catalog/catname.h" #include "catalog/pg_shadow.h" +#include "libpq/libpq-be.h" #include "miscadmin.h" #include "utils/builtins.h" #include "utils/lsyscache.h" @@ -279,6 +280,7 @@ SetCharSet() int i; unsigned char FromChar, ToChar; + char ChTable[80]; for (i = 0; i < 128; i++) { @@ -286,11 +288,17 @@ SetCharSet() RecodeBackTable[i] = i + 128; } - p = getenv("PG_RECODETABLE"); + if (IsUnderPostmaster) + { + GetCharSetByHost(ChTable, MyProcPort->raddr.in.sin_addr.s_addr, DataDir); + p = ChTable; + } + else + p = getenv("PG_RECODETABLE"); + if (p && *p != '\0') { - map_file = (char *) malloc((strlen(DataDir) + - strlen(p) + 2) * sizeof(char)); + map_file = malloc(strlen(DataDir) + strlen(p) + 2); if (! map_file) elog(FATAL, "out of memory"); sprintf(map_file, "%s/%s", DataDir, p); -- cgit v1.2.3