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 1rANxE-006QTk-Sn for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Dec 2023 05:26:45 +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 1rANxD-002RHo-I9 for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Dec 2023 05:26:43 +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 1rANxB-002RHX-Ln for pgsql-hackers@lists.postgresql.org; Tue, 05 Dec 2023 05:26:43 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rANx4-008rhi-9k for pgsql-hackers@lists.postgresql.org; Tue, 05 Dec 2023 05:26:40 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 24F305C017E; Tue, 5 Dec 2023 00:26:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 05 Dec 2023 00:26:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1701753992; x=1701840392; bh=hR 1HwihhshL/KlBM6cBVucP+jm4gUP35cWV8KAgcu/A=; b=foEwHaOzDNOTZbbS+2 rz0TgrV2sH8x4tMQK/PVJ4LQ8ZYdvI4JRPoGoyIulMt3/If3JQZkuNyRF9vXWyBh wuh2Itx85L95KiGf+dZj7lWJbYXOW8wVynVU9p+E7So9JvQnpYDu9kU1kqHTOYel inTI0TjywtbNidT5UhykWHwrogYgHdk0TLnh4wos0Z7bOpnwWw2ydcmklEK7eeNZ oxcxvudzrrPaNCTGFBz0VtOjTux6K0fKgYHA7WJI1376qZHATtrLBq5STbOQyUCa yACXIyyWSB3JJbnumUBS55F3FrZ/xCVx6kOqGVF3LjD+nxdhwY/sJlVmCVH8wPqy 7Eaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1701753992; x=1701840392; bh=hR1HwihhshL/K lBM6cBVucP+jm4gUP35cWV8KAgcu/A=; b=xPqb0XOTZUGDNCAMifYpbjO3KXQ2+ q0r3KQcuh0DQRQX7tnTBF3DbI/Sf011fSCxpu97s88Fu6It0ikcfPw5VjHdz4R1I OEAgRPI1q+GluQAbRQYGIXzD3ErOkTpP0xjSdtvjeaYF/VRWhQPRImCruiK+mHtq v1kjIwSaEEkk0O/B/qN9MdrmVcaB20yy10Ixx8BOk6yaOvf4l/ugiVGSuqcE9anf zZCICZf+YXs+5dSe3GS4pqTgSti/jy3xKdOu6EgwX5mjI6HaVXGTZEiFQ5/2ExvZ r4iZMds6ExqDcKjFRXfs6LkZVVzVelmyBVrWoEqEECAQ+m6qMm4oz9q3A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudejjedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Dec 2023 00:26:29 -0500 (EST) Date: Tue, 5 Dec 2023 14:26:11 +0900 From: Michael Paquier To: Amit Kapila Cc: vignesh C , Peter Smith , "Hayato Kuroda (Fujitsu)" , Julien Rouhaud , PostgreSQL Hackers Subject: Re: pg_upgrade and logical replication Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CWyHdjEWFGGmF+eL" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --CWyHdjEWFGGmF+eL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Dec 04, 2023 at 04:30:49PM +0530, Amit Kapila wrote: > I have made minor changes in the comments and code at various places. > See and let me know if you are not happy with the changes. I think > unless there are more suggestions or comments, we can proceed with > committing it. Yeah. I am planning to look more closely at what you have here, and it is going to take me a bit more time though (some more stuff planned for next CF, an upcoming conference and end/beginning-of-year vacations), but I think that targetting the beginning of next CF in January would be OK. Overall, I have the impression that the patch looks pretty solid, with a restriction in place for "init" and "ready" relations, while there are tests to check all the states that we expect. Seeing coverage about all that makes me a happy hacker. + * If retain_lock is true, then don't release the locks taken in this function. + * We normally release the locks at the end of transaction but in binary-upgrade + * mode, we expect to release those immediately. I think that this should be documented in pg_upgrade_support.c where the caller expects the locks to be released, and why these should be released. There is a risk that this comment becomes obsolete if AddSubscriptionRelState() with locks released is called in a different code path. Anyway, I am not sure to get why this is OK, or even necessary. It seems like a good practice to keep the locks on the subscription until the transaction that updates its state. If there's a specific reason explaining why that's better, the patch should tell why. + * However, this shouldn't be a problem as the upgrade ensures + * that all the transactions were replicated before upgrading the + * publisher. This wording looks a bit confusing to me, as "the upgrade" could refer to the upgrade of a subscriber, but what we want to tell is that the replay of the transactions is enforced when doing a publisher upgrade. I'd suggest something like "the upgrade of the publisher ensures that all the transactions were replicated before upgrading it". +my $result = $old_sub->safe_psql('postgres', + "SELECT count(1) = 1 FROM pg_subscription_rel WHERE srsubstate = 'i'"); +is($result, qq(t), "Check that the table is in init state"); Hmm. Not sure that this is safe. Shouldn't this be a poll_query_until(), polling that the state of the relation is what we want it to be after requesting a fresh of the publication on the subscriber? -- Michael --CWyHdjEWFGGmF+eL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmVutHMACgkQnvQgOdby QH2TFQ/9FoPy0wtthxSwnntUapscn28R5Trc4Ikedk2U1wz8KFuBR+0sh13ZWb0i /iCE5VEqtFGtr9K2xzxYjfqeYBhDd0k96p7m9RJHXHzS3WBw+f+Yh8l2YP8euqLk XrDAFrmmNUIRoLkJIeFzehc5r8mzhg2m6oTNxb4/pRVZ/XIntQszyuA+74GNcOyn wc2j3SQhOhIrxPGZ03P5A7ll/txgDcgpnhvUHOkvf6zqmBUQ3ihZ8qGX5GCCGj7W jStzHXHt0kRt9hVl4pgXT8d5A0d4biv+re5gUOxzqNW5TfDF5KInn8D3ZyFIZa3O VxgPD6HpLBhnF30LSLQesqOWT8gjUi3ysqjm1MAKE3qarU2XkbXzabpUEds4LVmB UTWWUsmgDhk9iJLafS6bUG2D0bvrlP2+Z0bcyknzpnRtn7C7l/IYT8NQ7yCisoIm yZaRWzSl2cYyBVyqDdpSiEtqw574BWaMPKJNgY39r/g/1C4RcOPdaC5ALAF/JGFQ EJGDoP9nEBqcZIDZRQ5d8jXKzSrqD/mlWoSauqZyiA5ZgvSMQao6+rdq5FPKRgNQ fgZaWG5o85RoVEaBkZPRjHDDL7TdpkqeWWPbATMSouAPq0T4Mt20sNw8g4P0Ic4x QtDuoeL/sceQoxLLaJzCcPqcMX7YJvnIYT35X/xGcoutCIPijNA= =FP75 -----END PGP SIGNATURE----- --CWyHdjEWFGGmF+eL--