Re: 'nocopy data' option is set in SUBSCRIPTION but still data is getting migrated

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 'nocopy data' option is set in SUBSCRIPTION but still data is getting migrated
Date: 2017-05-10 13:56:49
Message-ID: b0e990b7-3a54-6baa-997e-fe6de4e4a344@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/05/17 15:27, tushar wrote:
> Hi,
>
> Please refer this scenario -where 'nocopy data' option is set in
> SUBSCRIPTION but still data is getting migrated
>
> Publication - (X)
> create table t(n int);
> insert into t values (generate_series(1,99));
> create publication pub for table t;
>
> Subscription (Y)
> create table t(n int);
> CREATE SUBSCRIPTION sub CONNECTION 'dbname=postgres host=localhost
> port=5000 user=centos password=a' PUBLICATION pub WITH (copy
> data,SYNCHRONOUS_COMMIT=on);
> select count(*) from t; ->showing 99 rows
> alter subscription sub refresh publication with (nocopy data);
> restart the server (Y)
>
> X - insert more records into table 't'
> Y - check the row count , rows have been migrated from X .
>
> Is it the right behavior in this case where nocopy data option is set ?
>

Yes, (no)copy data only affects existing data at the time of running the
command, any additional data are always replicated.

The "alter subscription sub refresh publication" does nothing unless you
added/removed tables to/from publication.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-05-10 14:29:02 Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Previous Message Petr Jelinek 2017-05-10 13:52:14 Re: Concurrent ALTER SEQUENCE RESTART Regression