Re: Type of wait events WalReceiverWaitStart and WalSenderWaitForWAL

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Type of wait events WalReceiverWaitStart and WalSenderWaitForWAL
Date: 2021-03-22 04:59:47
Message-ID: 0c1b01ad-9da6-a817-4d35-319620338ada@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
WalSenderWriteData.patch text/plain 1.8 KB
WalSenderWaitForWAL.patch text/plain 2.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shinya11.Kato 2021-03-22 05:03:19 RE: Wrong statistics for size of XLOG_SWITCH during pg_waldump.
Previous Message Bharath Rupireddy 2021-03-22 04:46:33 Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit?