mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
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.
This commit is contained in:
parent
11abd6c90f
commit
5e5b65f359
@ -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,27 +7837,11 @@ 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%%); "
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user