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 1t1FC7-00FKf9-6S for pgsql-docs@arkaria.postgresql.org; Thu, 17 Oct 2024 01:20:51 +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 1t1FC4-00DlUN-Dx for pgsql-docs@arkaria.postgresql.org; Thu, 17 Oct 2024 01:20:48 +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 1t1FC4-00DlU8-6K for pgsql-docs@lists.postgresql.org; Thu, 17 Oct 2024 01:20:48 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t1FBy-001HCv-SP for pgsql-docs@lists.postgresql.org; Thu, 17 Oct 2024 01:20:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2024011501; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description; bh=N8Wn7q8gKfl8HHpmC34vvaqTnwYBlDYtY1gR1aGh6TA=; b=goI4o 52ZBo60kx3NDUEFwl9Hg8HtBkR/HNYvNzfb1RUWEAtqhoZHB6UA0KikRV00bIJbgwD7DtREz684Tf MiMV1FZf7KnCOZK3sPs/3kSfp/DbYeQovtc6QOxpTBtBNiHFaj1KiwycjA1MDBa3DbSKs9GnSGLwF QrUD5XDQHZlL+H/Ncg/vtz7S7mQ9Vd/bICI/hrurb9yGCuCbXY0PzmP6g29pIsCmXwvsX60otCw2u 85F7CobwtqckPbV666EUq0fRYRfZvOI9Q1MtuqXYVAhhI+BN1gCJAWUJdlQoYd/LjaV54ybCcbqNO rQf2jDeQOLjGzq+F8PV0ofHoWaIgA==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1t1FBx-009ws8-2w; Wed, 16 Oct 2024 21:20:41 -0400 Date: Wed, 16 Oct 2024 21:20:41 -0400 From: Bruce Momjian To: kdg.dev@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Logical replication - initial data synchronization Message-ID: References: <171606613152.686.7693963105919927503@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="LHntl8gNylKim9BJ" Content-Disposition: inline In-Reply-To: <171606613152.686.7693963105919927503@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --LHntl8gNylKim9BJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, May 18, 2024 at 09:02:11PM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/16/logical-replication-subscription.html > Description: > > I'm reading up on Logical Replication and have been reading the pages in > order. > > The first 2 pages: > https://www.postgresql.org/docs/current/logical-replication.html and > https://www.postgresql.org/docs/current/logical-replication-publication.html > both speak of the requirement to set up a snapshot and explain that > publication will then send further updates as they happen to subscribers. > > But the 3rd page, > https://www.postgresql.org/docs/current/logical-replication-subscription.html > now mentions this: "Additional replication slots may be required for the > initial data synchronization of pre-existing table data and those will be > dropped at the end of data synchronization." > > For me, reading the first 2 pages implied that I would have to perform some > manual command that starts the creation of a snapshot of pre-existing table > data, and unpack this on the subscriber node somehow. > > The text on the "Subscription" page sounds to me like this is actually > something the publisher<-> subscriber model of the postgres software can > manage on its own. As opposed to a snapshot, which feels more like the > concept of a basebackup. > > Regardless of that being correct or not, my current impression is that the > description isn't consistent across pages. Maybe the text is obvious for > people who've performed setup of logical replication before, but I have > never done this. To me, the description on the first 2 pages seems > inconsistent with the description I just encountered on the 3rd page. I was > under the impression there was no such thing as "initial data > synchronization of pre-existing table data" in terms of postgres doing this > by itself. > > Am I missing something extremely simple, or can the description of the > involved operations be made more consistent across documentation pages? Is the attached patch an improvement? -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com When a patient asks the doctor, "Am I going to die?", he means "Am I going to die soon?" --LHntl8gNylKim9BJ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="logical.diff" diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index 98a7ad0c272..cba15fce908 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -24,9 +24,9 @@ - Logical replication of a table typically starts with taking a snapshot + Internally logical replication of a table starts by taking a snapshot of the data on the publisher database and copying that to the subscriber. - Once that is done, the changes on the publisher are sent to the subscriber + Once complete, the changes on the publisher are sent to the subscriber as they occur in real-time. The subscriber applies the data in the same order as the publisher so that transactional consistency is guaranteed for publications within a single subscription. This method of data replication @@ -165,7 +165,7 @@ The individual tables can be added and removed dynamically using ALTER PUBLICATION. Both the ADD TABLE and DROP TABLE operations are - transactional; so the table will start or stop replicating at the correct + transactional, so the table will start or stop replicating at the correct snapshot once the transaction has committed. @@ -1953,8 +1953,8 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER Architecture - Logical replication starts by copying a snapshot of the data on the - publisher database. Once that is done, changes on the publisher are sent + Internally logical replication starts by copying a snapshot of the data on the + publisher database. Once complete, changes on the publisher are sent to the subscriber as they occur in real time. The subscriber applies data in the order in which commits were made on the publisher so that transactional consistency is guaranteed for the publications within any --LHntl8gNylKim9BJ--