Re: Minimal logical decoding on standbys - Mailing list pgsql-hackers

From Drouvot, Bertrand
Subject Re: Minimal logical decoding on standbys
Date
Msg-id afed6c6d-1c77-75bf-d0f2-8500ddc56780@gmail.com
Whole thread Raw
In response to Re: Minimal logical decoding on standbys  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Minimal logical decoding on standbys  (Jeff Davis <pgsql@j-davis.com>)
List 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.pg@gmail.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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Minimal logical decoding on standbys
Next
From: "Drouvot, Bertrand"
Date:
Subject: Pass heaprel to GlobalVisTestFor() in vacuumRedirectAndPlaceholder()