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 1h6LUq-0002pj-0B for pgsql-general@arkaria.postgresql.org; Tue, 19 Mar 2019 20:38:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h6LUo-0005fh-R3 for pgsql-general@arkaria.postgresql.org; Tue, 19 Mar 2019 20:38:02 +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 1h6LUn-0005YL-OL for pgsql-general@lists.postgresql.org; Tue, 19 Mar 2019 20:38:02 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6LUk-00077w-5L for pgsql-general@postgresql.org; Tue, 19 Mar 2019 20:38:01 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6CAA421A38; Tue, 19 Mar 2019 16:37:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 19 Mar 2019 16:37:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=X j0v1Z5mDXeggH0jaAzKi7ow2SLz7f4C+vqVOUYtUtE=; b=VFAEDyD5e46z6YM/j HSMCJD8iukqjiGlkBRmGNGlJiQAB5o+GZZlOW9ohB0Y/U6Df+6gpo3bA3kZIORN/ V/LvmqMrhgIKB8GtI+14uCWT9wBtGgj7OCarl/vUCjnTJ2/9q1YYE7e0Lpe8MueV oAsKUZ3jO+cgkS6zGAVceGJO1rVEeWk1nMgk6xz1snxPaST2shhsMZdalLNJsgxd q9LieovAqQS+/mjRHr2EQkzy9d0zYZJGCjoE8sqEQHJBta6asbfuFIChxK/Xk6sq KiJngJ/3X/+akKyZKczVTUzeX1m/8XNtgjkR+bYWniqS/45iwdoW9V8d10jOQ8MN QQRaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Xj0v1Z5mDXeggH0jaAzKi7ow2SLz7f4C+vqVOUYtU tE=; b=4QNx4BEGIyyYwICFbl4zZia70I1Cpm6l5WWLvV8uZJiFxX//VfUOUyOX6 7qBNI0v9OT9JZsdXTInpY5LQ8BlzIWqHK4K4A65YNCbZrOKIFMj/j+iSn/zTuMaN ek6vJNeFRkTMW3T+XU6084FG/vqhswUSpJ66NHZ6S40asWLTGw4rStWdrjGE3YoY SMx6YKQIIUSn3Rx5a4ihQrB6Zc5sxvy2k+NEL0EgGqanpSFhbsmC1iwl7HetfRO/ YCe86NEbYfjDb4C4rBEvy0g3Dy3huiKZU2DXAebIxMQGE3Ow8tVd5W9WXO2FCnDA 1nRoEmuAoQ1s+dDsbb73Whtfs+/OQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieeggddugedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeejuddrvddu vddrudehtddrvddtvdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklh grvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 4B93D10317; Tue, 19 Mar 2019 16:37:55 -0400 (EDT) Subject: Re: subscription broken after upgrade to pg11 To: Radoslav Nedyalkov , pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: <52788085-da50-e204-3f31-d5b335b55aed@aklaver.com> Date: Tue, 19 Mar 2019 13:37:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/19/19 9:35 AM, Radoslav Nedyalkov wrote: > Hi All, > We're testing upgrade from postgres 10.6 to postgres 11.2 with pg_upgrade. > Before stopping pg10 we disabled subscription. > After upgrade and launching pg11,  the existing logical replication > subscription is there and disabled. > > stest=# \dRs+ >                                          List of subscriptions >  Name |  Owner   | Enabled | Publication | Synchronous commit | >         Conninfo > ------+----------+---------+-------------+--------------------+----------------------------------------- >  sub1 | postgres | f       | {pub2}      | off                | > host=10.2.5.8 dbname=test user=postgres > (1 row) > > However after enabling it,  the target table does not get updates, > although the subscription looks okay according to the status below. > > stest=# alter subscription sub1 enable; > ALTER SUBSCRIPTION > # no updates here > > stest=# \dRs+ >                             List of subscriptions >  Name |  Owner   | Enabled | Publication | Synchronous commit | >         Conninfo > ------+----------+---------+-------------+--------------------+----------------------------------------- >  sub1 | postgres | t       | {pub2}      | off                | > host=10.2.5.8 dbname=test user=postgres > > stest=# select * from pg_subscription; >  subdbid | subname | subowner | subenabled |               subconninfo >              | subslotname | subsynccommit | subpublications > ---------+---------+----------+------------+-----------------------------------------+-------------+---------------+----------------- >    16402 | sub1    |       10 | t          | host=10.2.5.8 dbname=test > user=postgres | sub1        | off           | {pub2} > > stest=# select * from pg_stat_subscription; >  subid | subname | pid  | relid | received_lsn | last_msg_send_time | >    last_msg_receipt_time     | latest_end_lsn |        latest_end_time > -------+---------+------+-------+--------------+--------------------+-------------------------------+----------------+------------------------------- >  16413 | sub1    | 2810 |       | 0/145C3400   |                    | > 2019-03-19 16:23:23.650073+00 | 0/145C3320     | 2019-03-19 > 16:23:23.446651+00 > > Issuing a refresh > stest=# alter subscription sub1 refresh publication with (copy_data = > false); > ALTER SUBSCRIPTION > > resumes updates , but with a gap in data. Everything up-to to the > refresh statement is missing in the target. > > What we're doing wrong ? https://www.postgresql.org/docs/11/sql-altersubscription.html REFRESH PUBLICATION Fetch missing table information from publisher. This will start replication of tables that were added to the subscribed-to publications since the last invocation of REFRESH PUBLICATION or since CREATE SUBSCRIPTION. refresh_option specifies additional options for the refresh operation. The supported options are: copy_data (boolean) Specifies whether the existing data in the publications that are being subscribed to should be copied once the replication starts. The default is true. Try with: copy_data=true > > Thanks, > Radoslav > -- Adrian Klaver adrian.klaver@aklaver.com