Re: Log a warning in pg_createsubscriber for max_slot_wal_keep_size

From: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Log a warning in pg_createsubscriber for max_slot_wal_keep_size
Date: 2025-01-14 07:05:06
Message-ID: CAHv8RjLbogzTsOq_u9HUVQg4UsqhVBgJBCueADTtruumw_b-Ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 14, 2025 at 10:10 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Shubham,
>
> In a previous review [1, comment #3] I was complaining about the lack
> of output emitted by the pg_log_debug() because I wanted to see some
> LOG evidence of the bad value of max_slot_wal_keep_size.
>
> FYI, I think that mystery has finally been solved.
>
> AFAIK 2 separate problems were contributing to the lack of debug output.
>
> 1. Unlike the 'command_ok' subroutine, the 'command_checks_all'
> subroutine apparently redirects the output before doing the requested
> pattern matching on it. So there is no output to be seen.
>
> 2. After that, I did not realise the effect of '-verbose' is
> cumulative on loglevel. Specifically, to see debug messages it is not
> enough to just say '--verbose'. In fact, you need to specify it 2
> times: '--verbose', '--verbose'
>
> ~
>
> After addressing these (e.g. by executing the same pg_createsubscriber
> using 'command_ok' and using a double '--verbose'), the expected LOGS
> can be seen.
>
> e.g. in the file tmp_check/log/regress_log_040_pg_createsubscriber
> ----------
> ...
> pg_createsubscriber: checking settings on publisher
> pg_createsubscriber: publisher: wal_level: logical
> pg_createsubscriber: publisher: max_replication_slots: 10
> pg_createsubscriber: publisher: current replication slots: 2
> pg_createsubscriber: publisher: max_wal_senders: 10
> pg_createsubscriber: publisher: current wal senders: 1
> pg_createsubscriber: publisher: max_prepared_transactions: 0
> pg_createsubscriber: publisher: max_slot_wal_keep_size: 10485760
> pg_createsubscriber: warning: publisher requires WAL size must not be restricted
> pg_createsubscriber: hint: Set the configuration parameter
> "max_slot_wal_keep_size" to -1 to ensure that required WAL files are
> not prematurely removed.
> pg_createsubscriber: stopping the subscriber
> ...
> ----------
>
> See the attached diff for the TAP changes I used to expose this
> logging. Apply this atop v8.
>
> ======
> [1] https://www.postgresql.org/message-id/CAHut%2BPszk61QM%2BcEvq_1-A2y%2BJrAD0USB%2BNvtcidajYOfHDkyw%40mail.gmail.com
>

I have used your diff to update the TAP tests accordingly. The v9
version Patch attached at [1] has the changes for the same.
[1] - https://www.postgresql.org/message-id/CAHv8RjL4MFEDosz9%2BTFmufYCDoNCnyN6PFeSxG6MwsH1ufhZLA%40mail.gmail.com

Thanks and regards,
Shubham Khanna.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahila Syed 2025-01-14 07:45:59 Prevent an error on attaching/creating a DSM/DSA from an interrupt handler.
Previous Message Peter Smith 2025-01-14 07:03:23 Re: pg_createsubscriber TAP test wrapping makes command options hard to read.