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 1uWG7v-00BALp-9e for pgsql-admin@arkaria.postgresql.org; Mon, 30 Jun 2025 15:08:59 +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 1uWG7s-000Ka5-50 for pgsql-admin@arkaria.postgresql.org; Mon, 30 Jun 2025 15:08:56 +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 1uWG7r-000KZx-QA for pgsql-admin@lists.postgresql.org; Mon, 30 Jun 2025 15:08:56 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uWG7q-004vNx-1W for pgsql-admin@lists.postgresql.org; Mon, 30 Jun 2025 15:08:56 +0000 Message-ID: <357cc910-4564-4448-b3b3-c99a8bbbb2ff@cloud.gatewaynet.com> Date: Mon, 30 Jun 2025 16:08:52 +0100 MIME-Version: 1.0 Subject: Re: Fast Logical replication setup, via VM clone , PostgreSQL 16.9 To: pgsql-admin@lists.postgresql.org References: <7bcef1b5-6e29-4eea-8c85-23a80dab4e2c@cloud.gatewaynet.com> Content-Language: en-US Cc: Achilleas Mantzios From: Achilleas Mantzios In-Reply-To: <7bcef1b5-6e29-4eea-8c85-23a80dab4e2c@cloud.gatewaynet.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/30/25 08:36, Achilleas Mantzios wrote: > Hi, > > I gotta provide again a logical repl subscriber for our devs, we are > running PostgreSQL 16.9 . > > Instead of going the traditional logical replication way (which > involves long running COPY, catchup, etc), I am thinking of doing > something along the lines : > > 1) @publisher (master) create repl slot, create publication > > 2) shutdown postgresql , > > 3) clone the VM, > > 4) boot the clone (subscriber), > > 5) @subscriber start postgresql , drop publication, drop replication > slot, create the subscription using repl slot of 1) > > 6) @master start postgresql . > > or a version with less downtime for the publisher (aka master , > primary) : > > 1) @publisher (master) create repl slot, create publication > > 2) shutdown postgresql , > > 3) clone the VM, > > 4) start master, > > 5) boot the clone (subscriber), > > 6) @subscriber start postgresql , drop the publication, drop the > replication slot, create the subscription using repl slot of 1) > > > do you find any gotchas in the above ? > It seems I missed the fact that between 1) and 2) there could be INSERTs that are both logged in the slot and also in the data files. This will create conflicts upon creating the SUBSCRIPTION on steps 5) or 6) respectively. Unless I prohibit any connections before step 1) > >