From: Simon Riggs Date: Fri, 2 Oct 2009 13:07:49 +0000 (+0100) Subject: Revert all recent changes about shutdown checkpoints and GetRunningTransactionData... X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=22044874a1d6ea2d1c6d91f452662b3e0f5180fc;p=users%2Fsimon%2Fpostgres.git Revert all recent changes about shutdown checkpoints and GetRunningTransactionData() and put item back on todo list, for now. --- diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cdb43e254b..5dac9c7683 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7338,26 +7338,6 @@ CreateCheckPoint(int flags) */ LWLockRelease(WALInsertLock); - /* - * 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. - */ - if (shutdown || (XLogArchivingActive() && XLogArchiveCommandSet())) - { - /* - * GetRunningTransactionData() inserts WAL records while holding - * ProcArrayLock. Make sure we flush WAL first so we reduce the - * chance of needing to flush WAL during XLogInsert(), which might - * mean we hold ProcArrayLock across an I/O, which could be bad. - */ - if (!shutdown) - XLogBackgroundFlush(); - GetRunningTransactionData(); - } - /* * If enabled, log checkpoint start. We postpone this until now so as not * to log anything if we decided to skip the checkpoint. @@ -7556,6 +7536,24 @@ CreateCheckPoint(int flags) CheckpointStats.ckpt_segs_recycled); LWLockRelease(CheckpointLock); + + /* + * 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. + */ + if (!IsBootstrapProcessingMode() && + XLogArchivingActive() && XLogArchiveCommandSet()) + { + /* + * GetRunningTransactionData() inserts WAL records while holding + * ProcArrayLock. Make sure we flush WAL first so we reduce the + * chance of needing to flush WAL during XLogInsert(), which might + * mean we hold ProcArrayLock across an I/O, which could be bad. + */ + XLogBackgroundFlush(); + GetRunningTransactionData(); + } } /*