Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vGdiJ-002wxv-0F for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Nov 2025 13:38:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vGdiH-002hCd-0S for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Nov 2025 13:38:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vGdiG-002hCU-IQ for pgsql-hackers@lists.postgresql.org; Wed, 05 Nov 2025 13:38:11 +0000 Received: from mail-yw1-x1136.google.com ([2607:f8b0:4864:20::1136]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vGdiC-0067qd-36 for pgsql-hackers@postgresql.org; Wed, 05 Nov 2025 13:38:10 +0000 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-78682bab930so12664537b3.1 for ; Wed, 05 Nov 2025 05:38:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762349887; x=1762954687; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4KLnAZlytivs5G2FrYDyi8zXUkJ2j6ReFtD/Ik2Fwv4=; b=L3pmfQkXwDEWaGsCEICUJTfinvg9bSxqNR2Pl51aIOQqohe1J6hm18bfW28fnv25iu zIh/v6Sg/nbghwAKQczmzJu7hB5bRTTT9bfgMxBqboBT9RCwiNH7lP+e48FbFOQNBe5V TJClNcHre3+c5y4tKoGEtudvRA2NAungQA1OoMEO72w+j348zuOizZ/Ob6Lh0oRX+hta H5RWF64afz7hP1LK05XefMWcRQqGtzNj3+tJBD2/DlsJTNIELV+H5Qe8SZWsDkAG/o2C eupCOEHVcTP7z1nQPIcd6pssz6rA4MYGsnuwk/Q7LYW3i7LO4tLYLIzUtcKEDRziD/eD Nnpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762349887; x=1762954687; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4KLnAZlytivs5G2FrYDyi8zXUkJ2j6ReFtD/Ik2Fwv4=; b=H73sa/ifAWDLIO6IO9eOl5m64qaVdwu9hwa4Y+s/n0526bWdJGTbMPQKEJLXl3rBME Jr7GLeMTn9WQg90XHeoz8CzsnILz68PC91Y4ZzEMfDBqw916KV4E6jO7eF7jLl4hl1tk F2C7oZmiSo+NUzossObBMHFUYG9TgcBs9tUHuy5PUzwZkA9xdnPuz/wWz2zyMwJgzKKD 3EY3WTI+qpsuphWyyLlYk+/bpvEli4I4vKSdV1lgbJre58QbA+8enHVJ9BhSbssRhMVU /Cd5rcQr/HJFxZ7XsCD9Gay6KmzhVTLLkpEoC7r/7jiUwi0WiR9sHhO7eL2EBEOuKkPx Kxdg== X-Gm-Message-State: AOJu0YwrT4t2ylT1Cz3Y90+hvyBkQrJ/boIgbr2Hldz4zbaYN5U1iNeg /y+K24iybocmWezgR2OnhfMf9O6yeheQIxQhFJAMwBqsM/2DnI9mdas3 X-Gm-Gg: ASbGncsr1v6KHIBHamY8pLav3tGvbvzq/1ZfHJvkpkhkasfsplscqxXAHy/jBBxRudC sCYyR0PzMyBP7gRLNvi0mBnkYuATQJ99lgeV3XZNss6KGhIYiwjQmkpnNQu5qvgyt0g5nwD1Nj7 Z8l/AUeoLGNrVMJEPsgXgX7jlQzfYyNb5eQ0qs1h9fIOsXFIdBaJSZu/lmn6KJtG/P3wxGna2Cz k/65c/RNY5Rpk8p2abP0e0fmfu1DI9aOAObRM4KvrNsqkUwnkFESaryiD5NFdUMGxkwgOAxGW01 Bl6gneXEa9+TTPOL2FTAONF9SdOEXKco70RjQB8Ui/0zjp0eeuXRmDJfG9Rp81qX0CCmY7WHETE MVj9V9BHIvwrC3Imer8C0ct1WYzjBAxPv8t/F2kxQn8D7Rf9Tck1lBJ8pChfg7F0YAG/ewod979 gJj9e+30srmgqTrt8vhbq6ddiDPfwbxo4HZ2wkOQZgTtqWBjbEF54aLA== X-Google-Smtp-Source: AGHT+IH39MZBju4thpZRkNg5Ixc9lG57kBW91yKyTKaX8kC8AAFrJOyegDzeLX0n65JuvggQnIsazQ== X-Received: by 2002:a05:690c:768f:b0:786:5ec4:64b2 with SMTP id 00721157ae682-78694e9b64amr52666717b3.5.1762349887007; Wed, 05 Nov 2025 05:38:07 -0800 (PST) Received: from ?IPV6:2600:1700:8952:80:d4ac:40e9:5ae8:a25b? ([2600:1700:8952:80:d4ac:40e9:5ae8:a25b]) by smtp.gmail.com with ESMTPSA id 00721157ae682-78692021f0asm18967497b3.53.2025.11.05.05.38.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Nov 2025 05:38:06 -0800 (PST) Message-ID: <3e35b2be-3ee9-4803-9e82-9d84f4f796c1@gmail.com> Date: Wed, 5 Nov 2025 07:38:23 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Fix fragile walreceiver test. To: Michael Paquier , Xuneng Zhou Cc: pgsql-hackers References: <9d00b597-d64a-4f1e-802e-90f9dc394c70@gmail.com> Content-Language: en-US From: Bryan Green In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/5/2025 1:55 AM, Michael Paquier wrote: > On Wed, Nov 05, 2025 at 03:30:30PM +0800, Xuneng Zhou wrote: >> On Wed, Nov 5, 2025 at 2:50 PM Michael Paquier wrote: >>> Timing issue then, the buildfarm has not been complaining on this one >>> AFAIK, there have been no recoveryCheck failures reported: >>> https://buildfarm.postgresql.org/cgi-bin/show_failures.pl > > drongo has just reported one failure, so I stand corrected: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=drongo&dt=2025-11-05%2003%3A50%3A50 > Perfect timing on that drongo failure - validates exactly what I was seeing with the O_CLOEXEC changes. > And one log rotation should be enough before the restart. > >>> Hmm. The reason why I didn't use a PID matching check (mentioned at >>> [1]) is that this is not entirely bullet-proof. On a very slow >>> machine, one could assume that standby_1 generates some records and >>> that these are replayed by standby_2 *before* the PID of the WAL >>> receiver is retrieved. This could lead to false positives in some >>> cases, and a bunch of buildfarm members are very slow. You have a >>> point that these would unlikely happen in normal runs, so a PID >>> matching check would be relevant most of the time anyway, even if the >>> original PID has been fetched after the TLI jump has been processed in >>> standby_2. I'd rather keep the log check, TBH, bypassing it with an >>> extra rotate_logfile() before the restart of standby_2. >> >> I’ve also prepared a patch for this method. > > That's exactly what I have done a couple of minutes ago, and noticed > your message before applying the fix so I've listed you are a > co-author on this one. > Thanks for the quick turnaround and for including both Xuneng and me. > I have also kept the PID check after pondering a bit about it. A TLI > jump could be replayed before we grab the initial PID, but in most > cases it should be able to do its work correctly. > -- > Michael The rotate_logfile() fixes the fundamental issue (log file reuse), while the PID check adds extra verification for the common case. Belt and braces approach makes sense here. Your point about slow machines is well taken - I hadn't considered the window between restart and PID capture on heavily loaded systems. This clears the path for my O_CLOEXEC work without worrying about spurious test failures. Appreciate it.