public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: Tom Lane <[email protected]>
Cc: Melih Mutlu <[email protected]>
Cc: Thomas Munro <[email protected]>
Cc: Hayato Kuroda (Fujitsu) <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: wake up logical workers after ALTER SUBSCRIPTION
Date: Thu, 15 Dec 2022 14:47:21 -0800
Message-ID: <20221215224721.GA694065@nathanxps13> (raw)
In-Reply-To: <20221214231727.GA828014@nathanxps13>
References: <20221214000145.GA638663@nathanxps13>
	<[email protected]>
	<20221214004105.GA669835@nathanxps13>
	<20221214171023.GA689106@nathanxps13>
	<[email protected]>
	<20221214174535.GA773264@nathanxps13>
	<[email protected]>
	<20221214183759.GC773264@nathanxps13>
	<[email protected]>
	<20221214231727.GA828014@nathanxps13>

I tried setting wal_retrieve_retry_interval to 1ms for all TAP tests
(similar to what was done in 2710ccd), and I noticed that the recovery
tests consistently took much longer.  Upon further inspection, it looks
like the same (or a very similar) race condition described in e5d494d's
commit message [0].  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.

A simple fix is to have DetermineSleepTime() take the WalReceiverRequested
flag into consideration.  The attached 0002 patch shortens the sleep time
to 100ms if it looks like we are waiting on a SIGCHLD.  I'm not certain
this is the best approach, but it seems to fix the tests.

On my machine, I see the following improvements in the tests (all units in
seconds):
                     HEAD  patched (v9)
    check-world -j8  165   138
    subscription     120   75
    recovery         111   108

[0] https://postgr.es/m/21344.1498494720%40sss.pgh.pa.us

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


view thread (46+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: wake up logical workers after ALTER SUBSCRIPTION
  In-Reply-To: <20221215224721.GA694065@nathanxps13>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox