Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpD1u-0005L2-5L for pgsql-general@arkaria.postgresql.org; Thu, 31 Jan 2019 14:09:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gpD1s-0007jh-7x for pgsql-general@arkaria.postgresql.org; Thu, 31 Jan 2019 14:09:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpD1r-0007d1-Ty for pgsql-general@lists.postgresql.org; Thu, 31 Jan 2019 14:09:19 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpD1f-0008O7-5l for pgsql-general@lists.postgresql.org; Thu, 31 Jan 2019 14:09:19 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id x0VE8ZsN008553 for ; Thu, 31 Jan 2019 16:08:40 +0200 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id x0VE8XDA034565 for ; Thu, 31 Jan 2019 16:08:35 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: Initial load from standby in logical replication. To: pgsql-general@lists.postgresql.org References: From: Achilleas Mantzios Message-ID: <0854e3da-cbe7-e513-b571-de4eae619afd@matrix.gatewaynet.com> Date: Thu, 31 Jan 2019 16:08:33 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-26.2 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,DYN_SPAM_WATCHES8,SARE_SPEC_REPLICA_OBFU autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 31/1/19 3:55 μ.μ., Radoslav Nedyalkov wrote: > Hi All, > We want to setup a logical replica with initial load from physical standby. (all pg10.5) > Basically what we tested is: > 1.on the master: create publication and logical slot. > 2.on the standby: pause the stanby. (lsn from 1. is already replayed). > 3.on the standby: get last replayed lsn, pg_last_wal_replay_lsn(). > 4.export/import the data into the logical replica. > 5.on the logical replica: create subscription with pg_replication_origin_advance'd to the lsn from 3. > 6.on the logical replica: enable subscription. > > On a test setup with some bulk inserts results are encouraging. > Still we're not that confident. Does the procedure looks okay? > What if standby is paused at COMMIT lsn? Who is gonna consume data from the primary's replication slot? If there is no subscriber connected and reading data, then the primary will think that the subscriber is down and will accumulate WALs till some replication client is connected to it (which will not happen since the subscriber points to the standby). > > Thanks! > Radoslav Nedyalkov > > > > > > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt