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 1uvPjY-00DIzy-Oh for pgpool-hackers@arkaria.postgresql.org; Mon, 08 Sep 2025 00:27:50 +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 1uvPiY-0017d7-BG for pgpool-hackers@arkaria.postgresql.org; Mon, 08 Sep 2025 00:26:46 +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 1uvPiY-0017cz-0W for pgpool-hackers@lists.postgresql.org; Mon, 08 Sep 2025 00:26:46 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uvPiU-0016pa-0B for pgpool-hackers@lists.postgresql.org; Mon, 08 Sep 2025 00:26:45 +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=0kmwNGO+qf1Gg2pEM1XxdCBvdhA/TMg5iNIeE3xi3Jw=; b=b+Zi8UIkANPZSjcDs21/WHG+SL TPge7Zxd4FmWQKF33zkRjtc03pITaKgClNUzX/6lYDRM4HlsUmQVvLzvhOTbU2Z0z0RPgw3mmIvJq 2XJnKXoAaCCp7PkTPiVT1YU1wjf9Vsa7SaH010cPFvvurjpqZfu4D9nWn3GQQu3aNy/lsAq5yuuql 5y6I5Yr5pUSmkeaAUjlP/aJxQGhXPGk6YvdzvDtVxlicrYTJwlibfTB4XoBzO9wc8D4YTOEYVX0W9 kL4t+Ydpr8yFLAnNa/8JU4H6bjAa9zLzVQAOEB5HDL3uu7BHuQ/VrXms/765WCPHdr0SJhdEGNOp5 2o6mP1Rw==; Received: from [2409:11:4120:300:ac7a:6544:aab5:9b88] (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 1uvPiP-002YCz-1W; Mon, 08 Sep 2025 00:26:43 +0000 Date: Mon, 08 Sep 2025 09:26:28 +0900 (JST) Message-Id: <20250908.092628.942175382089863152.ishii@postgresql.org> To: nadav@tailorbrands.com Cc: ishii@postgresql.org, pgpool-hackers@lists.postgresql.org Subject: Re: Proposal: recent access based routing for primary-replica setups From: Tatsuo Ishii In-Reply-To: References: <20250904.083615.1569744760401897215.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:ac7a:6544:aab5:9b88 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Nadav, > Hi Tatsuo, > > Thanks for getting back to me. Let me clarify the ordering concern and > provide an example to make it clearer: > > Currently, replication_delay_source_cmd executes without awareness of the > replica list or the order in which Pgpool loads them. For Aurora, since > we’re bypassing the internal DB tables and fetching lag data directly via > the AWS CloudWatch API, we need to ensure the returned lag values are > mapped to the correct instances. > > For example, assume Pgpool has the following configuration: > > primary: db-primary > replicas: db-replica-a, db-replica-b, db-replica-c > > If the command retrieves lag values [15, 120, 60] from CloudWatch, we need > to guarantee these are consistently mapped as: > > > - > > db-replica-a → 15ms > - > > db-replica-b → 120ms > - > > db-replica-c → 60ms > > Without explicitly passing the instance identifiers and their order to the > command, there’s a risk that mismatched ordering will cause Pgpool to make > incorrect routing decisions. > > To address this, I suggest extending replication_delay_source_cmd to accept > an ordered list of instance identifiers as arguments. This way, the command > can fetch the metrics in the same sequence Pgpool expects, ensuring > alignment between configuration and returned data. Thanks for the clarification. Previously I misunderstood that Aurora only provides "reader endpoint", which made me think your proposal to be impossible. But after some research , I found that Aurora also provides "cluster endpoint" which refers to each replica instance. So let me check if my understanding is correct. replication_delay_source_cmd will be invoked as: replication_delay_source_cmd db-replica-a db-replica-b db-replica-c > Would you agree this approach makes sense? Yes. > If so, I can provide an updated > patch to demonstrate how the command would handle ordered instance mapping. Thanks. That would be good. BTW, There are minor points regarding your previous patch. In the patch 083.external_replication_delay/ is the test directory. This does not fit in with our test infrastructure tradition. Tests for new features should be added between 001 and 049. 050 and greater are reserved for tests for bug fixes. So at this point, 041 is appropreate (if other test for a new feature is added before your patch is committed, you need to adjust the number of course). You need to include a patch for documentation. You don't need to write Japanese doc (doc.ja). We will create it from the English document later on. Best regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp