| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> |
| Cc: | shveta malik <shveta(dot)malik(at)gmail(dot)com>, JoongHyuk Shin <sjh910805(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Rui Zhao <zhaorui126(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Persist slot invalidations before publishing them |
| Date: | 2026-10-04 05:59:59 |
| Message-ID: | asHrX+DPqiuK8IR6@bdtpg |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Wed, Sep 30, 2026 at 03:50:30PM +0530, Ashutosh Sharma wrote:
> Hi,
>
> On Mon, Sep 28, 2026 at 9:16 PM Bertrand Drouvot
> <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
> >
> > The patch needed a rebase, so at the same time I went ahead with the proposed
> > changes above (plus the one in the commit message suggested by Rui in [1]).
> >
>
> Thanks for reporting the problem and providing a patch for it. The
> approach looks good to me, but I have a few comments to share:
Thanks for looking at it!
>
> I think it would be good to add a comment above
> InvalidatePossiblyObsoleteSlot() explaining the reason for this change
> in the usual slot update pattern.
What about something like?
"
Unlike normal replication slot updates, persist the invalidation before
publishing it in shared memory. Publishing it first could allow resource
horizon computations to remove resources required by the slot before the
invalidation reaches disk. If saving then failed, a restart could restore
the old valid slot. Keeping the shared slot valid until the invalidated
image is durable avoids that state.
"
>
> 2)
>
> + {
> + SaveSlotToPath(slot, path, ERROR, cause, clear_restart_lsn);
> + }
>
> Do we need to pass clear_restart_lsn here? Cause can be used to
> determine the restart lsn value later, no?
I don't think so. InvalidatePossiblyObsoleteSlot() clears restart_lsn for
RS_INVAL_WAL_REMOVED, while slotsync must preserve the local restart_lsn
when copying the same invalidation cause. So the cause alone is not enough to
determine the desired behavior.
> 3)
>
> The current patch changes the interface for SaveSlotToPath() (), isn't
> it possible to keep it unchanged, that would probably also reduce some
> amount of complexity.
Yeah, that seems worthwhile. I'll change it that way.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Guo | 2026-10-04 06:14:30 | Re: remove_useless_joins vs. bug #19560 |
| Previous Message | shihao zhong | 2026-10-04 05:07:07 | Re: Checkpointer write combining |