mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Rearrange backend startup sequence so that ShmemIndexLock can become
an LWLock instead of a spinlock. This hardly matters on Unix machines but should improve startup performance on Windows (or any port using EXEC_BACKEND). Per previous discussion.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.209 2005/11/22 18:17:07 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.210 2006/01/04 21:06:30 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -381,22 +381,19 @@ BootstrapMain(int argc, char *argv[])
|
||||
BaseInit();
|
||||
|
||||
/*
|
||||
* We aren't going to do the full InitPostgres pushups, but there are a
|
||||
* couple of things that need to get lit up even in a dummy process.
|
||||
* When we are a dummy process, we aren't going to do the full
|
||||
* InitPostgres pushups, but there are a couple of things that need
|
||||
* to get lit up even in a dummy process.
|
||||
*/
|
||||
if (IsUnderPostmaster)
|
||||
{
|
||||
/* set up proc.c to get use of LWLocks */
|
||||
switch (xlogop)
|
||||
{
|
||||
case BS_XLOG_BGWRITER:
|
||||
InitDummyProcess(DUMMY_PROC_BGWRITER);
|
||||
break;
|
||||
|
||||
default:
|
||||
InitDummyProcess(DUMMY_PROC_DEFAULT);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Create a PGPROC so we can use LWLocks. In the EXEC_BACKEND case,
|
||||
* this was already done by SubPostmasterMain().
|
||||
*/
|
||||
#ifndef EXEC_BACKEND
|
||||
InitDummyProcess();
|
||||
#endif
|
||||
|
||||
/* finish setting up bufmgr.c */
|
||||
InitBufferPoolBackend();
|
||||
@ -437,11 +434,17 @@ BootstrapMain(int argc, char *argv[])
|
||||
proc_exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* We must be getting invoked for bootstrap mode
|
||||
*/
|
||||
Assert(!IsUnderPostmaster);
|
||||
|
||||
SetProcessingMode(BootstrapProcessing);
|
||||
|
||||
/*
|
||||
* backend initialization
|
||||
* Do backend-like initialization for bootstrap mode
|
||||
*/
|
||||
InitProcess();
|
||||
(void) InitPostgres(dbname, NULL);
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user