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 1wWWeM-002ft3-1o for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2026 09:52:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wWWeK-001pLg-17 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jun 2026 09:52:04 +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.96) (envelope-from ) id 1wWWeJ-001pLX-36 for pgsql-hackers@lists.postgresql.org; Mon, 08 Jun 2026 09:52:04 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wWWeH-00000001wWS-2Px0 for pgsql-hackers@postgresql.org; Mon, 08 Jun 2026 09:52:03 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2c0c35980fdso41499185ad.2 for ; Mon, 08 Jun 2026 02:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780912319; cv=none; d=google.com; s=arc-20240605; b=fKyTg/b1FglFuSQHoeK5BknTUUmi3qf5HGj0E11tMh0bOEqS8c8X3qo/fXU6HaPLSY Lu0EBYjQUqkLoUWlq5kIRDpQ9duhGFfNoP/Z2kAjGdtThsGCjLvH11eRZJ0YoWQ832le Q/ysCJkZ0fvSAMDcHECP6vi0jeHrHW5pFCjygB+KdrBrU397El+ewOD1BDJYWlhZvLPx 1nY6Clq8w9oktphxbTlPmzSFhs2zIwRE9J+R8k7OgxILgtMZsfJJwiaQiqaEN5IGMGKA YiPbD22ziK8InrNAGczmvFXgHT9k7eomQ59pgg1uGA0wKc3ODdDgYbZBEsBOZuM3hAx+ toKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+40PBwB+hi6ju9WQw4VxPmmVr0N8PE4d6xJsOPcB3LI=; fh=w3iP+stNRvgVTL7LBNxwmoqxmauJll3dzs0EQcH2TDw=; b=ZOd+00u1fUsdqcCKsfO82TNjfOhOtpLf0O/0itKqk5ZPd3vnEjEtwcIfPFTcjGBPCR iF9yyt6+tgGesUcuqd4cTGAieja6tLCl/NiQkb80P1EucO/csRPkvp2d0dhvkty/BvI8 CT7PnEtLSphnbC5qaXmfukv8XuqKDyGsjjIqvK1dalvcr5RAQ7aaIMe4gjO1XhVdbYQw J52MjelSaZIQKYsMSKgbGDMkicGla4drRoEJkrrZelAT4QmlTtx4H0n/Yk+emkIo/DI7 NY1hyRCBOg6twUx18rRWTrietxpfUQY5/B7JjFXDqBc8ZMTQxuuBLyQb3kURGML3LZn1 hpVw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780912319; x=1781517119; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+40PBwB+hi6ju9WQw4VxPmmVr0N8PE4d6xJsOPcB3LI=; b=bE0Rq/4j5ZhXq+NcVlLomohJj62cdxylIUyfJrA6zdN2KfSPe0zL+t+x8zdwn/wbPR /M8zktaDuNskif5ZMrJzl5/cz0qoK8pNdOYjaoxQIQekETBHSzzhEVdAtuORTmMgLKYr DPQn6GEOnBDgaaXt2NrEec+Gb/j4l4AiRyvxBrJpyLx1hqPqpOW5yEmNaQVQ21td6XsW 98EWPnZ94Umb3AmMeTtC1QwyUdWOh7wlEj62T/xnYLrFAWw0gNBPa23IW69G9/WIPwGW 0DwknX4OOKnt3HaoB2qRcKhMoG8J3qjVv1RtbRK+mSiM1cfcmaU6dvIr3TNsz45B2YHc l+XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780912319; x=1781517119; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+40PBwB+hi6ju9WQw4VxPmmVr0N8PE4d6xJsOPcB3LI=; b=W+z/BjeHsxX9y3uMox1dB32xv9EgSPCDb9wuguJV33ITzB/UdeAOeUROGAEv9eJ5h4 TPkkcieqIYk1/iPMHkgi28dK4cXGnCtj0aYXbyB3yyCtWr4GYuleLR3I3hPiO03X+K1F hoW5qsZCSAjZt+0BTTkNQpWNFxBWRAKnIU42R7BecGCxaPmXK2hFgBNEeLj/9fD055ZB WgkiKWXvIJcBkCZ5IwDyh7COEVV99IYguV93gpYXDL3lxh80eEllOj+ubnAcM8/CHTlB uoXl5BfPihvTelUqGPR3cUSUWlOjVUfzV53ZKClssdvwWw6LCvUNPyeW3wQQC0AOKAVY byOA== X-Forwarded-Encrypted: i=1; AFNElJ80Uq18IU51sWsBWSd6Q5kRS5l8NxI+VND3kyT6awg9/xlgt8Y22aRqdC8pvmABiJoWnpWz12wAnUNQKqC/@postgresql.org X-Gm-Message-State: AOJu0YzkaBlVm5U34O9d2gP/Twqi+vEYS3VSV816H6almksD2a59xTIu vQrb3v1iC9LkYp7+ymj2TV6YeBIwb60C9pYuAy0YQbmYRIqoYdeL8RTYCFoYJSQeQ1kNHPR4XQa MrIy+rc7SyjOntvi0qzv+pmKO0RNTNTI= X-Gm-Gg: Acq92OGuEw6IW3cGOd13e7+ykFCMKwxidbwVj2fzMkXboja5jpTH382U3h0o2eDbMTK UqJAxtJA+kTnB41YZrIeMypsGB9jXZet6PJCJwp1p+TnUGcqWZLAUXRRLu5JojNh3NAv93KlIsg gfv/dtWvwtSXwb2t6MB82IKnH3Nq5tw3D/NT576M+t8k2smm41a+lplDgaAIp9XG4Vn34irD89D UrjyySmDzw4shNIKSy539Cbl2yFklxn+irNA1vu6tKRoggtPFhgraoLmrUZodUv3XpDvlCsxDok kTO0BaMyittoZPZF3IwvbPyE3+nnOK6b7RE4Cqx9imU97XFaqN8WCbZpUSje+hV4VZ8L7/u6nr2 5iF0542ldfEm43JOrAk+mw3Jo6DiqRAOqMIDIrRpNxvmTiSw4T23WT4xpXEGJmw== X-Received: by 2002:a05:6a20:eed3:20b0:3b4:8784:5583 with SMTP id adf61e73a8af0-3b4ccd00081mr11427389637.3.1780912318901; Mon, 08 Jun 2026 02:51:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Mon, 8 Jun 2026 15:21:44 +0530 X-Gm-Features: AVVi8Cd5Q7sBIVQtle2V5mk_FK9fO9QjBgttwb3K3_5SSuSwcBm_5KH9GMFCFXM Message-ID: Subject: Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication To: shveta malik Cc: "Zhijie Hou (Fujitsu)" , Ashutosh Sharma , Ajin Cherian , SATYANARAYANA NARLAPURAM , PostgreSQL-development , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jun 5, 2026 at 9:06=E2=80=AFAM shveta malik wrote: > > On Fri, Jun 5, 2026 at 8:34=E2=80=AFAM Zhijie Hou (Fujitsu) > wrote: > > > > On Thursday, June 4, 2026 5:27 PM Ashutosh Sharma wrote: > > > On Thu, Jun 4, 2026 at 1:54=E2=80=AFPM Zhijie Hou (Fujitsu) > > > wrote: > > > > > > > > On Thursday, June 4, 2026 3:36 PM Ashutosh Sharma > > > wrote: > > > > > On Thu, Jun 4, 2026 at 9:14=E2=80=AFAM shveta malik > > > > > wrote: > > > > > > My preference, and original intent, was to accept duplicate ent= ries > > > > > > and skip them internally. Doc can be updated to say 'duplicate = entries > > > > > > are skipped'. A server startup failure due to duplicate entries= in a > > > > > > GUC does not seem right to me. If the alter-system command fail= s due > > > > > > to duplicate entries, that is still fine, but a startup failure= seems > > > > > > excessive. But let's see what others have to say on this. > > > > > > > > > > > > > > > > Okay, the attached patch adds the capability to automatically rem= ove > > > > > duplicate entries from the synchronized_standby_slots list. > > > > > > > > Thanks for updating the patch. > > > > > > > > I agree with Shveta that reporting an ERROR is not ideal. I also th= ink it (ERROR) would > > > > be inconsistent with existing GUCs, as most of them, such as > > > > synchronous_standby_names, search_path, and session_preload_librari= es, do not > > > > enforce uniqueness. > > > > > > > > The most similar GUC, synchronous_standby_names, also clarifies thi= s in the > > > > documentation: > > > > > > > > " There is no mechanism to enforce uniqueness of standby na= mes. In case of > > > > duplicates one of the matching standbys will be considered = as higher priority, > > > > though exactly which one is indeterminate."[1] > > > > > > > > > In N of M > > > > > mode, if N > M after removing duplicate entries, an error is rais= ed. > > > > > > > > I'm not entirely sure about this case. It seems similar to when the= number of > > > > specified slots is less than N (in ANY N or FIRST N), given that we= want to > > > skip > > > > duplicate slots. In that situation, the natural behavior to me woul= d be to > > > > simply block replication rather than raise an error. And > > > > synchronous_standby_names would also simply block the transaction i= n this > > > case. > > > > > > > > > > For duplicate entries themselves, I agree with the direction of not > > > raising an error. Silently normalizing duplicates is reasonable for > > > this GUC, especially if we document it clearly. A repeated slot name > > > does not add any new information, so treating it as =E2=80=9Csame slo= t listed > > > twice by mistake=E2=80=9D is practical. > > > > > > But for N > M after deduplication, I would still lean toward raising = an error. > > > > > > Why I=E2=80=99d separate those cases: > > > > > > 1) Duplicate entries looks like a harmless normalization problem. ANY > > > 2 (a, a, b) can be normalized to ANY 2 (a, b) without changing the > > > user=E2=80=99s apparent intent much. > > > > > > 2) N > M after deduplication is not a transient runtime state. ANY 2 > > > (a, a) becomes one unique slot. That configuration can never succeed > > > unless the config itself changes. Blocking forever turns a static > > > configuration mistake into an operational liveness problem. > > > > > > 3) N > M after deduplication is different from ordinary =E2=80=9Cnot = enough > > > standbys are currently available=E2=80=9D. If we configure ANY 2 (a, = b) and > > > only a is currently caught up, blocking makes sense because the > > > situation may resolve at runtime. If we configure ANY 2 (a, a) and > > > duplicates are ignored, there is no possible future runtime in which > > > it succeeds without editing the GUC. That is why I think erroring is > > > better. > > > > > > On the synchronous_standby_names comparison, I do not think it is > > > fully analogous. The quoted documentation is about there being no > > > reliable way to enforce uniqueness of standby names in the live > > > system, because those names are matched against runtime standbys and > > > the result can be indeterminate. Here, synchronized_standby_slots > > > names concrete replication slots, which are stable object identifiers= . > > > Duplicate config entries are detectable and normalizable > > > deterministically at GUC parse time. That gives us a cleaner option > > > than synchronous_standby_names has. > > > > Thanks for the explanation. > > > > What I was wondering is: ignoring duplicates, what should be the behavi= or of > > "ANY 2 (standby)" when N > M? > > > > I studied a bit for the behavior of synchronous_standby_names to unders= tand the > > difference. synchronous_standby_names does support syntax like "ANY 2 (= standby)" > > where N > M. Because even in that case, a transaction can still commit = if there > > are two standbys with the same name ("standby" in this example). I'm no= t sure > > how common that use case is, but it may explain why no error is reporte= d. > > > > Given that, I'm not opposed to reporting an error in synchronized_stand= by_slots > > when N > M. The situation is different here since there cannot be two s= lots with > > the same name, making this a completely invalid use case. > > > > I also think, we can report error when N>M. > +1 for reporting an ERROR for this case. --=20 With Regards, Amit Kapila.