Refactor EXEC_BACKEND code so that postmaster child processes reattach
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/port/sysv_shmem.c | modified | +45 −30 |
| src/backend/postmaster/postmaster.c | modified | +36 −24 |
| src/backend/storage/file/fd.c | modified | +72 −47 |
| src/backend/storage/ipc/ipci.c | modified | +17 −13 |
| src/include/postmaster/postmaster.h | modified | +4 −1 |
| src/include/storage/ipc.h | modified | +1 −7 |
| src/include/storage/pg_shmem.h | modified | +3 −1 |