Re: Clear logical slot's 'synced' flag on promotion of standby

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
Cc: Ajin Cherian <itsajin(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: Clear logical slot's 'synced' flag on promotion of standby
Date: 2025-09-29 03:48:55
Message-ID: CAJpy0uDrzhpy2n+awM3RrhwmeeJkyK5F7JHb7g=0pUv9nSd95A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 24, 2025 at 10:18 AM Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> wrote:
>
> On Wed, Sep 24, 2025 at 9:42 AM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> >
> > On Tue, Sep 23, 2025 at 6:41 PM Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> wrote:
> > >
> > > > 3)
> > > > + ereport(LOG,
> > > > + (errmsg("reset synced flag for replication slot \"%s\"",
> > > > + NameStr(s->data.name))));
> > > >
> > > > a) Shall we change it to DEBUG1?
> > > > b) Shall the msg be:
> > > > synced flag reset for replication slot \"%s\" during promotion
> > > >
> > >
> > > I think this can stay as a LOG message, it only runs once at startup
> > > and applies just to logical slots, so it won’t be noisy.
> >
> > It does not run at startup, it runs during promotion. Having said
> > that, if there are a lot many slots, and we have one message per slot,
> > overall logs can still be more. I somehow find DEBUG better here. But
> > we can leave it as LOG and can revisit later when others review.
> >
> > > I’d also
> > > avoid mentioning “during promotion,” since the flag might accidentally
> > > be set on the primary and then reset later during startup, making that
> > > description inaccurate.
> >
> > This function is called only during promotion (see check 'if
> > (promoted)') and thus the suggested message ( “during promotion")
> > seems better to me.
> >
>
> ResetSyncedSlots might be called during promotion, but
> RestoreSlotFromDisk (which runs during standard PostgreSQL startup)
> performs the same functionality. This creates a scenario where the
> sync flag could be reset during either promotion or regular startup. I
> think we should either remove it, or ensure it is present in both
> places for consistency.
>

Sorry I missed this email somehow. Yes, I agree. We can have DEBUG1 at
both places. But let's see what others think on this.

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2025-09-29 04:03:09 Re: GB18030-2022 Support in PostgreSQL
Previous Message Dilip Kumar 2025-09-29 03:33:13 Re: pgstattuple "unexpected zero page" for gist and hash indexes