diff options
author | Tom Lane | 2004-12-29 21:36:09 +0000 |
---|---|---|
committer | Tom Lane | 2004-12-29 21:36:09 +0000 |
commit | eee5abce46fec45ad40fef75b8d81e8f3ac7dda2 (patch) | |
tree | 20ccf400cbac12e6c10b2d99ead2b9f0b1a88951 /src/include | |
parent | e14018dc5e76b28a11fa57c067561a68ee46a764 (diff) |
Refactor EXEC_BACKEND code so that postmaster child processes reattach
to shared memory as soon as possible, ie, right after read_backend_variables.
The effective difference from the original code is that this happens
before instead of after read_nondefault_variables(), which loads GUC
information and is apparently capable of expanding the backend's memory
allocation more than you'd think it should. This should fix the
failure-to-attach-to-shared-memory reports we've been seeing on Windows.
Also clean up a few bits of unnecessarily grotty EXEC_BACKEND code.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/postmaster/postmaster.h | 5 | ||||
-rw-r--r-- | src/include/storage/ipc.h | 8 | ||||
-rw-r--r-- | src/include/storage/pg_shmem.h | 4 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h index 230b58ad0f..ce555f0aca 100644 --- a/src/include/postmaster/postmaster.h +++ b/src/include/postmaster/postmaster.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/postmaster/postmaster.h,v 1.7 2004/08/29 05:06:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/postmaster/postmaster.h,v 1.8 2004/12/29 21:36:08 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -41,6 +41,9 @@ extern void ClosePostmasterPorts(bool am_syslogger); #ifdef EXEC_BACKEND extern pid_t postmaster_forkexec(int argc, char *argv[]); extern int SubPostmasterMain(int argc, char *argv[]); + +extern size_t ShmemBackendArraySize(void); +extern void ShmemBackendArrayAllocation(void); #endif #endif /* _POSTMASTER_H */ diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h index 1920dd688e..0f623da7f8 100644 --- a/src/include/storage/ipc.h +++ b/src/include/storage/ipc.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.68 2004/08/29 05:06:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.69 2004/12/29 21:36:09 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -33,10 +33,4 @@ extern void CreateSharedMemoryAndSemaphores(bool makePrivate, int maxBackends, int port); -#ifdef EXEC_BACKEND -/* postmaster.c */ -extern size_t ShmemBackendArraySize(void); -extern void ShmemBackendArrayAllocation(void); -#endif - #endif /* IPC_H */ diff --git a/src/include/storage/pg_shmem.h b/src/include/storage/pg_shmem.h index 8b13ece9fe..c3692b7ee0 100644 --- a/src/include/storage/pg_shmem.h +++ b/src/include/storage/pg_shmem.h @@ -17,7 +17,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/pg_shmem.h,v 1.12 2004/11/09 21:30:18 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/pg_shmem.h,v 1.13 2004/12/29 21:36:09 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -41,6 +41,8 @@ typedef struct PGShmemHeader /* standard header for all Postgres shmem */ #ifdef EXEC_BACKEND extern unsigned long UsedShmemSegID; extern void *UsedShmemSegAddr; + +extern void PGSharedMemoryReAttach(void); #endif extern PGShmemHeader *PGSharedMemoryCreate(uint32 size, bool makePrivate, |