RE: row filtering for logical replication - Mailing list pgsql-hackers

From houzj.fnst@fujitsu.com
Subject RE: row filtering for logical replication
Date
Msg-id OS0PR01MB57168F454E33D53551B8D20294259@OS0PR01MB5716.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: row filtering for logical replication  (Peter Smith <smithpb2250@gmail.com>)
Responses Re: row filtering for logical replication
Re: row filtering for logical replication
Re: row filtering for logical replication
List pgsql-hackers
On Monday, January 31, 2022 8:53 AM Peter Smith <smithpb2250@gmail.com> wrote:
> 
> PSA v73*.
> 
> (A rebase was needed due to recent changes in tab-complete.c.
> Otherwise, v73* is the same as v72*).

Thanks for the rebase.
Attach the V74 patch set which did the following changes:

v74-0000
-----
This patch is borrowed from[1] to fix the cfbot failure[2].

The reason of the cfbot failure is that:
When rel_sync_cache_relation_cb does invalidate an entry, it immediately
free the cached stuff(including the slot), even though that might still be
in use. For the failed testcase, It received invalid message in
logicalrep_write_tuple when invoking "SearchSysCache1(TYPEOID," and free
the slot memory. So, it used the freed slot values to send which could
cause the unexpected result.

And this pending patch[1] fix this problem by move the memory free code
from rel_sync_cache_relation_cb to get_rel_sync_entry. So, before this
patch is committed, attach it here to make the cfbot happy.

[1] https://www.postgresql.org/message-id/CAA4eK1JACZTJqu_pzTu_2Nf-zGAsupqyfk6KBqHe9puVZGQfvw%40mail.gmail.com
[2] https://cirrus-ci.com/task/5450648090050560?logs=test_world#L3975

v74-0001
-----
- Cache the estate in RelationSyncEntry               (Andres [3])
- Move the row filter init code to get_rel_sync_entry (Andres [3])
- Remove the static label of map_changetype_pubaction (Andres [3])
- Allocate memory for newly added cached stuff under
  a separate memory context which is below ctx->context (Andres [3])
- a commit message change.                            (Greg [4])

v74-0002
-----
- Add the WHERE clause in the COMPLETE_WITH(",") line. (Alvaro [5])

[3] https://www.postgresql.org/message-id/20220129003110.6ndrrpanem5sb4ee%40alap3.anarazel.de
[4] https://www.postgresql.org/message-id/CAJcOf-d3zBMtpNwRuu23O%3DWeUz9FWBrTxeqtXUV_vyL103aW5A%40mail.gmail.com
[5] https://www.postgresql.org/message-id/202201281351.clzyf4cs6vzb%40alvherre.pgsql

Best regards,
Hou zj

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Support tab completion for upper character inputs in psql
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Is there a way (except from server logs) to know the kind of on-going/last checkpoint?