Hi,
On 4/4/23 7:57 AM, Amit Kapila wrote:
> On Mon, Apr 3, 2023 at 8:51 PM Drouvot, Bertrand
> <bertranddrouvot.pg@gmail.com> wrote:
>>
>> I made it as simple as:
>>
>> /*
>> * If the slot is already invalid or is a non conflicting slot, we don't
>> * need to do anything.
>> */
>> islogical = xid ? true : false;
>>
>> if (SlotIsInvalid(s, islogical) || SlotIsNotConflicting(s, islogical, xid, &oldestLSN))
>>
>> in V56 attached.
>>
>
> Here the variable 'islogical' doesn't seem to convey its actual
> meaning because one can imagine that it indicates whether the slot is
> logical which I don't think is the actual intent.
Good point. Just renamed it to 'check_on_xid' (as still needed outside of
the "CanInvalidateSlot" context) in V58 attached.
> One idea to simplify
> this is to introduce a single function CanInvalidateSlot() or
> something like that and move the logic from both the functions
> SlotIsInvalid() and SlotIsNotConflicting() into the new function.
>
Oh right, even better, thanks!
Done in V58 and now this is as simple as:
+ if (DoNotInvalidateSlot(s, xid, &oldestLSN))
{
/* then, we are not forcing for invalidation */
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com