Re: Improve error handling for invalid slots and ensure a same 'inactive_since' time for inactive slots

From: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: Re: Improve error handling for invalid slots and ensure a same 'inactive_since' time for inactive slots
Date: 2025-01-30 06:30:02
Message-ID: CABdArM7-eZ9S0EdH7jEUv0v6w0BCyKr5Rt7EkOE9hqaVEaQF+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 30, 2025 at 9:56 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Thu, Jan 30, 2025 at 5:23 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> >
> > My understanding was that the purpose of this patch was not anything
> > to do with "optimisations" per se, but rather it was (like the
> > $SUBJECT says) to ensure the *same* 'active_since' timestamp value
> > gets assigned.
> >
> > E.g the change to RestoreSlotFromDisk() was to prevent multiple slots
> > from all getting assigned different 'active_since' values that differ
> > by only 1 or 2 milliseconds because that would look strange to anyone
> > inspecting those 'active_since' values.
> >
>
> I see your point but not sure whether it will matter in practice
> unless the number of slots is large. I feel the second patch discussed
> here is a clear improvement as it helps centralize the logic to give
> ERRORs for invalid slots. This is useful especially when we are
> thinking of adding more reasons for slot invalidation. So, we should
> put our energy into getting the 0002 patch proposed here committed and
> the related patch to add a new reason for slot invalidation.
>

+1
Removed patch v1-0001. Please find the attached version 2 of 0002,
which is now v2-0001.

In v2, I have addressed all comments till now from [1] , [2] and [3].
- With the proposed errdetail message in [3], the new function
RaiseSlotInvalidationError() is no longer required.
- Updated the test files to match the new error message.

[1] https://www.postgresql.org/message-id/CAHut%2BPvS3rkwy6hr_awx1of4Se%2BqRsDo%3DjZyAjM9%3Dbbvr2GF9g%40mail.gmail.com
[2] https://www.postgresql.org/message-id/CAA4eK1KW_30TNG65iRDBMcqqcC2wGnK%2Bp4pbV7cLzHLTXn3-zQ%40mail.gmail.com
[3] https://www.postgresql.org/message-id/CAA4eK1KCYGMA-qWXBWRWKe%2B90fKw8gVMep3GuTvbRKdNG3OTMQ%40mail.gmail.com

--
Thanks,
Nisha

Attachment Content-Type Size
v2-0001-Raise-Error-for-Invalid-Slots-in-ReplicationSlotA.patch application/octet-stream 13.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-01-30 06:36:20 Issues with 2PC at recovery: CLOG lookups and GlobalTransactionData
Previous Message Ashutosh Bapat 2025-01-30 05:34:19 Error in StrategySyncStart() prologue