summaryrefslogtreecommitdiff
path: root/src/backend/bootstrap
diff options
context:
space:
mode:
authorTom Lane2010-04-20 01:38:52 +0000
committerTom Lane2010-04-20 01:38:52 +0000
commitc670410e7fe59dffb0227ed1dd0f532013993859 (patch)
treec647059112427738891c97e5e7ac0c53cce94782 /src/backend/bootstrap
parentee7769bb7649e0f990179f9ed56e60c031542077 (diff)
Move the responsibility for calling StartupXLOG into InitPostgres, for
those process types that go through InitPostgres; in particular, bootstrap and standalone-backend cases. This ensures that we have set up a PGPROC and done some other basic initialization steps (corresponding to the if (IsUnderPostmaster) block in AuxiliaryProcessMain) before we attempt to run WAL recovery in a standalone backend. As was discovered last September, this is necessary for some corner-case code paths during WAL recovery, particularly end-of-WAL cleanup. Moving the bootstrap case here too is not necessary for correctness, but it seems like a good idea since it reduces the number of distinct code paths.
Diffstat (limited to 'src/backend/bootstrap')
-rw-r--r--src/backend/bootstrap/bootstrap.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index a9c5d1fd53b..080d80e296b 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.260 2010/02/26 02:00:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.261 2010/04/20 01:38:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -397,14 +397,13 @@ AuxiliaryProcessMain(int argc, char *argv[])
switch (auxType)
{
case CheckerProcess:
- bootstrap_signals();
+ /* don't set signals, they're useless here */
CheckerModeMain();
proc_exit(1); /* should never return */
case BootstrapProcess:
bootstrap_signals();
BootStrapXLOG();
- StartupXLOG();
BootstrapModeMain();
proc_exit(1); /* should never return */
@@ -438,23 +437,12 @@ AuxiliaryProcessMain(int argc, char *argv[])
/*
* In shared memory checker mode, all we really want to do is create shared
* memory and semaphores (just to prove we can do it with the current GUC
- * settings).
+ * settings). Since, in fact, that was already done by BaseInit(),
+ * we have nothing more to do here.
*/
static void
CheckerModeMain(void)
{
- /*
- * We must be getting invoked for bootstrap mode
- */
- Assert(!IsUnderPostmaster);
-
- SetProcessingMode(BootstrapProcessing);
-
- /*
- * Do backend-like initialization for bootstrap mode
- */
- InitProcess();
- InitPostgres(NULL, InvalidOid, NULL, NULL);
proc_exit(0);
}
@@ -478,6 +466,7 @@ BootstrapModeMain(void)
* Do backend-like initialization for bootstrap mode
*/
InitProcess();
+
InitPostgres(NULL, InvalidOid, NULL, NULL);
/* Initialize stuff for bootstrap-file processing */
@@ -498,10 +487,6 @@ BootstrapModeMain(void)
*/
RelationMapFinishBootstrap();
- /* Perform a checkpoint to ensure everything's down to disk */
- SetProcessingMode(NormalProcessing);
- CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
-
/* Clean up and exit */
cleanup();
proc_exit(0);