Re: row filtering for logical replication

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, "Amit Kapila" <amit(dot)kapila16(at)gmail(dot)com>
Cc: "Ajin Cherian" <itsajin(at)gmail(dot)com>, "Greg Nancarrow" <gregn4422(at)gmail(dot)com>, "vignesh C" <vignesh21(at)gmail(dot)com>, "Peter Smith" <smithpb2250(at)gmail(dot)com>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, "Dilip Kumar" <dilipbalaut(at)gmail(dot)com>, "Rahila Syed" <rahilasyed90(at)gmail(dot)com>, "Peter Eisentraut" <peter(dot)eisentraut(at)enterprisedb(dot)com>, Önder Kalacı <onderkalaci(at)gmail(dot)com>, japin <japinli(at)hotmail(dot)com>, "Michael Paquier" <michael(at)paquier(dot)xyz>, "David Steele" <david(at)pgmasters(dot)net>, "Craig Ringer" <craig(at)2ndquadrant(dot)com>, "Amit Langote" <amitlangote09(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: row filtering for logical replication
Date: 2021-12-20 18:57:45
Message-ID: 6b6cf26d-bf74-4b39-bb07-c067e381d66d@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 20, 2021, at 12:10 AM, houzj(dot)fnst(at)fujitsu(dot)com wrote:
> Attach the V49 patch set, which addressed all the above comments on the 0002
> patch.
I've been testing the latest versions of this patch set. I'm attaching a new
patch set based on v49. The suggested fixes are in separate patches after the
current one so it is easier to integrate them into the related patch. The
majority of these changes explains some decision to improve readability IMO.

row-filter x row filter. I'm not a native speaker but "row filter" is widely
used in similar contexts so I suggest to use it. (I didn't adjust the commit
messages)

An ancient patch use the term coerce but it was changed to cast. Coercion
implies an implicit conversion [1]. If you look at a few lines above you will
see that this expression expects an implicit conversion.

I modified the query to obtain the row filter expressions to (i) add the schema
pg_catalog to some objects and (ii) use NOT EXISTS instead of subquery (it
reads better IMO).

A detail message requires you to capitalize the first word of sentences and
includes a period at the end.

It seems all server messages and documentation use the terminology "WHERE
clause". Let's adopt it instead of "row filter".

I reviewed 0003. It uses TupleTableSlot instead of HeapTuple. I probably missed
the explanation but it requires more changes (logicalrep_write_tuple and 3 new
entries into RelationSyncEntry). I replaced this patch with a slightly
different one (0005 in this patch set) that uses HeapTuple instead. I didn't
only simple tests and it requires tests. I noticed that this patch does not
include a test to cover the case where TOASTed values are not included in the
new tuple. We should probably add one.

I agree with Amit that it is a good idea to merge 0001, 0002, and 0005. I would
probably merge 0004 because it is just isolated changes.

[1] https://en.wikipedia.org/wiki/Type_conversion

--
Euler Taveira
EDB https://www.enterprisedb.com/

Attachment Content-Type Size
v50-0001-Row-filter-for-logical-replication.patch text/x-patch 91.2 KB
v50-0002-fixes-0001.patch text/x-patch 10.9 KB
v50-0003-Row-filter-validation.patch text/x-patch 62.7 KB
v50-0004-fixes-0002.patch text/x-patch 8.6 KB
v50-0005-UPDATEs-might-require-transformation.patch text/x-patch 16.4 KB
v50-0006-Row-filter-tab-auto-complete-and-pgdump.patch text/x-patch 5.6 KB
v50-0007-Row-filter-handle-FOR-ALL-TABLES.patch text/x-patch 14.1 KB
v50-0008-fixes-0005.patch text/x-patch 6.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2021-12-20 19:05:47 Re: Add index scan progress to pg_stat_progress_vacuum
Previous Message Robert Haas 2021-12-20 18:50:37 Re: sqlsmith: ERROR: XX000: bogus varno: 2