Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5e5b65f

Browse files
committed
Don't duplicate log_checkpoint messages for both of restart and checkpoints.
The duplication originated in cdd46c7, 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.
1 parent 11abd6c commit 5e5b65f

File tree

1 file changed

+18
-44
lines changed
  • src/backend/access/transam

1 file changed

+18
-44
lines changed

src/backend/access/transam/xlog.c

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7764,18 +7764,8 @@ ShutdownXLOG(int code, Datum arg)
77647764
static void
77657765
LogCheckpointStart(int flags, bool restartpoint)
77667766
{
7767-
const char *msg;
7768-
7769-
/*
7770-
* XXX: This is hopelessly untranslatable. We could call gettext_noop for
7771-
* the main message, but what about all the flags?
7772-
*/
7773-
if (restartpoint)
7774-
msg = "restartpoint starting:%s%s%s%s%s%s%s%s";
7775-
else
7776-
msg = "checkpoint starting:%s%s%s%s%s%s%s%s";
7777-
7778-
elog(LOG, msg,
7767+
elog(LOG, "%s starting:%s%s%s%s%s%s%s%s",
7768+
restartpoint ? "restartpoint" : "checkpoint",
77797769
(flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "",
77807770
(flags & CHECKPOINT_END_OF_RECOVERY) ? " end-of-recovery" : "",
77817771
(flags & CHECKPOINT_IMMEDIATE) ? " immediate" : "",
@@ -7847,38 +7837,22 @@ LogCheckpointEnd(bool restartpoint)
78477837
average_secs = (long) (average_sync_time / 1000000);
78487838
average_usecs = average_sync_time - (uint64) average_secs *1000000;
78497839

7850-
if (restartpoint)
7851-
elog(LOG, "restartpoint complete: wrote %d buffers (%.1f%%); "
7852-
"%d transaction log file(s) added, %d removed, %d recycled; "
7853-
"write=%ld.%03d s, sync=%ld.%03d s, total=%ld.%03d s; "
7854-
"sync files=%d, longest=%ld.%03d s, average=%ld.%03d s",
7855-
CheckpointStats.ckpt_bufs_written,
7856-
(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
7857-
CheckpointStats.ckpt_segs_added,
7858-
CheckpointStats.ckpt_segs_removed,
7859-
CheckpointStats.ckpt_segs_recycled,
7860-
write_secs, write_usecs / 1000,
7861-
sync_secs, sync_usecs / 1000,
7862-
total_secs, total_usecs / 1000,
7863-
CheckpointStats.ckpt_sync_rels,
7864-
longest_secs, longest_usecs / 1000,
7865-
average_secs, average_usecs / 1000);
7866-
else
7867-
elog(LOG, "checkpoint complete: wrote %d buffers (%.1f%%); "
7868-
"%d transaction log file(s) added, %d removed, %d recycled; "
7869-
"write=%ld.%03d s, sync=%ld.%03d s, total=%ld.%03d s; "
7870-
"sync files=%d, longest=%ld.%03d s, average=%ld.%03d s",
7871-
CheckpointStats.ckpt_bufs_written,
7872-
(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
7873-
CheckpointStats.ckpt_segs_added,
7874-
CheckpointStats.ckpt_segs_removed,
7875-
CheckpointStats.ckpt_segs_recycled,
7876-
write_secs, write_usecs / 1000,
7877-
sync_secs, sync_usecs / 1000,
7878-
total_secs, total_usecs / 1000,
7879-
CheckpointStats.ckpt_sync_rels,
7880-
longest_secs, longest_usecs / 1000,
7881-
average_secs, average_usecs / 1000);
7840+
elog(LOG, "%s complete: wrote %d buffers (%.1f%%); "
7841+
"%d transaction log file(s) added, %d removed, %d recycled; "
7842+
"write=%ld.%03d s, sync=%ld.%03d s, total=%ld.%03d s; "
7843+
"sync files=%d, longest=%ld.%03d s, average=%ld.%03d s",
7844+
restartpoint ? "restartpoint" : "checkpoint",
7845+
CheckpointStats.ckpt_bufs_written,
7846+
(double) CheckpointStats.ckpt_bufs_written * 100 / NBuffers,
7847+
CheckpointStats.ckpt_segs_added,
7848+
CheckpointStats.ckpt_segs_removed,
7849+
CheckpointStats.ckpt_segs_recycled,
7850+
write_secs, write_usecs / 1000,
7851+
sync_secs, sync_usecs / 1000,
7852+
total_secs, total_usecs / 1000,
7853+
CheckpointStats.ckpt_sync_rels,
7854+
longest_secs, longest_usecs / 1000,
7855+
average_secs, average_usecs / 1000);
78827856
}
78837857

78847858
/*

0 commit comments

Comments
 (0)