mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
sysv_shmem.c patch is to correct a bug that prevents the postmaster
recovering from an unexpected backend termination. The remaining patches are to allow whitespace in db/install directory names. Claudio Natoli
This commit is contained in:
@ -10,7 +10,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.33 2004/04/19 17:42:58 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.34 2004/05/06 19:23:25 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -250,7 +250,7 @@ PGSharedMemoryCreate(uint32 size, bool makePrivate, int port)
|
|||||||
|
|
||||||
#ifdef EXEC_BACKEND
|
#ifdef EXEC_BACKEND
|
||||||
/* If Exec case, just attach and return the pointer */
|
/* If Exec case, just attach and return the pointer */
|
||||||
if (UsedShmemSegAddr != NULL && !makePrivate)
|
if (UsedShmemSegAddr != NULL && !makePrivate && IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
void* origUsedShmemSegAddr = UsedShmemSegAddr;
|
void* origUsedShmemSegAddr = UsedShmemSegAddr;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
|
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.67 2004/04/19 17:42:58 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.68 2004/05/06 19:23:25 momjian Exp $
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
@ -485,11 +485,10 @@ pgstat_forkexec(STATS_PROCESS_TYPE procType)
|
|||||||
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%d",MaxBackends);
|
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%d",MaxBackends);
|
||||||
|
|
||||||
/* + the pstat file names, and postgres pathname */
|
/* + the pstat file names, and postgres pathname */
|
||||||
/* FIXME: [fork/exec] whitespaces in directories? */
|
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pgStat_tmpfname);
|
||||||
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pgStat_tmpfname);
|
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pgStat_fname);
|
||||||
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pgStat_fname);
|
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",pg_pathname);
|
||||||
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",pg_pathname);
|
snprintf(pgstatBuf[bufc++],MAXPGPATH,"\"%s\"",DataDir);
|
||||||
snprintf(pgstatBuf[bufc++],MAXPGPATH,"%s",DataDir);
|
|
||||||
|
|
||||||
/* Add to the arg list */
|
/* Add to the arg list */
|
||||||
Assert(bufc <= lengthof(pgstatBuf));
|
Assert(bufc <= lengthof(pgstatBuf));
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.381 2004/04/19 17:42:58 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.382 2004/05/06 19:23:25 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -2741,8 +2741,7 @@ Backend_forkexec(Port *port)
|
|||||||
|
|
||||||
/* Format up context to pass to exec'd process */
|
/* Format up context to pass to exec'd process */
|
||||||
snprintf(buf[bufc++],MAXPGPATH,"%lu",tmpBackendFileNum);
|
snprintf(buf[bufc++],MAXPGPATH,"%lu",tmpBackendFileNum);
|
||||||
/* FIXME: [fork/exec] whitespaces in directories? */
|
snprintf(buf[bufc++],MAXPGPATH,"\"%s\"",DataDir);
|
||||||
snprintf(buf[bufc++],MAXPGPATH,"%s",DataDir);
|
|
||||||
|
|
||||||
/* Add to the arg list */
|
/* Add to the arg list */
|
||||||
Assert(bufc <= lengthof(buf));
|
Assert(bufc <= lengthof(buf));
|
||||||
@ -3039,6 +3038,7 @@ SSDataBase(int xlop)
|
|||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
char idbuf[32];
|
char idbuf[32];
|
||||||
|
char ddirbuf[MAXPGPATH];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -3097,8 +3097,9 @@ SSDataBase(int xlop)
|
|||||||
|
|
||||||
#ifdef EXEC_BACKEND
|
#ifdef EXEC_BACKEND
|
||||||
/* pass data dir before end of secure switches (-p) */
|
/* pass data dir before end of secure switches (-p) */
|
||||||
|
snprintf(ddirbuf, MAXPGPATH, "\"%s\"", DataDir);
|
||||||
av[ac++] = "-D";
|
av[ac++] = "-D";
|
||||||
av[ac++] = DataDir;
|
av[ac++] = ddirbuf;
|
||||||
|
|
||||||
/* and the backend identifier + dbname */
|
/* and the backend identifier + dbname */
|
||||||
snprintf(idbuf, sizeof(idbuf), "-p%lu,template1", tmpBackendFileNum);
|
snprintf(idbuf, sizeof(idbuf), "-p%lu,template1", tmpBackendFileNum);
|
||||||
@ -3490,7 +3491,7 @@ pid_t win32_forkexec(const char* path, char *argv[])
|
|||||||
HANDLE waiterThread;
|
HANDLE waiterThread;
|
||||||
|
|
||||||
/* Format the cmd line */
|
/* Format the cmd line */
|
||||||
snprintf(cmdLine,sizeof(cmdLine),"%s",path);
|
snprintf(cmdLine,sizeof(cmdLine),"\"%s\"",path);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (argv[++i] != NULL)
|
while (argv[++i] != NULL)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user