public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bharath Rupireddy <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Emit "checkpoint skipped because system is idle" message at LOG level if log_checkpoints is set
Date: Wed, 5 Jan 2022 10:24:25 +0530
Message-ID: <CALj2ACX9LPadCNACDZ3JykDT-6sfPrPchXTLyNHP3cbwyJYjsg@mail.gmail.com> (raw)

Hi,

Postgres server emits a message at DEBUG1 level when it skips a
checkpoint. At times, developers might be surprised after figuring out
from server logs that there were no checkpoints happening at all
during a certain period of time when DEBUG1 messages aren't captured.
How about emitting the message at LOG level if log_checkpoints is set?
Patch attached.

Thoughts?

Regards,
Bharath Rupireddy.


Attachments:

  [application/octet-stream] v1-0001-Emit-checkpoint-skipped-message-at-LOG-level.patch (902B, ../CALj2ACX9LPadCNACDZ3JykDT-6sfPrPchXTLyNHP3cbwyJYjsg@mail.gmail.com/2-v1-0001-Emit-checkpoint-skipped-message-at-LOG-level.patch)
  download | inline diff:
From 2e560a0bc89285814a75c06d67dd74b57b1a1d94 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <[email protected]>
Date: Wed, 5 Jan 2022 04:52:45 +0000
Subject: [PATCH v1] Emit checkpoint skipped message at LOG level

Emit "checkpoint skipped because system is idle" message at LOG
level if log_checkpoints is set.
---
 src/backend/access/transam/xlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 87cd05c945..fcd4b7b801 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -9159,7 +9159,7 @@ CreateCheckPoint(int flags)
 		{
 			WALInsertLockRelease();
 			END_CRIT_SECTION();
-			ereport(DEBUG1,
+			ereport((log_checkpoints ? LOG : DEBUG1),
 					(errmsg_internal("checkpoint skipped because system is idle")));
 			return;
 		}
-- 
2.25.1



view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Emit "checkpoint skipped because system is idle" message at LOG level if log_checkpoints is set
  In-Reply-To: <CALj2ACX9LPadCNACDZ3JykDT-6sfPrPchXTLyNHP3cbwyJYjsg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox