pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: dkorzunov@symmetryinvestments.com
Subject: BUG #18417: Excessive log messages on warm standby server
Date: Fri, 29 Mar 2024 04:44:27 +0000
Message-ID: <18417-174d6d30bfbedda3@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18417
Logged by:          Denis Korzunov
Email address:      dkorzunov@symmetryinvestments.com
PostgreSQL version: 16.2
Operating system:   Debian Bullseye
Description:        

I have log-shipping replication set up. The master server generates archive
files which are then sent to a remote location where replica server reads
them and applies changes.

The nature of the application is that writes occur in batches, large volumes
but infrequently, a few times per day. 
The warm standby server generates the following messages every
wal_retrieve_retry_interval, which is 5 seconds by default:

2024-03-29 04:30:25.436 UTC [35160] LOG:  waiting for WAL to become
available at 0/5000018
2024-03-29 04:30:30.441 UTC [35160] LOG:  waiting for WAL to become
available at 0/5000018
2024-03-29 04:30:35.443 UTC [35160] LOG:  waiting for WAL to become
available at 0/5000018
2024-03-29 04:30:40.448 UTC [35160] LOG:  waiting for WAL to become
available at 0/5000018
2024-03-29 04:30:45.449 UTC [35160] LOG:  waiting for WAL to become
available at 0/5000018

There were no such messages in PostgreSQL 14.  From what I can tell, it
first appeared in PostgresQL 15 and continued in 16.

I did a bit of digging in the source code and in PostgreSQL 14 the
WaitForWALToBecomeAvailable (xlog.c) function[1] didn't have the code to log
such message, however starting from PostgresSQL 15 the function has been
moved to xlogrecovery.c[2] and contains the statement:

elog(LOG, "waiting for WAL to become available at %X/%X",
							 LSN_FORMAT_ARGS(RecPtr));

The problem is that the log level here is set to LOG and to turn the message
off I have to set log_min_messages to "fatal" which cuts off many useful
messages I'd prefer to keep in the log file.

The relevant configuration parameters are:

log_min_messages = info
archive_mode = on
archive_command = 'test ! -f /archive/%f && zstd --quiet %p -o
/archive/tmp/%f && mv /archive/tmp/%f /archive/%f'
archive_timeout = 30
restore_command = 'test -f /archive/%f && zstd --quiet --decompress
/archive/%f -o /archive/tmp/%f && mv /archive/tmp/%f %p'

Links to source code:
[1]
https://github.com/postgres/postgres/blob/REL_14_STABLE/src/backend/access/transam/xlog.c#L12761
[2]
https://github.com/postgres/postgres/blob/master/src/backend/access/transam/xlogrecovery.c#L3690



Message-ID: <18417-174d6d30bfbedda3@postgresql.org>
Permalink:  ../18417-174d6d30bfbedda3@postgresql.org/
Also on:    postgresql.org/message-id/18417-174d6d30bfbedda3@postgresql.org

 · 

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: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, dkorzunov@symmetryinvestments.com
  Subject: Re: BUG #18417: Excessive log messages on warm standby server
  In-Reply-To: <18417-174d6d30bfbedda3@postgresql.org>

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

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