delay starting WAL receiver - Mailing list pgsql-hackers

From Nathan Bossart
Subject delay starting WAL receiver
Date
Msg-id 20230111010836.GA1550875@nathanxps13
Whole thread Raw
Responses Re: delay starting WAL receiver
List pgsql-hackers
I discussed this a bit in a different thread [0], but I thought it deserved
its own thread.

After setting wal_retrieve_retry_interval to 1ms in the tests, I noticed
that the recovery tests consistently take much longer.  Upon further
inspection, it looks like a similar race condition to the one described in
e5d494d's commit message.  With some added debug logs, I see that all of
the callers of MaybeStartWalReceiver() complete before SIGCHLD is
processed, so ServerLoop() waits for a minute before starting the WAL
receiver.

The attached patch fixes this by adjusting DetermineSleepTime() to limit
the sleep to at most 100ms when WalReceiverRequested is set, similar to how
the sleep is limited when background workers must be restarted.

[0] https://postgr.es/m/20221215224721.GA694065%40nathanxps13

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Strengthen pg_waldump's --save-fullpage tests
Next
From: Michael Paquier
Date:
Subject: Re: Allow +group in pg_ident.conf