Subject: Re: Is it possible to change wal_level online

From: Andres Freund <[email-masked]>
Date: Thu, 14 Sep 2023 18:28:56 -0700

Hi, 

On September 14, 2023 6:21:59 AM PDT, Euler Taveira <[email-masked]> wrote:
>On Thu, Sep 14, 2023, at 7:05 AM, Andy Fan wrote:
>> Currently it is complained that wal_level changes require an instance
>> restart,  I'm not familiar with this stuff so far and I didn't get any good
>> information from searching the email archive.  So I want to gather 
>> some feedbacks from experts to  see if it is possible and if not, why
>> it would be the key blocker for this.  Basically I agree that changing 
>> the wal_level  online will be a good experience for users. 
>> 
>
>This topic was already discussed. See this thread [1] that was requesting to
>change the wal_level default value. There might be other threads but I didn't
>try hard to find them.
>
>
>[1] https://www.postgresql.org/message-id/20200608213215.mgk3cctlzvfuaqm6%40alap3.anarazel.de

I think it's gotten a bit easier since then, because we now have global barriers, to implement the waiting that's mentioned in the email.

Possibly we should do the switch to logical dynamically, without a dedicated wal_level. Whenever a logical slot exists, automatically increase the Wal level, whenever the last slot is dropped, lower it again. Plus some waiting to ensure every backend has knows about the new value. 

Regards,

Andres 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.