From: Simon Riggs Date: Fri, 2 Oct 2009 07:33:44 +0000 (+0100) Subject: Add in extra GetRunningTransactionData after shutdown checkpoint. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=f8d333d548832b603272035634b32600346fbfa9;p=users%2Fsimon%2Fpostgres.git Add in extra GetRunningTransactionData after shutdown checkpoint. --- diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index a8b2565897..de682f1b57 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -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();