Hi,

On Mon, Nov 16, 2026 at 03:00:26PM +0530, Amit Kapila wrote:
> On Mon, Nov 16, 2026 at 1:21 PM Bertrand Drouvot
> <[email protected]> wrote:
> >
> > On Sun, Nov 15, 2026 at 10:35:57PM -0800, Masahiko Sawada wrote:
> > >
> > > I'm concerned that not only changes to this function but also changes
> > > to its callers could break these assumptions, and nothing near those
> > > places would tell us about them.
> >
> > Yeah, I agree with this concern. Looking at 788ec96d591, I think 
> > remote_slot_precedes
> > was redundant with slotsync_skip_reason, but found_consistent_snapshot was 
> > not:
> > slotsync_skip_reason reports why synchronization was skipped, while 
> > found_consistent_snapshot
> > tells the caller whether the slot is safe to persist.
> >
> > v2 is correct with the current temporary slot caller, which persists the 
> > slot
> > immediately. But relying on this call sequence seems fragile. So I'd vote 
> > for
> > restoring found_consistent_snapshot.
> >
> 
> I would have equally worried if this is an exposed function but this
> is a local function used in a narrow scope. I feel the wrong usage, if
> any, we expect could be covered by Asserts. And, it could be deduced
> by slot's property whether it is safe to persist the slot or not but
> if we still want to derive it by another flag, it is better to use a
> more direct flag like 'can_persist_slot' to decide whether to persist
> the slot. Having said that, I feel we are over worried about the wrong
> usage of update_local_synced_slot().

After sleeping on this, I think that was overcautious. Given that this is a 
local
function and v3 makes the assumption explicit with an Assert, that looks 
sufficient
to me.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com


Reply via email to