Re: Type of wait events WalReceiverWaitStart and WalSenderWaitForWAL - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Type of wait events WalReceiverWaitStart and WalSenderWaitForWAL
Date
Msg-id 0c1b01ad-9da6-a817-4d35-319620338ada@oss.nttdata.com
Whole thread Raw
In response to Re: Type of wait events WalReceiverWaitStart and WalSenderWaitForWAL  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Type of wait events WalReceiverWaitStart and WalSenderWaitForWAL
Re: Type of wait events WalReceiverWaitStart and WalSenderWaitForWAL
List pgsql-hackers

On 2021/03/22 12:01, Kyotaro Horiguchi wrote:
>>> WAIT_EVENT_WAL_RECEIVER_WAIT_START is waiting for waiting for starup
>>> process to kick me.  So it may be either IPC or Activity.  Since
>>> walreceiver hasn't sent anything to startup, so it's activity, rather
>>> than IPC.  However, the behavior can be said that it convey a piece of
>>> information from startup to wal receiver so it also can be said to be
>>> an IPC. (That is the reason why I don't object for IPC.)
>>
>> IMO this should be IPC because walreceiver is mainly waiting for the
>> interaction with the startup process, during this wait event. Since
>> you can
>> live with IPC, probably our consensus is to use IPC?
> 
> Exactly.

Ok, so barring any objection, I will commit the patch that I posted upthread.


> Mmm. I agree that it waits for WAL in most cases, but still WAL-wait
> is activity for me because it is not waiting for being cued by
> someone, but waiting for new WAL to come to perform its main purpose.
> If it's an IPC, all waits on other than pure sleep should fall into
> IPC?  (I was confused by the comment of WalSndWait, which doesn't
> state that it is waiting for latch..)
> 
> Other point I'd like to raise is that the client_wait case should be
> distinctive from the WAL-wait since it is significant sign of what is
> happening.
> 
> So I propose two chagnes here.
> 
> a. Rewrite the comment of WalSndWait so that it states that "also
>    waiting for latch-set".

+1


> b. Split the event to two different events.
> 
> -    WalSndWait(wakeEvents, sleeptime, WAIT_EVENT_WAL_SENDER_MAIN);
> +    WalSndWait(wakeEvents, sleeptime,
> +       pq_is_send_pending() ? WAIT_EVENT_WAL_SENDER_WRITE_DATA:
> +                              WAIT_EVENT_WAL_SENDER_MAIN);
> 
> And _WRITE_DATA as client_wait and _SENDER_MAIN as activity.
> 
> What  do you think about this?

I'm ok with this. What about the attached patch (WalSenderWriteData.patch)?

> Yes. The WAIT_EVENT_WAL_SENDER_WAIT_WAL is equivalent to
> WAIT_EVENT_WAL_SENDER_MAIN as function.  So I think it should be in
> the same category as WAIT_EVENT_WAL_SENDER_MAIN. And like the 1 above,
> wait_client case should be distinctive from the _MAIN event.

+1. What about the attached patch (WalSenderWaitForWAL.patch)?

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachment

pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit?
Next
From:
Date:
Subject: RE: Wrong statistics for size of XLOG_SWITCH during pg_waldump.