]> granicus.if.org Git - postgresql/commitdiff
Prevent intermittent hang in recovery from bgwriter interaction.
authorSimon Riggs <simon@2ndQuadrant.com>
Wed, 23 Mar 2011 13:30:05 +0000 (13:30 +0000)
committerSimon Riggs <simon@2ndQuadrant.com>
Wed, 23 Mar 2011 13:30:05 +0000 (13:30 +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 306ac058c365c15fd32deed7677aefe668bb6028..5a585f60d0bdb919513629f424cbcd78cc97d6c4 100644 (file)
@@ -49,6 +49,7 @@
 #include "storage/latch.h"
 #include "storage/pmsignal.h"
 #include "storage/predicate.h"
+#include "storage/proc.h"
 #include "storage/procarray.h"
 #include "storage/reinit.h"
 #include "storage/smgr.h"
@@ -6406,6 +6407,7 @@ StartupXLOG(void)
                 */
                if (InArchiveRecovery && IsUnderPostmaster)
                {
+                       PublishStartupProcessInformation();
                        SetForwardFsyncRequests();
                        SendPostmasterSignal(PMSIGNAL_RECOVERY_STARTED);
                        bgwriterLaunched = true;
index a92ae4af590cdf06796c19553ac9d3ac0a8a6b27..2e71484126def7cbcf086c337a975936bd57982e 100644 (file)
@@ -68,11 +68,6 @@ InitRecoveryTransactionEnvironment(void)
         */
        SharedInvalBackendInit(true);
 
-       /*
-        * Record the PID and PGPROC structure of the startup process.
-        */
-       PublishStartupProcessInformation();
-
        /*
         * Lock a virtual transaction id for Startup process.
         *