From 349f40b2c264cbbfe4c5c7ba783bce58483cefae Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 4 Jan 2006 21:06:32 +0000 Subject: 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. --- src/backend/bootstrap/bootstrap.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/backend/bootstrap/bootstrap.c') diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 283ca246473..66cf4c4ce0a 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -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); /* -- cgit v1.2.3