Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p73DX-0006cr-QI for pgsql-hackers@arkaria.postgresql.org; Sun, 18 Dec 2022 23:37:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p73CY-0008M3-3Q for pgsql-hackers@arkaria.postgresql.org; Sun, 18 Dec 2022 23:36:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p73CX-0008Lu-Q4 for pgsql-hackers@lists.postgresql.org; Sun, 18 Dec 2022 23:36:13 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p73CV-00074O-6C for pgsql-hackers@postgresql.org; Sun, 18 Dec 2022 23:36:13 +0000 Received: by mail-pj1-x1035.google.com with SMTP id hd14-20020a17090b458e00b0021909875bccso12569412pjb.1 for ; Sun, 18 Dec 2022 15:36:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7QZl1mw3crSVQd9o5Pf5PnnOfKUD/ciEliD7p1W2zUw=; b=fcrobLnK43qXklE1xQ347c3RSeKsOgw/VVu/unGSQkUkX/NfgsgVbpM9QKLFwUNjBk Oh3WFEDR0cq4LuTL9ce5ptDPaPCjaKujkDaJr8YI2C6SGDyX4GvNWJ8Ks6kl0Zacsnhn TPYaWfAl8DkxgTvP1vXOZxQsP9BDhmTVTZ+IdodbbMnTlG8vA6ebEwpcLaXkWyRTrvvn vltdngkEzGnOykmJvJTCyjG8R84F/N63dXXy+zGL6vCfJ6uRBJUE0k/wItHTyEyFlvyA n7fXhW//kM1BYo5Amol9gtiKb0Y52JQqqAje2v4bxMXht6T+Z84TYYW0+BDwHoAY5NML Ujsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7QZl1mw3crSVQd9o5Pf5PnnOfKUD/ciEliD7p1W2zUw=; b=Yf96Yoob52p2qG1GujlCE0GHcUvxB7SKnHmWFM7sWSy5HoI2fSJqkDcWn2kllizDbr 75cNTF3a5QO7Zu26NuKiJCnFt6LmI+MYwD/X1mhqtK9wPydE7CC/UlOmhNVrw4r2lxlC 6M/23LO/RsKYlg4AEN4UTPMXSBX/l0WH6HqwM82u/vMkupdinhbv2vZNHu37gzoSOTBB tMouLuZ0nqYaC6e2khqBYvIbkQMGyzh3MIY+RQaYfNdfyerht2LyMUy1YbaEwBrzFtZ3 28YTygqJVFmtwnvzRv1CVq3UC0rECRQwQsnSXlsyo4gXX502niyXFxFsZmQYuY4UP3pc JVPw== X-Gm-Message-State: ANoB5pmirF6h+hYh2Y4CK4G+xaviwWDfTjmfY8NuQT6X0o0O/s9mmN3M JGxEPancPM57mSYLvU2EETQ= X-Google-Smtp-Source: AA0mqf6LRo/duTN8luKCeTKN2kqNu/k9jE/NU6QXxFoekLLMWvMAbrbtbr3OY1UnHNkg4pYw7LgVYg== X-Received: by 2002:a17:90a:a091:b0:216:cdc7:58bb with SMTP id r17-20020a17090aa09100b00216cdc758bbmr41940060pjp.34.1671406569335; Sun, 18 Dec 2022 15:36:09 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id u3-20020a17090add4300b002135a57029dsm4542458pjv.29.2022.12.18.15.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Dec 2022 15:36:08 -0800 (PST) Date: Sun, 18 Dec 2022 15:36:07 -0800 From: Nathan Bossart To: Tom Lane Cc: Melih Mutlu , Thomas Munro , "Hayato Kuroda (Fujitsu)" , "pgsql-hackers@postgresql.org" Subject: Re: wake up logical workers after ALTER SUBSCRIPTION Message-ID: <20221218233607.GB1476904@nathanxps13> References: <2561155.1670977214@sss.pgh.pa.us> <20221214004105.GA669835@nathanxps13> <20221214171023.GA689106@nathanxps13> <2707695.1671039752@sss.pgh.pa.us> <20221214174535.GA773264@nathanxps13> <2783450.1671042198@sss.pgh.pa.us> <20221214183759.GC773264@nathanxps13> <2787771.1671044578@sss.pgh.pa.us> <20221214231727.GA828014@nathanxps13> <20221215224721.GA694065@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221215224721.GA694065@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Dec 15, 2022 at 02:47:21PM -0800, Nathan Bossart wrote: > 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. This seems to have somehow broken the archiving tests on Windows, so obviously I owe some better analysis here. I didn't see anything obvious in the logs, but I will continue to dig. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com