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-02 08:11:52
Message-ID: afed6c6d-1c77-75bf-d0f2-8500ddc56780@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 4/1/23 6:50 AM, Amit Kapila wrote:
> On Fri, Mar 31, 2023 at 7:14 PM Drouvot, Bertrand
> <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>>
>> That sounds like a good idea. We could imagine creating a LogicalWalSndWakeup()
>> doing the Walsender(s) triage based on a new variable (as you suggest).
>>
>> But, it looks to me that we:
>>
>> - would need to go through the list of all the walsenders to do the triage
>> - could wake up some logical walsender(s) unnecessary
>>
>
> Why it could wake up unnecessarily?

I was thinking that, if a new LogicalWalSndWakeup() replaces "ConditionVariableBroadcast(&XLogRecoveryCtl->replayedCV);"
in ApplyWalRecord() then, it could be possible that some walsender(s)
are requested to wake up while they are actually doing decoding (but I might be wrong).

>
>> This extra work would occur during each replay.
>>
>> while with the CV, only the ones in the CV wait queue would be waked up.
>>
>
> Currently, we wake up walsenders only after writing some WAL records
> at the time of flush, so won't it be better to wake up only after
> applying some WAL records rather than after applying each record?

Yeah that would be better.

Do you have any idea about how (and where) we could define the "some WAL records replayed"?

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-04-02 08:23:47 Pass heaprel to GlobalVisTestFor() in vacuumRedirectAndPlaceholder()
Previous Message Andres Freund 2023-04-02 03:42:44 Re: Minimal logical decoding on standbys