Add in extra GetRunningTransactionData after shutdown checkpoint.
authorSimon Riggs <[email protected]>
Fri, 2 Oct 2009 07:33:44 +0000 (08:33 +0100)
committerSimon Riggs <[email protected]>
Fri, 2 Oct 2009 07:33:44 +0000 (08:33 +0100)
src/backend/access/transam/xlog.c

index a8b2565897cc887273bf8739b9dfe5fcf11cb7c0..de682f1b57fb97aaaeb667e639adb4c255b54610 100644 (file)
@@ -7063,11 +7063,10 @@ ShutdownXLOG(int code, Datum arg)
                /*
                 * Take a snapshot of running transactions and write this to WAL.
                 * This allows us to reconstruct the state of running transactions
-                * during archive recovery, if required. We do this even if we are
-                * not archiving, to allow a cold physical backup of the server to
-                * be useful as a read only standby.
+                * during archive recovery, if required.
                 */
-               GetRunningTransactionData();
+               if (XLogArchivingActive() && XLogArchiveCommandSet())
+                       GetRunningTransactionData();
 
                /*
                 * If archiving is enabled, rotate the last XLOG file so that all the
@@ -7079,6 +7078,15 @@ ShutdownXLOG(int code, Datum arg)
                        RequestXLogSwitch();
 
                CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
+
+               /*
+                * Take a snapshot of running transactions and write this to WAL.
+                * This allows us to reconstruct the state of running transactions
+                * during archive recovery, if required. We do this even if we are
+                * not archiving, to allow a cold physical backup of the server to
+                * be useful as a read only standby.
+                */
+               GetRunningTransactionData();
        }
        ShutdownCLOG();
        ShutdownSUBTRANS();