diff options
author | Andres Freund <andres@anarazel.de> | 2014-10-21 01:01:56 +0200 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2014-10-21 01:01:56 +0200 |
commit | 5e5b65f359b7a12c05708585a8e6cd4d80ca2652 (patch) | |
tree | 53fafe4aa1768e4386b6c316ca82a0707a0beaee /src/backend/access/transam/xlog.c | |
parent | 11abd6c90f1094eaeee32e1c57d250c9db5102cb (diff) | |
download | postgresql-5e5b65f359b7a12c05708585a8e6cd4d80ca2652.tar.gz postgresql-5e5b65f359b7a12c05708585a8e6cd4d80ca2652.zip |
Don't duplicate log_checkpoint messages for both of restart and checkpoints.
The duplication originated in cdd46c765, where restartpoints were
introduced.
In LogCheckpointStart's case the duplication actually lead to the
compiler's format string checking not to be effective because the
format string wasn't constant.
Arguably these messages shouldn't be elog(), but ereport() style
messages. That'd even allow to translate the messages... But as
there's more mistakes of that kind in surrounding code, it seems
better to change that separately.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 62 |
1 files changed, 18 insertions, 44 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index a5b26d880b2..e77af22aebc 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7764,18 +7764,8 @@ ShutdownXLOG(int code, Datum arg) static void LogCheckpointStart(int flags, bool restartpoint) { - const char *msg; - - /* - * XXX: This is hopelessly untranslatable. We could call gettext_noop for - * the main message, but what about all the flags? - */ - if (restartpoint) - msg = "restartpoint starting:%s%s%s%s%s%s%s%s"; - else - msg = "checkpoint starting:%s%s%s%s%s%s%s%s"; - - elog(LOG, msg, + elog(LOG, "%s starting:%s%s%s%s%s%s%s%s", + restartpoint ? "restartpoint" : "checkpoint", (flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "", (flags & CHECKPOINT_END_OF_RECOVERY) ? " end-of-recovery" : "", (flags & CHECKPOINT_IMMEDIATE) ? " immediate" : "", @@ -7847,38 +7837,22 @@ LogCheckpointEnd(bool restartpoint) average_secs = (long) (average_sync_time / 1000000); average_usecs = average_sync_time - (uint64) average_secs *1000000; - 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, - CheckpointStats.ckpt_sync_rels, - longest_secs, longest_usecs / 1000, - average_secs, average_usecs / 1000); - else - elog(LOG, "checkpoint 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, - CheckpointStats.ckpt_sync_rels, - longest_secs, longest_usecs / 1000, - average_secs, average_usecs / 1000); + elog(LOG, "%s 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", + restartpoint ? "restartpoint" : "checkpoint", + 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, + CheckpointStats.ckpt_sync_rels, + longest_secs, longest_usecs / 1000, + average_secs, average_usecs / 1000); } /* |