| From: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
|---|---|
| To: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(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-12-04 03:27:48 |
| Message-ID: | CAJpy0uCaufK5fsSs9pCD-B4MN1LPkT-JkrPLDnKYHLHbm_DWTw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Dec 4, 2025 at 8:03 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> On Mon, Dec 1, 2025 at 12:54 AM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> >
> > On Mon, Dec 1, 2025 at 11:40 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> > >
> > >
> > > > 11)
> > > > my ($result, $stdout, $stderr) = $standby4->psql('postgres',
> > > > qq[select pg_logical_slot_get_changes('standby4_slot', null, null)]);
> > > > like(
> > > > $stderr,
> > > > qr/ERROR: logical decoding on standby requires "effective_wal_level"
> > > > >= "logical" on the primary/,
> > > > "cannot use logical decoding on standby as it is disabled on primary");
> > > >
> > > > Since the slot is invalidated, shouldn't the better error message be
> > > > what we usually get:
> > > > ERROR: can no longer access replication slot "slot"
> > > > DETAIL: This replication slot has been invalidated due to "..".
> > > >
> > > > IMO, the 'invalidated' message is better because even if we enable
> > > > logical-decoding on primary, it is of no use for this slot.
> > > >
> > > > But I also see the difficulty in achieving this, as the
> > > > primary-related error message is by CheckLogicalDecodingRequirements()
> > > > which happens earlier than
> > > > ReplicationSlotAcquire(). So if there is no better way, we can leave it as is.
> > >
> > > We can achieve it by creating another valid logical slot, but I
> > > believe that we already have tests to check if we cannot use an
> > > invalidated slot. What we want to test here is if logical decoding is
> > > disabled by invalidating the last logical slot. So I think the test
> > > works as expected.
> > >
> >
> > Sorry for the confusion. My earlier comment wasn’t about the test
> > mechanics or correctness. I meant that when a slot is invalidated and
> > someone attempts to use it, the message should reflect that (can no
> > longer access replication slot "slot"). Currently, the message
> > suggests enabling logical decoding on the primary, even though that
> > won’t make an invalidated slot usable. IMO, it would be clearer to
> > report that the slot is invalidated instead of directing the user to
> > enable decoding on primary.
>
> Hmm, I'm not sure there is a big difference there. If we show the
> message first that indicates that the slot is invalidated, users would
> drop the slot and try to create a new logical slot, but they would get
> the error 'logical decoding on standbys requires "effective_wal_level"
> >= "logical" on the primary'. With the current implementation, they
> would enable logical decoding on the primary first, realize that the
> slot on the standby is already invalidated, and then create a new
> logical slot.
>
Okay, makes sense. Current behaviour works for me.
thanks
Shveta
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Dilip Kumar | 2025-12-04 03:24:23 | Re: How can end users know the cause of LR slot sync delays? |