pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix row filters with multiple publications
Date: Thu, 17 Mar 2022 16:05:12 +0000
Message-ID: <E1nUsch-0008rQ-FW@gemulon.postgresql.org> (raw)

Fix row filters with multiple publications

When publishing changes through a artition root, we should use the row
filter for the top-most ancestor. The relation may be added to multiple
publications, using different ancestors, and 52e4f0cd47 handled this
incorrectly. With c91f71b9dc we find the correct top-most ancestor, but
the code tried to fetch the row filter from all publications, including
those using a different ancestor etc. No row filter can be found for
such publications, which was treated as replicating all rows.

Similarly to c91f71b9dc, this seems to be a rare issue in practice. It
requires multiple publications including the same partitioned relation,
through different ancestors.

Fixed by only passing publications containing the top-most ancestor to
pgoutput_row_filter_init(), so that treating a missing row filter as
replicating all rows is correct.

Report and fix by me, test case by Hou zj. Reviews and improvements by
Amit Kapila.

Author: Tomas Vondra, Hou zj, Amit Kapila
Reviewed-by: Amit Kapila, Hou zj
Discussion: https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5a079662256e381fde699c4fbbed6c2504a6d30a

Modified Files
--------------
src/backend/replication/pgoutput/pgoutput.c | 26 +++++++++++++---
src/test/subscription/t/028_row_filter.pl   | 47 ++++++++++++++++++++++++++++-
2 files changed, 67 insertions(+), 6 deletions(-)



view thread (4+ messages)  latest in thread

Message-ID: <E1nUsch-0008rQ-FW@gemulon.postgresql.org>
Permalink:  ../E1nUsch-0008rQ-FW@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nUsch-0008rQ-FW@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Fix row filters with multiple publications
  In-Reply-To: <E1nUsch-0008rQ-FW@gemulon.postgresql.org>
  References: <E1nUsch-0008rQ-FW@gemulon.postgresql.org>

* 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