Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
| От | Amit Kapila | 
|---|---|
| Тема | Re: POC: enable logical decoding when wal_level = 'replica' without a server restart | 
| Дата | |
| Msg-id | CAA4eK1KvGHp=DjbrqZFwRJZRhr6M+W-pWpxLb=f-Q1uSFMoT9g@mail.gmail.com обсуждение исходный текст  | 
		
| Ответ на | Re: POC: enable logical decoding when wal_level = 'replica' without a server restart (Masahiko Sawada <sawada.mshk@gmail.com>) | 
| Ответы | 
                	
            		Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
            		
            		 | 
		
| Список | pgsql-hackers | 
On Sat, Oct 25, 2025 at 4:06 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> On Fri, Oct 24, 2025 at 4:48 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> > 5.
> > +bool
> > +CheckLogicalSlotExists(void)
> > {
> > …
> > + /* NB: counting invalidated slots */
> > +
> > + if (SlotIsLogical(s))
> >
> > Why can't we avoid counting invalid slots? I think this needs more
> > comments. BTW, shouldn't this patch consider changing
> > effective_wal_level when the last logical slot is invalidated?
> > Ideally, when logical decoding is not possible in the system, then we
> > can reduce the wal_level back to replica, no?
>
> Hmm, good point. I've considered this idea before but I didn't
> implement it probably because it makes the code more complex. But
> thinking of this idare carefully, it doesn't seem too complex. I've
> implemented this part as a separate patch to make reviews easy. I'll
> merge them if it looks good.
>
Thanks for looking into it. I didn't get a chance to review the entire
0002 but I looked at InvalidateObsoleteReplicationSlots() and have a
few questions related to that.
In InvalidateObsoleteReplicationSlots(), the patch increments
n_valid_logicalslots before trying to invalidate the slot. Say, if
there is just one logical slot which got invalidated, then because we
have first incremented n_valid_logicalslots, how will it request to
disable logical_decoding after invalidating the last logical slot?
Another related point is that, say we decide to disable decoding
because the last logical slot got invalidated and
RequestDisableLogicalDecoding()->LogicalDecodingStatusChangeAllowed()
returns false, then how the disabling will happen?
--
With Regards,
Amit Kapila.
		
	В списке pgsql-hackers по дате отправления: