Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pdVKt-0000Bw-G3 for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Mar 2023 12:06:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pdVKr-0000rO-1a for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Mar 2023 12:06:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pdVKp-0000rE-Tf for pgsql-hackers@lists.postgresql.org; Sat, 18 Mar 2023 12:06:56 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pdVKg-0004yM-IJ for pgsql-hackers@lists.postgresql.org; Sat, 18 Mar 2023 12:06:55 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id D5EEA32007D7; Sat, 18 Mar 2023 08:06:42 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 18 Mar 2023 08:06:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1679141202; x= 1679227602; bh=FztINVYwcpKh6unsZ5qtqyD7xxz52Q6NdiRpyAu5sT8=; b=P MZ+ybVKgx7992Ccm64l7zZXJ3C99KsJS0F2calkm72aYvrhJXl8iFoEm9uAvQvGy V8cxv5QOPF8tkR2m+76i3b89Se3RQLSWou0rTo12mu+9J7NudRs0gUyabrUSTG6L r8md7NVBfFUHTky2wrSPZba2ZONmCvX+MMoEXaq2TycQAVZdBMxWRaJqaLVGXFlo WJYVnnsVdw1yf+jA0juuR26X9spax6WxmHZPC6nJAVqY/a+kP04emeF93DfT3oOp QIPYXbsXj8fm+S8iATfR6grk54CfeYQzUWB/IF+LzY+Nf1II/a8WNpFu0Kn7AuQs lS4uXorMwZ1S7UEJL2XjA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdefgedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfggtggugfgjsehtke ertddttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhr vgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvkedtffduff dtffffheffhfejjefhgfeiueeukeejkeffgfdufffhudffffeuveenucffohhmrghinhep vghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhr gh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 18 Mar 2023 08:06:41 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E802D97; Sat, 18 Mar 2023 13:06:38 +0100 (CET) Date: Sat, 18 Mar 2023 13:06:38 +0100 From: Alvaro Herrera To: "Kumar, Sachin" Cc: "pgsql-hackers@lists.postgresql.org" Subject: Re: Initial Schema Sync for Logical Replication Message-ID: <20230318120638.3z7usvxwncs47tdy@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Mar-15, Kumar, Sachin wrote: > 1. In CreateSubscription() when we create replication slot(walrcv_create_slot()), should > use CRS_EXPORT_SNAPSHOT, So that we can use this snapshot later in the pg_dump. > > 2. Now we can call pg_dump with above snapshot from CreateSubscription. Overall I'm not on board with the idea that logical replication would depend on pg_dump; that seems like it could run into all sorts of trouble (what if calling external binaries requires additional security setup? what about pg_hba connection requirements? what about max_connections in tight circumstances?). It would be much better, I think, to handle this internally in the publisher instead: similar to how DDL sync would work, except it'd somehow generate the CREATE statements from the existing tables instead of waiting for DDL events to occur. I grant that this does require writing a bunch of new code for each object type, a lot of which would duplicate the pg_dump logic, but it would probably be a lot more robust. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/