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 1sUIFI-001vy0-2k for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jul 2024 03:55:55 +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 1sUIFF-0095Ce-PY for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jul 2024 03:55:54 +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 1sUIFF-0095CO-FG for pgsql-hackers@lists.postgresql.org; Thu, 18 Jul 2024 03:55:53 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sUIFD-0008No-Kq for pgsql-hackers@postgresql.org; Thu, 18 Jul 2024 03:55:53 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-367b8a60b60so196926f8f.2 for ; Wed, 17 Jul 2024 20:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721274950; x=1721879750; 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=9M+yYbywoceryzBslOsopv0xIPnxSe9Lw9gan1i4lmA=; b=fiZTWT4IWp9L0yt0tAPBgueWQfZn0RvsK+Jc17H1NX/GEUyP6XMf9OMpuqNqjeqmr+ Iqf9qtalht1qbF292HjOUEcRfGyEAIn3zjLEnl5oInsD4CpNaDcIHMC3/XlCxx7djk7J sIw8+IltHsCzZtG01zf4VFlcgvZtp75QMZSK3VJdrklI2yBccjY24FsTzbpJvtpcNshJ FZOaIFz8JZwLsQ+/jjjgzU2KNy0GbyP0leRo+GMVKb0jJwIO+PlZ+qwFnQ+qFCAafU/C F78S86gTV6UgsCpQeeXqO8fi7RWYdK/1EK4yZXLOGcsVL+qsxysTmOAHzce9kUk9Gr1b o2OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721274950; x=1721879750; h=content-transfer-encoding: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=9M+yYbywoceryzBslOsopv0xIPnxSe9Lw9gan1i4lmA=; b=I9q/LEtP6SaqKJQsxAcbufKh7AwBhBPxUxuNKWaJ6KHn2FT7rxfTvKYFfaafd7gaF3 ztUtnTQ4ouHfRkbVqNSlpo6FKtqQpwfC0pLu9OGn0tBrLVM9Po14wicBBs4b6ccKzqnB jF2LUfsg4nn4mkj5QP+ZdIT1a/+TVAS3IpvbgTYlETE2c8u2GTjwUM7ucfWDE9JS3D6R YSTSJq+rnvxwfvQyVbhzMTsNFRzKtSnvWE0TjLFP4yjELxZZsJuZ1yhArRqliYfVbFVo tbzTBkJzAq6FnEjuG+k+NuDeQ5ZVvNFNp8yRL72cs40jWxJjiWkiP/ecWZj6CKeDperP 02sA== X-Forwarded-Encrypted: i=1; AJvYcCVRsFi41scmKpnyKEhhmDBYHqvWLJRk8KRzZv/2IpyGUZU9YAgh0cItNZkKrYHUNuYzbECw4nurQ8XjgO4+RPgoQDUtWxwn6DD0fJzp X-Gm-Message-State: AOJu0Yw3dn+q1PY9H/TCPYLdTyE59mcgrQQLrxxfGUCOV7Uq3tsMkCgS HQjomCPuKKAzRBfv/3CrpvTQroeHk7lMl6B/YbJcjHV/LhCNEhepmBWngfiw4g+vvKLa3Z9CFzX Zye3gvCx348lm3HWJYDNbkMB42yg= X-Google-Smtp-Source: AGHT+IGXuaceasbN7HLika2AWSZNNpWVahbcfLMAg4cXyW6tJ/XEOiT1a5mhorSVaoT036TswkAxODpjYQAWqfbjXJY= X-Received: by 2002:a5d:588e:0:b0:368:3198:5ac4 with SMTP id ffacd0b85a97d-36831985ca4mr2863795f8f.39.1721274949479; Wed, 17 Jul 2024 20:55:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Thu, 18 Jul 2024 09:25:37 +0530 Message-ID: Subject: Re: Allow logical failover slots to wait on synchronous replication To: John H Cc: Amit Kapila , "bertranddrouvot.pg@gmail.com" , pgsql-hackers@postgresql.org, 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 Tue, Jul 9, 2024 at 12:42=E2=80=AFAM John H wrote: > > > > Can we make it a default > > behavior that logical slots marked with a failover option will wait > > for 'synchronous_standby_names' as per your patch's idea unless > > 'standby_slot_names' is specified? I don't know if there is any value > > in setting the 'failover' option for a slot without specifying > > 'standby_slot_names', so was wondering if we can additionally tie it > > to 'synchronous_standby_names'. Any better ideas? > > > > No, I think that works pretty cleanly actually. Reserving some special > keyword isn't great > which is the only other thing I can think of. I've updated the patch > and tests to reflect that. > > Attached the patch that addresses these changes. Thank You for the patch. I like the overall idea, it is a useful one and will make user experience better. Please find few comments. 1) I agree with the idea that instead of introducing new GUC, we can make failover logical slots wait on 'synchronous_standby_names', but this will leave user no option to unlink failover-enabled logical subscribers from the wait on synchronous standbys. We provide user a way to switch off automatic slot-sync by disabling 'sync_replication_slots' and we also provide user a way to manually sync the slots using function 'pg_sync_replication_slots()' and nowhere we make it mandatory to set 'synchronized_standby_slots'; in fact in docs, it is a recommended setting and not a mandatory one. User can always create failover slots, switch off automatic slot sync and disable wait on standbys by not specifying 'synchronized_standby_slots' and do the slot-sync and consistency checks manually when needed. I feel, for worst case scenarios, we should provide user an option to delink failover-enabled logical subscriptions from 'synchronous_standby_names'. We can have 'synchronized_standby_slots' (standby_slot_names) to accept one such option as in 'SAME_AS_SYNCREP_STANDBYS' or say 'DEFAULT'. So when 'synchronous_standby_names' is comma separated list, we pick those slots; if it is empty, then no wait on standbys, and if its value is 'DEFAULT' as configured by user, then go with 'synchronous_standby_names'. Thoughts? 2) When 'synchronized_standby_slots' is configured but standby named in it is down blocking logical replication, then we get a WARNING in subscriber's log file: WARNING: replication slot "standby_2" specified in parameter synchronized_standby_slots does not have active_pid. DETAIL: Logical replication is waiting on the standby associated with "standby_2". HINT: Consider starting standby associated with "standby_2" or amend parameter synchronized_standby_slots. But OTOH, when 'synchronous_standby_names' is configured instead of 'synchronized_standby_slots' and any of the standbys listed is down blocking logical replication, we do not get any sort of warning. It is inconsistent behavior. Also user might be left clueless on why subscribers are not getting changes. thanks Shveta