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 1wUjL1-001Oom-2r for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Jun 2026 11:00:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wUjKz-0019ZY-30 for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Jun 2026 11:00:41 +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 1wUjKz-0019ZP-1N for pgsql-hackers@lists.postgresql.org; Wed, 03 Jun 2026 11:00:41 +0000 Received: from mail-dy1-x1331.google.com ([2607:f8b0:4864:20::1331]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wUjKx-00000000tlk-1odm for pgsql-hackers@lists.postgresql.org; Wed, 03 Jun 2026 11:00:40 +0000 Received: by mail-dy1-x1331.google.com with SMTP id 5a478bee46e88-3075afe5247so245284eec.0 for ; Wed, 03 Jun 2026 04:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780484438; cv=none; d=google.com; s=arc-20240605; b=e4rL+StwZy6ogWwf6AFmG2GL85sknQ7ICijTmYz5/05TK101bLwx0L3wz+aAHwnYbE QCZzz0N52EMEDXoh6mulJRJtwfiIsBi5LrBQ0MICZZ+0Lhl8pNrhOdlxCif2J+pMelnH EZjnMYfguTEfp2wDo3YeOIQIRVeLEpjhrBGAcrBOXA0Q9mjAXjPwBVxSLZBpkYMW4ITC brxeVLc+FUWgBYMJF+LUySLgNXCxO0aBm2E/7vrAggaAiTV/ez4nI7kOz3gNCRE++102 AeSaMIUTF3LXmxG/htZSKd9+ZJMuVfKEl8tUWDnXwnnB08yQPZPPxyfbIEfdqg33imbZ iKMA== 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=lAp28vNx0JDHKQ4BpM4kKJlEuPB3zHGwF7z3cofV/lw=; fh=ufIju4komo5EmCuIb81O9YI21ZVPohgEj0eFW3uN0OM=; b=AEs+qP6HhH+sgKm/rU1xNdOg+Qo75xb3EOdbJGTDd/0kRzDsLJsF+9T0WFikd6ahpS hnIW30YDAxjHjPfpDejPiVL9kGA4IOD6Bj+ntvHazmpyTc8ZGOIPLQuNONQPDwn7cDXA /JlGEET13cZdwnoOZPzBcX3fNucFFUgpkzYj6kcHHSBb67plCCP2X+dMPNTbIeGslylR D8FPCzm7f4+gDr4kcbsKiizUZBQJrixboVctFXzdsIjgQFVJYvBm3IwaQ/BaPHETKDyH I4ZX5od9TDj3npJuGP9FZVsakwKJ1rPrpsgqlOMIjqt0IzGrXkoou6dgY3bFNGswQOQl D/xw==; darn=lists.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=1780484438; x=1781089238; darn=lists.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=lAp28vNx0JDHKQ4BpM4kKJlEuPB3zHGwF7z3cofV/lw=; b=Xs9+32sEj6uzPnbTuGqo+Ab2GEmOYVeCDkiWY1kivcZHB19qzNTkUXH3/afXqCoaIV cfuLKjY0a67lwZAyHCfV7EUOMNqtrHw8EJtQRFetBiQ/XFxugH4B419zh+I3S4WhZzXb GitHMwM7ITPeUOhIq9BgkPjXWNYwwa4I4L0ZLKITA70CjEIKi/3t3q8sfB4OV839DZLP CTwmty101+AWqrrBaxoOz0W4VF5XuqtXOhETAscMz1Gh4YEmjMab/MSpL6FhatqSK4JD OWwjQccYNRnQ5FtASwS5CNdF/dXIZARvSVUADC77rjw5BR862rxSZMCSgfgAZuMdGVvR L9Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780484438; x=1781089238; 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=lAp28vNx0JDHKQ4BpM4kKJlEuPB3zHGwF7z3cofV/lw=; b=Xdm4UjRApV1j5VY/VId85yhfxZYG1eUBfziufjE9CYOEBNSyQtqpBNW2b0qnFXLh6i UjXi/2ORfExjBzR4fqbHaHnNeJWA2h3UydohtbH7RvVizlI9UQJo0MYpww00v083U6XW 7UFtdAuLhNqTmyktr1cSIQw6tYdTC8HM2Zq1w+E2nDLERSo0Qwj0YGj61CIuUyM9D+LO A8LF3w6+wnRVy8Hbtvw22/0aTMjaAU+VS7YCKwme1ng8hWPEOiXQu/mBrWb4ZyOtkhsN QnAug3rUOJPUdwLNuRiqIVphlzgbvDru0OtYMEJzs3HmaOdDVmJSvcRQe2i6V2y2ltZj PFkw== X-Forwarded-Encrypted: i=1; AFNElJ/cAaGMkEATdE/elvEhKttu7LN2im2aLPXlhX8CkM0JxswSciBEjoOoqNEBAk0Xlr5oLdeb5eaHg9Kby/JB@lists.postgresql.org X-Gm-Message-State: AOJu0YyHnCCNKE2zODV1EDDLc0ER8rr4/3sMYw4nNQXDPidncapY9K/p ABS0hF6j/uFoyyqvKvWdt5CbaL8i8Qz93XBR0kMuyntpQ4yHnuigf/3PH/422B8lZPmM8gXudaT mz/TsoK6kIeVJcHczyGj62t0KsJE/G8k= X-Gm-Gg: Acq92OESMtQu+mINQIa22B4wsxOuvEWvmzyKBKDp/MY4qUMj0ThxsYTJfa/ZJe6fL9Q 4NvvB4O20VIq1Reim/0xpgcTCPpMx5QL8f0JckvXbMx96vnLWYjEbmFjxSDVxbjz/is3uIwRE0q 6zK5+BTXAt5UaHy54baSQpYZyjuTshKxOTN5QM8DEx5mRggxUNdk2bi77wLokkLI8ivdlOYyfAX otLrnJwEGiOW98CNV1B2UNtylJNTMFvUml8prgqYyjaNL79O74xA9uejrHnxV+YMNjIFHspEKfI WRgLJEM8zca46SoKBDdSJ5iQSDnlyp19/3TkJgKtlNKINkXj X-Received: by 2002:a05:693c:3b02:b0:304:c01e:1cfa with SMTP id 5a478bee46e88-3074fb8261bmr1627681eec.16.1780484438143; Wed, 03 Jun 2026 04:00:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Sharma Date: Wed, 3 Jun 2026 16:30:23 +0530 X-Gm-Features: AVHnY4LYiCZOanTkhdYGOhwtTWk9pHxjPZFHSwFZpMOgfhAjGaeGwQ5Y1P_aq1Q Message-ID: Subject: Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication To: shveta malik Cc: Amit Kapila , =?UTF-8?B?SG91LCBaaGlqaWUv5L6vIOW/l+adsA==?= , Ajin Cherian , SATYANARAYANA NARLAPURAM , PostgreSQL-development , PostgreSQL Hackers , shveta malik 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 Hi Shveta, On Fri, May 15, 2026 at 9:28=E2=80=AFAM shveta malik wrote: > > > Ashutosh, while testing further, I noticed that > 'synchronized_standby_slots' does not filter duplicate entries. As an > example, if user ends up giving one entry twice in priority > configuration, then we will end up waiting on one slot twice rather > than waiting on 2 different slots. > > Example: > alter system set synchronized_standby_slots =3D 'FIRST 2 (standby_1, > standby_1, standby_2, standby_3)'; > select pg_reload_conf(); > insert into tab1 values (10), (20), (30); > select pg_logical_slot_get_binary_changes('sub1', NULL, NULL, > 'proto_version', '4', 'publication_names', 'pub1'); > > The last statement works even though standby_2 and standby_3 do not > exist. It consumes standby_1 twice and thinks that the required number > of slots has caught-up. > > OTOH, if we use the same configuration for > 'synchronous_standby_names', it correctly waits for standby_2 and does > not count on standby_1 twice. > > alter system set synchronous_standby_names =3D 'FIRST 2 (standby_1, > standby_1, standby_2, standby_3)'; > insert into tab1 values (10), (20), (30); ----> This will wait on standb= y_2 > > This is perhaps because 'synchronous_standby_names ' waits on active > WAL senders rather than repeated strings in configuration. But our > code changes wait on the names present in 'synchronized_standby_slots' > without filtering out duplicates. > May I know what your expectation is here? Would you like the check hook for synchronized_standby_slots to automatically resolve duplicates into a unique set of values, or should it detect duplicate entries and raise an error so that the user can correct the configuration? If we automatically resolve duplicates, the user would still see the GUC configured exactly as they specified, even though it would not function the same way internally. For example, if a user sets: FIRST 2 (s1, s1, s1, s2) it might internally be resolved to: FIRST 2 (s1, s2) However, when the user runs SHOW, it would still display the original configuration. This could give the user an incorrect impression of how the setting is actually being interpreted. Because of this, I feel we should treat duplicate entries as an invalid configuration and raise an error. As far as synchronous_standby_names is concerned, I can see that configurations such as: FIRST 2 (s1, s1, s1, s1) are currently accepted, which I don't think is correct either and should have been rejected, possibly resulted in the server startup failure. -- With Regards, Ashutosh Sharma,