Re: Minimal logical decoding on standbys

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Rahila Syed <rahila(dot)syed(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Melanie Plageman <melanieplageman(at)gmail(dot)com>
Subject: Re: Minimal logical decoding on standbys
Date: 2023-04-04 09:42:45
Message-ID: 513952f7-e8d5-4bdf-f8b3-002b1264badf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 4/4/23 7:57 AM, Amit Kapila wrote:
> On Mon, Apr 3, 2023 at 8:51 PM Drouvot, Bertrand
> <bertranddrouvot(dot)pg(at)gmail(dot)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

Attachment Content-Type Size
v58-0006-Doc-changes-describing-details-about-logical-dec.patch text/plain 2.2 KB
v58-0005-New-TAP-test-for-logical-decoding-on-standby.patch text/plain 32.8 KB
v58-0004-Fixing-Walsender-corner-case-with-logical-decodi.patch text/plain 8.3 KB
v58-0003-Allow-logical-decoding-on-standby.patch text/plain 12.0 KB
v58-0002-Arrange-for-a-new-pg_stat_database_conflicts-and.patch text/plain 10.4 KB
v58-0001-Handle-logical-slot-conflicts-on-standby.patch text/plain 28.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-04-04 09:47:46 Re: Minimal logical decoding on standbys
Previous Message Masahiko Sawada 2023-04-04 08:26:58 Re: Should vacuum process config file reload more often