Re: Bump default wal_level to logical

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, David Fetter <david(at)fetter(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bump default wal_level to logical
Date: 2020-06-09 13:05:39
Message-ID: CAA4eK1+UJ3No0c7FSiq9ykH5b8GCsH9S-V-0yQiQ8QHQ=tLi5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 9, 2020 at 4:58 PM Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>
> On Tue, Jun 9, 2020 at 1:20 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> On Tue, Jun 9, 2020 at 2:31 PM Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>> >
>> > On Tue, Jun 9, 2020 at 10:53 AM Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote:
>> >>
>> >> At Tue, 9 Jun 2020 08:52:24 +0200, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote in
>> >> > On 2020-06-08 23:32, Andres Freund wrote:
>> >> > > On 2020-06-08 13:27:50 -0400, Tom Lane wrote:
>> >> > >> If we can allow wal_level to be changed on the fly, I agree that would
>> >> > >> help reduce the pressure to make the default setting more expensive.
>> >> > >> I don't recall why it's PGC_POSTMASTER right now, but I suppose there
>> >> > >> was a reason for that ...
>> >> > > There's reasons, but IIRC they're all solvable with reasonable
>> >> > > effort. I
>> >> > > think most of it boils down to only being able to rely on the new
>> >> > > wal_level after a while. For minimal->recovery we basically need a
>> >> > > checkpoint started after the change in configuration, and for
>> >> > > recovery->logical we need to wait until all sessions have a) read the
>> >> > > new config setting b) finished the transaction that used the old
>> >> > > setting.
>> >> >
>> >> > The best behavior from a user's perspective would be if the WAL level
>> >> > automatically switched to logical if logical replication slots are
>> >> > present. You might not even need 'logical' as an actual value of
>> >> > wal_level anymore, you just need to keep a flag in shared memory that
>> >> > records whether at least one logical slot exists.
>> >>
>> >> Currently logical slots cannot be created while wal_level <
>> >> logical. Thus a database that has a logical slot must have been once
>> >> executed with wal_level >= logical before the creation of the slot.
>> >>
>>
>> I think the creation of slot would take a lot more time in that case
>> as it needs to wait for existing transactions to finish which I feel
>> could be confusing to users. Sure, the cost would have to be incurred
>> the first time but still the user might tempt to cancel such an
>> operation if he is not aware of the internals.
>
>
> Yeah, I am unsure if this is doable, but I think that's what Peter was trying to explain, because that's what would be most user-friendly. But it may definitely not be worth the complexity, I'm guessing.
>

Also, I think we might need to think shall we allow wal_level to be
changed back to replica? If so, how?

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-06-09 13:27:27 Re: Bump default wal_level to logical
Previous Message Vik Fearing 2020-06-09 13:02:45 Re: text coverage for EXTRACT()