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 1wUz05-001adj-2i for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 03:44:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wUz04-004efP-2A for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 03:44:08 +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 1wUz04-004efC-14 for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 03:44:08 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wUz02-00000001AdN-1Nov for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 03:44:08 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-2bf77d4a4e2so8053155ad.1 for ; Wed, 03 Jun 2026 20:44:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780544644; cv=none; d=google.com; s=arc-20240605; b=lc87BRZihDjgVpkOECAxE8Vq3KVmARaJJdlsnIC3gJHst6iozoFirm5riIh7cwbOW1 DRKd2ZCKb5i8X/kxM042sqDuu3Bu5sPD2/xYt+2AWIH3EmJ2BYtY0jIEDl2DjoLsEapy Jxs4CWpVhQ7lrNNIyEQohv5FU9VkOda5mXs5LMBqg4pnfut3+kQcvqrgJ6exK04O0E1q JlLsL8MsLxbU+IHZvJCDS/pmw8yTC5rcG1WStS4CH30/bB9cMn+1Ct0gz3wG7G7pRrZU p/hvAaloCE2nuNZyfr7t/vE9KCiKBC9FeWZho9iD51NvtubVd29qEBC7LgYL/ebL6L+j JGiw== 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=fBQAfs8SG1G1Okc9+kV30H46S3gBPBhDwEMywzatdUs=; fh=IZzZA6NWxZxp3Kf2bc2s9O3tTxl74E6XqR3ilkcjn4E=; b=iejfVZpozuFDw95NNZUk6S+GDb99LTsp4RpYNxtllxzDZ2NPO1uwQYu8KgoM78XJsc qE+8qa0hD0TWhZ7z5ejwaz1esS3xOoaS1jsXpD5WfrY0Wkyi0CqGqEWx37DQtdIAQh9O KULlfbWHSyUXPE45mMRP02Cthn5REbBFfaQsn1OLq+5eImx11niTxISqBmhqXEW/TToh UcdIyiCN1ipoTn9bc3QFEMkdydG2UYFvGGVe8/g5b3v+xNnGNhoA96kD8eUUVZ8kC/pv ouB6eyAIcR+YfGxPLKwksh4wgQB04s4DHr4MAn0dH4kWL75LO/8jxZZkx0zsvv7t33Ns veyw==; 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=1780544644; x=1781149444; 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=fBQAfs8SG1G1Okc9+kV30H46S3gBPBhDwEMywzatdUs=; b=RrZhI7otEdmq0tbB/t74VHTnMudBOh9Fns0LJvHT1J/rR32oIcoiQDjWR+dw1ZA+Q7 PSpbzKpNVeWeBNkl4utXuWOhL9OPLqHG/KJ+RRTTYvmrxi/k0LD2vrqFywYPf7Xp3QGq /fKun9ni2xsXtfg2q59oL+e2xgOy9BLqsWkudbewAGGRUIWs874hgFlFLSxS9rwGyPqo d+W7uOQevvOvAlZAq1SLpvLGb5YDltnrJiDo2Uex21up7EknEXS5RxmmmZwXQQ5hk3xC 23wvB40E4OMTXh/VLF6SpUlhnKmKwnoCk+G+/JXRfnZec4BSWLwpBGrkWs9x47EipdRn 4Tzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780544644; x=1781149444; 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=fBQAfs8SG1G1Okc9+kV30H46S3gBPBhDwEMywzatdUs=; b=ZjyyTzFZ24wN0HEM5CmcnuyQLhRgqfWlOc1wsiK5Cxb5joFDC7fE92MdFKEmAQU9zg HDIZCUqU31JEND7yvQsZl21YNGly08GgyEZinXqM+Wz0X1fEDr3QoQSwJzdTTvL2e/KZ KBHt2dOfaK2AxREjgnWSiGE29Sn7GU+iQ2Nns3Fha0A0CboOP6AooqVNtxGFOhQd2yox QgCsLZdQJKC2rJMB1CoVDo+IKleQ/4bpS96dPb4rHXWhyTY8zOgEjDMiIQp6Lyb+4eLK vm7teTuztByyM7HjvNRBjOjq2/aBnWQRYAR1jryTdc1NjGWsAr+o5dY5JXS1qZ60Hx4Q nzIA== X-Forwarded-Encrypted: i=1; AFNElJ/XcB6gY4tdRR1HdutTkZMMlct20b5JpL6+oeydiRcBXh111sOLtdrYPBrLaWY3QS25j1a5Y2ArZ11d65+D@lists.postgresql.org X-Gm-Message-State: AOJu0YzufJfi6EpuC0HCX/3gCtzAn8I22yaZqu+76UxuKxovaRpXjxdY G2+9/q62eu385Ebjg2POcPoCeqXB3NVTHaJdgnQMy7BKJhb4gC/+uek+D/TkyhahVFjFw1y8+J9 gUWoJfooHkGu8/3PN8mzQRkO1g+DhCH0= X-Gm-Gg: Acq92OGLKIva8kH7M9KPDo+b+7tveJymsGarhRBj8VQ6SQw0gkCDklM8Hp//AvxgeYw JrjWP8dWI9R6cWYG2wkyrcCJ4tu+AXST55vXN54doD4NkpvfK2c7y+LuTAg91v317bJhRrfic2B JUyCfMClMQvXG3inKUKxj00cH9w6RlFY/OOUmqKtWK6nuMf5wkBV6J21xuUfkRn+J/Q0lIKOsYL nO8Hwj9lUoQSre4dD5KSCzyIKkQo3PYnsR6DYvZi6zWt9QpjTrpdyIiydnnp/kkNoV/txhLxxpJ Xpsd4ER7pNLul1Oyc0NN5TIlkUlFgf/Rhz+IDKK1nOzWk3cptExdmxJ54F5JQBdP X-Received: by 2002:a17:903:2309:b0:2c0:aa5d:756f with SMTP id d9443c01a7336-2c197d41550mr17910705ad.8.1780544643805; Wed, 03 Jun 2026 20:44:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Thu, 4 Jun 2026 09:13:52 +0530 X-Gm-Features: AVHnY4KoKNUhOz5MJTphWivIg6TK7q4uC7MHbP211HnY5YbbnDniQtNVVxX8M0Y Message-ID: Subject: Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication To: Ashutosh Sharma 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 On Wed, Jun 3, 2026 at 4:30=E2=80=AFPM Ashutosh Sharma wrote: > > 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 stan= dby_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. > My preference, and original intent, was to accept duplicate entries 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 fails 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. thanks Shveta