aboutsummaryrefslogtreecommitdiff
path: root/src/backend/bootstrap/bootstrap.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-01-04 21:06:32 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-01-04 21:06:32 +0000
commit349f40b2c264cbbfe4c5c7ba783bce58483cefae (patch)
tree426223e3fff88cd5f3c5e30bbdc1ad5ed64e59d5 /src/backend/bootstrap/bootstrap.c
parente0078ea22ddb229e9050d17f8e3fa847f66f6768 (diff)
downloadpostgresql-349f40b2c264cbbfe4c5c7ba783bce58483cefae.tar.gz
postgresql-349f40b2c264cbbfe4c5c7ba783bce58483cefae.zip
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.
Diffstat (limited to 'src/backend/bootstrap/bootstrap.c')
-rw-r--r--src/backend/bootstrap/bootstrap.c33
1 files changed, 18 insertions, 15 deletions
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);
/*