pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Radoslav Nedyalkov <rnedyalkov@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: subscription broken after upgrade to pg11
Date: Tue, 19 Mar 2019 13:37:54 -0700
Message-ID: <52788085-da50-e204-3f31-d5b335b55aed@aklaver.com> (raw)
In-Reply-To: <CANhtRibw=J3cwtdfcCcubHgSQ_Rzf2R0k3dgEhG52vbcULiKRw@mail.gmail.com>
References: <CANhtRibw=J3cwtdfcCcubHgSQ_Rzf2R0k3dgEhG52vbcULiKRw@mail.gmail.com>

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




view thread (3+ messages)  latest in thread

Message-ID: <52788085-da50-e204-3f31-d5b335b55aed@aklaver.com>
Permalink:  ../52788085-da50-e204-3f31-d5b335b55aed@aklaver.com/
Also on:    postgresql.org/message-id/52788085-da50-e204-3f31-d5b335b55aed@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, rnedyalkov@gmail.com
  Subject: Re: subscription broken after upgrade to pg11
  In-Reply-To: <52788085-da50-e204-3f31-d5b335b55aed@aklaver.com>
  References: <CANhtRibw=J3cwtdfcCcubHgSQ_Rzf2R0k3dgEhG52vbcULiKRw@mail.gmail.com> <52788085-da50-e204-3f31-d5b335b55aed@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox