Re: Introduce XID age and inactive timeout based replication slot invalidation - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Introduce XID age and inactive timeout based replication slot invalidation
Date
Msg-id CAA4eK1LuvXa6sVj3xuLoe2X=0xjbJXrnJePbpXQZaTMws8pZqg@mail.gmail.com
Whole thread Raw
In response to Re: Introduce XID age and inactive timeout based replication slot invalidation  (Peter Smith <smithpb2250@gmail.com>)
List pgsql-hackers
On Tue, Feb 11, 2025 at 8:49 AM Peter Smith <smithpb2250@gmail.com> wrote:
>
>
> InvalidatePossiblyObsoleteSlot:
>
> 2.
> + if (possible_causes & RS_INVAL_IDLE_TIMEOUT)
> + {
> + /*
> + * Assign the current time here to avoid system call overhead
> + * while holding the spinlock in subsequent code.
> + */
> + now = GetCurrentTimestamp();
> + }
> +
>
> I felt that any minuscule benefit gained from having this conditional
> 'now' assignment is outweighed by the subsequent confusion/doubt
> caused by passing around a 'now' to other functions where it may or
> may not still be zero depending on different processing. IMO we should
> just remove all doubts and always assign it so that "now always means
> now".
>

I think we shouldn't pass now to another function, but rather do all
required computations in the caller (probably in a separate inline
function). And keep the above code as is.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Ilia Evdokimov
Date:
Subject: Re: 2025-02-13 release announcement draft
Next
From: jian he
Date:
Subject: Re: read stream on amcheck