]> granicus.if.org Git - postgresql/commitdiff
Prevent intermittent hang in recovery from bgwriter interaction.
authorSimon Riggs <simon@2ndQuadrant.com>
Wed, 23 Mar 2011 13:32:37 +0000 (13:32 +0000)
committerSimon Riggs <simon@2ndQuadrant.com>
Wed, 23 Mar 2011 13:32:37 +0000 (13:32 +0000)
Startup process waited for cleanup lock but when hot_standby = off
the pid was not registered, so that the bgwriter would not wake
the waiting process as intended.

src/backend/access/transam/xlog.c
src/backend/storage/ipc/standby.c

index bb06a2e016df58b8338424921d8e57b7f73908b0..4e4ec1cb9a82d2496daf7eb8eb96b010fe6a6d3b 100644 (file)
@@ -47,6 +47,7 @@
 #include "storage/fd.h"
 #include "storage/ipc.h"
 #include "storage/pmsignal.h"
+#include "storage/proc.h"
 #include "storage/procarray.h"
 #include "storage/smgr.h"
 #include "storage/spin.h"
@@ -6135,6 +6136,7 @@ StartupXLOG(void)
                 */
                if (InArchiveRecovery && IsUnderPostmaster)
                {
+                       PublishStartupProcessInformation();
                        SetForwardFsyncRequests();
                        SendPostmasterSignal(PMSIGNAL_RECOVERY_STARTED);
                        bgwriterLaunched = true;
index 8ddfa60b388ae8ee6592cb854138896545034f0e..ce02fe76049beea508f95893a8c455b5bfcdd0a0 100644 (file)
@@ -69,11 +69,6 @@ InitRecoveryTransactionEnvironment(void)
         */
        SharedInvalBackendInit(true);
 
-       /*
-        * Record the PID and PGPROC structure of the startup process.
-        */
-       PublishStartupProcessInformation();
-
        /*
         * Lock a virtual transaction id for Startup process.
         *