Re: Unexpected Standby Shutdown on sync_replication_slots change

From: Hugo DUBOIS <hdubois(at)scaleway(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Unexpected Standby Shutdown on sync_replication_slots change
Date: 2025-07-25 12:13:22
Message-ID: CAH0PTU-rGtqOkKJ6sV0OuzkpgZGL5UQiDR2MArHmktr5HdRC1A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Le ven. 25 juil. 2025 à 12:32, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> a écrit :

> On Fri, Jul 25, 2025 at 6:40 PM Hugo DUBOIS <hdubois(at)scaleway(dot)com> wrote:
> >
> > Thanks for the quick patch. I've tested it on the REL_17_STABLE branch,
> and it's working fine.
> >
> > On a standby node, after dynamically setting the sync_replication_slots
> parameter, I observed the following logs. The instance did not shut down,
> which seems correct:
> >
> > 2025-07-25 09:26:34.613 UTC [4420] LOG: received SIGHUP, reloading
> configuration files
> > 2025-07-25 09:26:34.614 UTC [4420] LOG: parameter
> "sync_replication_slots" changed to "on"
> > 2025-07-25 09:26:34.615 UTC [4420] LOG: replication slot
> synchronization requires "wal_level" >= "logical"
> > 2025-07-25 09:27:34.662 UTC [4420] LOG: replication slot
> synchronization requires "wal_level" >= "logical"
> >
> > The instance did not restart as expected, showing this fatal log:
> >
> > 2025-07-25 09:27:45.668 UTC [4430] FATAL: replication slot
> synchronization ("sync_replication_slots" = on) requires "wal_level" >=
> "logical"
>
> Thanks for testing!
>
>
> > I have a couple of observations:
> >
> > With this patch, a primary instance will not restart if the
> configuration is incorrect.
>
> Right. In HEAD, the server shuts down due to the misconfiguration only when
> starting up as a standby and entering hot standby mode. With this patch,
> the server shuts down earlier—during startup—even when starting as a
> primary.
> If starting as a standby, the shutdown now happens before entering hot
> standby.
>
> It seems hard to match the current behavior exactly in the patch, and I’m
> not
> sure it’s worth trying. I think we have two options:
>
> #1. Make the server always shut down on misconfiguration, regardless of
> whether it starts as a primary or standby, and before reaching hot
> standby.
>
> #2. Allow the server to start even if the configuration is invalid.
>
> The current patch follows option #1. But if there are valid use cases for
> starting a primary with sync_replication_slots enabled and wal_level not
> set
> to logical, then option #2 might be better. What do you think?

I'm not sure if there's a particular use case for wal_level and
sync_replication_slots not matching on a primary. So, for me, Option 1
seems correct.

>

> Only wal_level is checked, but the ValidateSlotSyncParams function
> includes other mandatory parameters. These are not being checked during
> startup.
>
> The other parameters checked by ValidateSlotSyncParams() can be changed
> without restarting the server, so users can fix them on the fly while
> the server is running with the misconfiguration. But wal_level requires
> a server restart, so it's important to catch that upfront.
>

Ok.

> Regards,
>
> --
> Fujii Masao
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-07-25 13:28:19 Re: BUG #18999: Equivalent queries processing WHERE IS NULL & WHERE IS NOT NULL produce mutually exclusive results
Previous Message Fujii Masao 2025-07-25 10:32:25 Re: Unexpected Standby Shutdown on sync_replication_slots change