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.96) (envelope-from ) id 1wPJzU-000eI2-2a for pgpool-hackers@arkaria.postgresql.org; Tue, 19 May 2026 12:56:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wPJzS-004ItK-1o for pgpool-hackers@arkaria.postgresql.org; Tue, 19 May 2026 12:56:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wPJzS-004ItD-1I for pgpool-hackers@lists.postgresql.org; Tue, 19 May 2026 12:56:07 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wPJzQ-00000000KSd-1uUl for pgpool-hackers@lists.postgresql.org; Tue, 19 May 2026 12:56:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=cANc1f8hxkDXu8gLZQhn/ge6SBIEmJVnB2SjlaR1im0=; b=kSmT7Qiai/dEkhqZZxvymWCQlG ACpecEMG466pc8uMNhXJuPQIyKOOj/hO8RnrSNGWK9mroD5UXTNdi3m+T4phI5lPpT7aPJycVJ+Yl rkpJ+b4B/tZZWuuD82/ttuONH7NXG3Fwyp1GaJuBjUrDnUS8w5Plo+hhlh+7uCPTbR29A5wg2cBR+ rAQFQyBpldTPeF6LWqEHozUNomHtYr96qeUb01KNBeR76PspBUjh2uCBWkuGTuXg7C9GFgWCsoIBq ELRI+OJVbadxkQN+2nkVMQ/IlV3kzY4G3f7EDrt4+a/mBCxS5cC2NxofmHWjuP/px7A0OnZq6bDu8 E1mPVApQ==; Received: from [2409:11:4120:300:a0fe:eb4c:f182:d4d2] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wPJzI-000nh8-2b; Tue, 19 May 2026 12:55:59 +0000 Date: Tue, 19 May 2026 21:55:52 +0900 (JST) Message-Id: <20260519.215552.499378691092618823.ishii@postgresql.org> To: emond.papegaaij@gmail.com Cc: pgpool-hackers@lists.postgresql.org Subject: Re: Primary node detection race at clean startup From: Tatsuo Ishii In-Reply-To: <20260519.214037.579991005061650329.ishii@postgresql.org> References: <20260519.214037.579991005061650329.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:a0fe:eb4c:f182:d4d2 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Emond, >> Hi, >> >> In our tests, we've found an issue that can cause all Pgpool nodes to >> report an incorrect 'Role: standby': >> Role : standby ← stale, never updated on this node >> Backend Role : primary ← actual SR-check result >> >> This can happen if all nodes in a watchdog cluster start with a clean >> state at the same time. If the first node is still trying to determine >> the primary database, it's primary_node_id is -2. This value is then >> synced to other nodes in the cluster, causing all nodes to report the >> stale state indefinitely. Attached is a patch against 4.7 that should >> fix this. >> >> Note that this analysis was done by Claude Code and it also created >> the patch. The failure on our CI was real though and I think the >> explanation makes sense. > > I have looked into the patch. Although I failed to reproduce the > issue, I agree with you: the explanation makes sense. Also I have run > the regression test and all test passed. I am going to push the patch > to all supported branches. Done. Note that the credits section in the commit message is as follows: Reported-by: Emond Papegaaij Reported-by: Claude Code Author: Tatsuo Ishii Discussion: https://www.postgresql.org/message-id/CAGXsc%2BZmBoLs3Mz%3DG-Bdm4JJG%2BfH1NpHfR3qVJVwW4eBKWwStQ%40mail.gmail.com Backpatch-through: v4.3 You are credited as a reporter, and Claude Code is also a reporter to indicate that the report was created by AI. I credited myself as the author. This is by following reasons: 1) AI cannot be the author. 2) The committer (me) is responsible for the commit. Regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp