Thread: pgsql: Allow publishing partition changes via ancestors

pgsql: Allow publishing partition changes via ancestors

From
Peter Eisentraut
Date:
Allow publishing partition changes via ancestors

To control whether partition changes are replicated using their own
identity and schema or an ancestor's, add a new parameter that can be
set per publication named 'publish_via_partition_root'.

This allows replicating a partitioned table into a different partition
structure on the subscriber.

Author: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Reviewed-by: Petr Jelinek <petr@2ndquadrant.com>
Discussion:
https://www.postgresql.org/message-id/flat/CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/83fd4532a72179c370e318075a10e0e2aa832024

Modified Files
--------------
doc/src/sgml/catalogs.sgml                  |  10 +
doc/src/sgml/logical-replication.sgml       |  12 +-
doc/src/sgml/ref/create_publication.sgml    |  20 ++
src/backend/catalog/pg_publication.c        |  70 +++----
src/backend/commands/publicationcmds.c      |  95 +++++----
src/backend/replication/pgoutput/pgoutput.c | 223 +++++++++++++++++----
src/backend/utils/cache/relcache.c          |  15 ++
src/bin/pg_dump/pg_dump.c                   |  24 ++-
src/bin/pg_dump/pg_dump.h                   |   1 +
src/bin/psql/describe.c                     |  17 +-
src/include/catalog/catversion.h            |   2 +-
src/include/catalog/pg_publication.h        |   5 +-
src/test/regress/expected/publication.out   | 103 +++++-----
src/test/regress/sql/publication.sql        |   3 +
src/test/subscription/t/013_partition.pl    | 298 +++++++++++++++++++++++++++-
15 files changed, 724 insertions(+), 174 deletions(-)


Re: pgsql: Allow publishing partition changes via ancestors

From
Andrew Dunstan
Date:
On 4/8/20 5:23 AM, Peter Eisentraut wrote:
> Allow publishing partition changes via ancestors
>
> To control whether partition changes are replicated using their own
> identity and schema or an ancestor's, add a new parameter that can be
> set per publication named 'publish_via_partition_root'.
>
> This allows replicating a partitioned table into a different partition
> structure on the subscriber.



prion seems to be persistently unhappy with this. It uses
-DRELCACHE_FORCE_RELEASE -DCATCACHE_FORCE_RELEASE, not sure if this
could affect the result.


cheers


andrew


-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




Re: pgsql: Allow publishing partition changes via ancestors

From
Amit Langote
Date:
On Thu, Apr 9, 2020 at 9:42 PM Andrew Dunstan
<andrew.dunstan@2ndquadrant.com> wrote:
> On 4/8/20 5:23 AM, Peter Eisentraut wrote:
> > Allow publishing partition changes via ancestors
> >
> > To control whether partition changes are replicated using their own
> > identity and schema or an ancestor's, add a new parameter that can be
> > set per publication named 'publish_via_partition_root'.
> >
> > This allows replicating a partitioned table into a different partition
> > structure on the subscriber.
>
> prion seems to be persistently unhappy with this. It uses
> -DRELCACHE_FORCE_RELEASE -DCATCACHE_FORCE_RELEASE, not sure if this
> could affect the result.

Patch to fix that has been posted on the -hackers thread:
https://www.postgresql.org/message-id/04d78603-edae-9243-9dde-fe3037176a7d%402ndquadrant.com

-- 

Amit Langote
EnterpriseDB: http://www.enterprisedb.com