aboutsummaryrefslogtreecommitdiff
path: root/src/backend/bootstrap/bootstrap.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-09-29 04:02:27 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-09-29 04:02:27 +0000
commit499abb0c0f21cb861c5af1d49a06469f3cfcc1eb (patch)
tree0af6262d9b6d1159315e93e90e69047b959ea5f5 /src/backend/bootstrap/bootstrap.c
parent818fb55ac49b4b20e65d9899fc1784e54e86db58 (diff)
downloadpostgresql-499abb0c0f21cb861c5af1d49a06469f3cfcc1eb.tar.gz
postgresql-499abb0c0f21cb861c5af1d49a06469f3cfcc1eb.zip
Implement new 'lightweight lock manager' that's intermediate between
existing lock manager and spinlocks: it understands exclusive vs shared lock but has few other fancy features. Replace most uses of spinlocks with lightweight locks. All remaining uses of spinlocks have very short lock hold times (a few dozen instructions), so tweak spinlock backoff code to work efficiently given this assumption. All per my proposal on pghackers 26-Sep-01.
Diffstat (limited to 'src/backend/bootstrap/bootstrap.c')
-rw-r--r--src/backend/bootstrap/bootstrap.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 6a0a1306e21..76d4d0252d2 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
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.116 2001/09/27 16:29:12 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.117 2001/09/29 04:02:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,6 +33,7 @@
#include "catalog/pg_type.h"
#include "libpq/pqsignal.h"
#include "miscadmin.h"
+#include "storage/proc.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/exc.h"
@@ -360,29 +361,39 @@ BootstrapMain(int argc, char *argv[])
* XLOG operations
*/
SetProcessingMode(NormalProcessing);
- if (xlogop == BS_XLOG_NOP)
- StartupXLOG();
- else if (xlogop == BS_XLOG_BOOTSTRAP)
- {
- BootStrapXLOG();
- StartupXLOG();
- }
- else
+
+ switch (xlogop)
{
- if (xlogop == BS_XLOG_CHECKPOINT)
- {
+ case BS_XLOG_NOP:
+ StartupXLOG();
+ break;
+
+ case BS_XLOG_BOOTSTRAP:
+ BootStrapXLOG();
+ StartupXLOG();
+ break;
+
+ case BS_XLOG_CHECKPOINT:
+ if (IsUnderPostmaster)
+ InitDummyProcess(); /* needed to get LWLocks */
CreateDummyCaches();
CreateCheckPoint(false);
SetRedoRecPtr();
- }
- else if (xlogop == BS_XLOG_STARTUP)
+ proc_exit(0); /* done */
+
+ case BS_XLOG_STARTUP:
StartupXLOG();
- else if (xlogop == BS_XLOG_SHUTDOWN)
+ proc_exit(0); /* done */
+
+ case BS_XLOG_SHUTDOWN:
ShutdownXLOG();
- else
+ proc_exit(0); /* done */
+
+ default:
elog(STOP, "Unsupported XLOG op %d", xlogop);
- proc_exit(0);
+ proc_exit(0);
}
+
SetProcessingMode(BootstrapProcessing);
/*