aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-02-02 21:08:53 -0500
committerRobert Haas <rhaas@postgresql.org>2011-02-02 21:08:53 -0500
commit0af695fd43b6889613a4035e3cdfcc0fc1b7936a (patch)
tree634992f6a66dc788021a772e4aecb6b5c9e60797 /src/backend/access/transam/xlog.c
parentcd7d748d51df3c5dedcc49a3603e6fa9c050f237 (diff)
downloadpostgresql-0af695fd43b6889613a4035e3cdfcc0fc1b7936a.tar.gz
postgresql-0af695fd43b6889613a4035e3cdfcc0fc1b7936a.zip
Log restartpoints in the same fashion as checkpoints.
Prior to 9.0, restartpoints never created, deleted, or recycled WAL files, but now they can. This code makes log_checkpoints treat checkpoints and restartpoints symmetrically. It also adjusts up the documentation of the parameter to mention restartpoints. Fujii Masao. Docs by me, as suggested by Itagaki Takahiro.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 66cc0049c06..25c7e062343 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7058,10 +7058,14 @@ LogCheckpointEnd(bool restartpoint)
if (restartpoint)
elog(LOG, "restartpoint complete: wrote %d buffers (%.1f%%); "
+ "%d transaction log file(s) added, %d removed, %d recycled; "
"write=%ld.%03d s, sync=%ld.%03d s, total=%ld.%03d s; "
"sync files=%d, longest=%ld.%03d s, average=%ld.%03d s",
CheckpointStats.ckpt_bufs_written,
(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
+ CheckpointStats.ckpt_segs_added,
+ CheckpointStats.ckpt_segs_removed,
+ CheckpointStats.ckpt_segs_recycled,
write_secs, write_usecs / 1000,
sync_secs, sync_usecs / 1000,
total_secs, total_usecs / 1000,
@@ -7688,16 +7692,18 @@ CreateRestartPoint(int flags)
SpinLockRelease(&xlogctl->info_lck);
LWLockRelease(WALInsertLock);
- if (log_checkpoints)
- {
- /*
- * Prepare to accumulate statistics.
- */
- MemSet(&CheckpointStats, 0, sizeof(CheckpointStats));
- CheckpointStats.ckpt_start_t = GetCurrentTimestamp();
+ /*
+ * Prepare to accumulate statistics.
+ *
+ * Note: because it is possible for log_checkpoints to change while a
+ * checkpoint proceeds, we always accumulate stats, even if
+ * log_checkpoints is currently off.
+ */
+ MemSet(&CheckpointStats, 0, sizeof(CheckpointStats));
+ CheckpointStats.ckpt_start_t = GetCurrentTimestamp();
+ if (log_checkpoints)
LogCheckpointStart(flags, true);
- }
CheckPointGuts(lastCheckPoint.redo, flags);