Re: POC: enable logical decoding when wal_level = 'replica' without a server restart

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Date: 2025-06-20 04:18:47
Message-ID: CAJpy0uC=rJM25ZmUGBVOV8qmD9vaxATNYSt8S3748EbYWCC4RA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 19, 2025 at 2:30 PM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> I wonder if a way to address the concerns that we shared above is to use a
> mixed approach like:
>
> - Forget the immediately_reserve idea
> - If a user creates a logical slot then we automatically switch to wal_level =
> logical (if not already done): I think that's a nice user experience
> - *and* provide a new API pg_activate_logical_decoding(), if the user has no
> need to create a logical slot on the primary (wants to use the standby to offload
> all the logical decoding)
>
> So if the user also uses a logical slot on the primary (for real..) then there
> is no need to launch pg_activate_logical_decoding(), until....:
>
> The user decides to drop the logical slot on the primary, and then:
>
> - If the slot is not the last logical slot, that's fine, drop it
> - If the slot is the last logical one AND the user did not set a new flag
> "wal_level_action" to "say preserve" or "force downgrade" (in the drop command)
> then the drop fails with an informative error message.

Overall the plan sounds reasonable one. But we need to think if the
slot is dropped on primary as part of Drop Subscription on subscriber,
then how will the user convey the wal-level preserve option? Giving it
as part of subscription-cmd to preserve wal-level on primary might not
be a good idea.

thanks
Shveta

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-06-20 04:50:48 Re: Sequence Access Methods, round two
Previous Message Peter Smith 2025-06-20 03:57:39 Re: Skipping schema changes in publication