mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Code review for EXEC_BACKEND changes. Reduce the number of #ifdefs by
about a third, make it work on non-Windows platforms again. (But perhaps I broke the WIN32 code, since I have no way to test that.) Fold all the paths that fork postmaster child processes to go through the single routine SubPostmasterMain, which takes care of resurrecting the state that would normally be inherited from the postmaster (including GUC variables). Clean up some places where there's no particularly good reason for the EXEC and non-EXEC cases to work differently. Take care of one or two FIXMEs that remained in the code.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.13 2004/02/23 23:03:10 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.14 2004/05/28 05:12:42 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -164,10 +164,9 @@ static bool SlruScanDirectory(SlruCtl ctl, int cutoffPage, bool doDeletions);
|
||||
int
|
||||
SimpleLruShmemSize(void)
|
||||
{
|
||||
return MAXALIGN(sizeof(SlruSharedData)) + BLCKSZ * NUM_CLOG_BUFFERS
|
||||
#ifdef EXEC_BACKEND
|
||||
return MAXALIGN(sizeof(SlruSharedData))
|
||||
+ BLCKSZ * NUM_CLOG_BUFFERS
|
||||
+ MAXALIGN(sizeof(SlruLockData))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
@@ -181,21 +180,8 @@ SimpleLruInit(SlruCtl ctl, const char *name, const char *subdir)
|
||||
|
||||
ptr = ShmemInitStruct(name, SimpleLruShmemSize(), &found);
|
||||
shared = (SlruShared) ptr;
|
||||
|
||||
#ifdef EXEC_BACKEND
|
||||
/*
|
||||
* Locks are in shared memory
|
||||
*/
|
||||
locks = (SlruLock) (ptr + MAXALIGN(sizeof(SlruSharedData)) +
|
||||
BLCKSZ * NUM_CLOG_BUFFERS);
|
||||
#else
|
||||
/*
|
||||
* Locks are in private memory
|
||||
*/
|
||||
Assert(!IsUnderPostmaster);
|
||||
locks = malloc(sizeof(SlruLockData));
|
||||
Assert(locks);
|
||||
#endif
|
||||
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
@@ -225,6 +211,7 @@ SimpleLruInit(SlruCtl ctl, const char *name, const char *subdir)
|
||||
else
|
||||
Assert(found);
|
||||
|
||||
/* Initialize the unshared control struct */
|
||||
ctl->locks = locks;
|
||||
ctl->shared = shared;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user