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 1uojmb-009Hlp-Jj for pgpool-hackers@arkaria.postgresql.org; Wed, 20 Aug 2025 14:27:23 +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 1uojmb-008n1F-3d for pgpool-hackers@arkaria.postgresql.org; Wed, 20 Aug 2025 14:27:21 +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.94.2) (envelope-from ) id 1uojma-008n18-P6 for pgpool-hackers@lists.postgresql.org; Wed, 20 Aug 2025 14:27:21 +0000 Received: from mail-yb1-xb30.google.com ([2607:f8b0:4864:20::b30]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uojmY-000rKW-11 for pgpool-hackers@lists.postgresql.org; Wed, 20 Aug 2025 14:27:20 +0000 Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-e94fe8c509aso525034276.1 for ; Wed, 20 Aug 2025 07:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tailorbrands.com; s=google; t=1755700038; x=1756304838; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DDojLc1mUchtMKtWp3LhTASY+zRNWUJlXNq9HH1DW4k=; b=XVxYJOKkWReH7xi9vjYaxTYdIBGDJ4713LBieDXlsAB3q4qocyMPn57rfF1USa3W0/ inSYxUtx0KnUwd6WtdvpdXbNjWtvq+f0AkNQpcT3DhU70TjShoVGZQoTCn+hHbv23bWG 6H9eCUPaK1Za1jL0Xx/NzAHZvDmfy+uqgEAu0/lVNG3JSmF1CMBFKOVNh6Y+0Yi/UoQa 0Eq/CXz35cC4OR1DiJ3DRO4m6wMtMjgOEimbitYt3KA16HrlE/5Ux5PSyYnk0a/AnIYH lPi+hS/a1/OpASLKr4ClGJVUnWouj4qEwmlQkHrMukvW4ROSvQmSEMdcnkCkI0OnSk8b me0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755700038; x=1756304838; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DDojLc1mUchtMKtWp3LhTASY+zRNWUJlXNq9HH1DW4k=; b=UbfBIYl4WD8JuT0FAveS2aKbqsOT4I39P28u5Z10SCMby2e3j7CU+UZzs5lqzOck3i xpWAYuahDET1vL3fIDoroI2fwwC2CTQ0KLl8kVdWSSZXyi3ZblAwKgb/AByTZD+KriWN ztAIqm3g+G1C2Jy53zKOZ5iAQ0dUda81OQ1akBUt/K2ied8qPGaIk242/L/DTcuRYv8f mrix84aGZGjUzSLNV662rObGhsMMFuXRKIsic5rkwWjy1kuIDJI+YOCc/fGCtYcuVv+O 31veehtc/rf31cXvPOxOP6ksGCdUUCgiIg633mz+TWcAa0opOGZOfVeInyyf3DTkDpNt jNzg== X-Gm-Message-State: AOJu0YzXSSR92EqeZfeThXnsAT5c6PaEnBB20jrF9U/7uSYJqpTZbFRl NXkcaELWEc+m1KuCg7z+XgRO2K5sbZfn9mgOfg4mVAJVPsb4qN4QzyKsUB2ZfGiHRnQUCQLOjRo SUTkgBgZPlRGLZFydqDp4T0Ap99piC0gNSJJt/edaMZhWGFb3QRFAhP+k/w== X-Gm-Gg: ASbGnct0D+IhcmlvlGuCl3nD2zdrqbGlrWrkyaG6g+XdqQD2gdNmtTSNbNsZGMde4Yt 8Mog/CH7xzbOTSawmY6ks3X/tLHxc1INT/SU3FWokbfF7osBX6P/XS2pfv5lVcRRR8LQp30hCRR HfagZTKJt35toXCVWjdxwDHe6NCGX+Uvc/rLWNZ44YGe+BO+VFk769M5rKug5aZsMyV6f1iFvjd fRMmnTUUzTzXnNRosT7TaOU9qefP8B7UIsAHIrIUjQQxqZH+6MT X-Google-Smtp-Source: AGHT+IGgEMQwiLMJ5PzGoMXcuDqkocg0HO+fdaakd4BKNM8Qvp3MdYbndf+Ndsg69CjWFx69EgLsKY8j2OJAZxYxMl0= X-Received: by 2002:a05:6902:1004:b0:e93:4657:c319 with SMTP id 3f1490d57ef6-e94e7772c2emr6275130276.17.1755700038036; Wed, 20 Aug 2025 07:27:18 -0700 (PDT) MIME-Version: 1.0 References: <20250818.215106.1325564662459771705.ishii@postgresql.org> <20250820.214537.1156323467943836247.ishii@postgresql.org> In-Reply-To: <20250820.214537.1156323467943836247.ishii@postgresql.org> From: Nadav Shatz Date: Wed, 20 Aug 2025 17:27:06 +0300 X-Gm-Features: Ac12FXxN_RzmUjbBR_XOB4lLhI-U3L6HJhuX-n3kiLQeJTWmRyY2kmtM7zp9I78 Message-ID: Subject: Re: Proposal: recent access based routing for primary-replica setups To: Tatsuo Ishii Cc: pgpool-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000019a710063cccc543" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000019a710063cccc543 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Tatsuo, Thank you for your reply, I agree with your approach. Better to get (1) out of the way first. As a simplest approach that we can implement that would support completely offloading the responsibility of the lag checking we can set it to =E2=80= =9Cfile=E2=80=9D and add another config for file path. Or just if starts with =E2=80=9Cfile:= =E2=80=9D it=E2=80=99ll understand. Then the internal polling can just read the file on schedule. The entire updating mechanism will be left to the external service. Having this as a first step also opens up the door for other implementations. Another classic option would be calling an API endpoint. But that might come with a lot more bulk and security concerns. I suggest I work on a patch for file support. What do you think? Nadav Shatz Tailor Brands | CTO On Wed, Aug 20, 2025 at 3:45=E2=80=AFPM Tatsuo Ishii = wrote: > Hi Nadav, > > Thank you for the answer. > > I think your proposal actually includes two orthogonal proposals. > > (1) "inject" replication delay value from external source (in your > case from Aurora). > > (2) per relation recent access based routing. > > I suggest to implement (1) first, then (2). This incremental approach > would be easier than implementing (1)+(2) at once. > > For (1) we could add new pgpool.conf parameter, say > "replication_delay_source". If it is set to "builtin", then > replication delay source is PostgreSQL as we already does today. If > it's set other than "builtin", then it's an external command name (+ > arguments) to be executed to import replication delay value. The > command should return replication delay value represented in strings > like "0 20 10", which means node 0, 1 and 2 replication delay values > in millisecond (in this case since the node 0 is primary, its > replication delay is 0). The command will be invoked every > sr_check_period. > > I am not sure if this actually works in Aurora. This is just a quick > idea. > > (2) would be probably much harder than (1). So we need more discussion > later on. > > Best regards, > -- > Tatsuo Ishii > SRA OSS K.K. > English: http://www.sraoss.co.jp/index_en/ > Japanese:http://www.sraoss.co.jp > --00000000000019a710063cccc543 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Tatsuo,

Thank you for=C2=A0your reply, I agree with your approach. Better= to get (1) out of the way first.=C2=A0

As a simplest approach that we can implement that would sup= port completely offloading the responsibility of the lag checking we can se= t it to =E2=80=9Cfile=E2=80=9D and add another config for file path. Or jus= t if starts with =E2=80=9Cfile:=E2=80=9D it=E2=80=99ll understand.=C2=A0
Then the internal polling can just read the file on sc= hedule. The entire updating mechanism will be left to the external service.= =C2=A0

Having this as a = first step also opens up the door for other implementations.=C2=A0

Another classic option would be = calling an API endpoint. But that might come with a lot more bulk and secur= ity concerns.=C2=A0

I su= ggest I work on a patch for file support.

=
What do you think?

<= div dir=3D"ltr">Nadav Shatz
Tailor Brands=C2=A0| CTO

On Wed, Aug 20, 2025 at 3:45=E2=80=AFPM Tatsuo Ishii <ishii@postgresql.org> wrote:
<= /div>
Hi Nadav,

Thank you for the answer.

I think your proposal actually includes two orthogonal proposals.

(1) "inject" replication delay value from external source (in you= r
case from Aurora).

(2) per relation recent access based routing.

I suggest to implement (1) first, then (2). This incremental approach
would be easier than implementing (1)+(2) at once.

For (1) we could add new pgpool.conf parameter, say
"replication_delay_source". If it is set to "builtin", = then
replication delay source is PostgreSQL as we already does today. If
it's set other than "builtin", then it's an external comm= and name (+
arguments) to be executed to import replication delay value. The
command should return replication delay value represented in strings
like "0 20 10", which means node 0, 1 and 2 replication delay val= ues
in millisecond (in this case since the node 0 is primary, its
replication delay is 0). The command will be invoked every
sr_check_period.

I am not sure if this actually works in Aurora. This is just a quick
idea.

(2) would be probably much harder than (1). So we need more discussion
later on.

Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
--00000000000019a710063cccc543--