summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-02-23 04:48:38 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-02-23 04:48:38 +0000
commit1f3e24dee7e5dad3d6e34871ba78b7cb59a20771 (patch)
tree98ff51252d453a119de81e47f03d2a1a5cc25562 /src
parenta78e12f96aad5e89a44d9725c95bda0866a228f3 (diff)
If a shutdown request comes in while we're still starting up, don't
service it until after we execute SetThisStartUpID(). Else shutdown process will write the wrong SUI into the shutdown checkpoint, which seems likely to be trouble --- although I've not quite figured out how significant it really is.
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/postmaster.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index d8b36b37cbf..8f72ddc1ab1 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.290.2.2 2003/01/16 00:27:17 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.290.2.3 2003/02/23 04:48:38 tgl Exp $
*
* NOTES
*
@@ -1621,7 +1621,26 @@ reaper(SIGNAL_ARGS)
ExitPostmaster(1);
}
StartupPID = 0;
+
+ /*
+ * Startup succeeded - remember its ID and RedoRecPtr.
+ *
+ * NB: this MUST happen before we fork a checkpoint or shutdown
+ * subprocess, else they will have wrong local ThisStartUpId.
+ */
+ SetThisStartUpID();
+
FatalError = false; /* done with recovery */
+
+ /*
+ * Arrange for first checkpoint to occur after standard delay.
+ */
+ CheckPointPID = 0;
+ checkpointed = time(NULL);
+
+ /*
+ * Go to shutdown mode if a shutdown request was pending.
+ */
if (Shutdown > NoShutdown)
{
if (ShutdownPID > 0)
@@ -1633,17 +1652,6 @@ reaper(SIGNAL_ARGS)
ShutdownPID = ShutdownDataBase();
}
- /*
- * Startup succeeded - remember its ID and RedoRecPtr
- */
- SetThisStartUpID();
-
- /*
- * Arrange for first checkpoint to occur after standard delay.
- */
- CheckPointPID = 0;
- checkpointed = time(NULL);
-
goto reaper_done;
}