RE: Selectively invalidate caches in pgoutput module

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: "ShlokKumar(dot)Kyal(at)fujitsu(dot)com" <ShlokKumar(dot)Kyal(at)fujitsu(dot)com>, 'Amit Kapila' <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Selectively invalidate caches in pgoutput module
Date: 2025-03-10 13:12:00
Message-ID: OSCPR01MB14966DBBE4666C701FB8943E0F5D62@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Hou,

> Currently, only the leaf partition is invalidated when the published table is
> partitioned. However, I think pgoutput could cache both the partitioned table
> and the leaf partition table as relsync entries.
>
> For INSERT/UPDATE/DELETE on a partitioned table, only the leaf partition's
> relsync entry is used in pgoutput, but the TRUNCATE references the parent
> table's relsync entry.

I think your analysis is correct. PSA new version. Below part contains my analysis.

In ExecuteTruncate(), if the specified relation has children, all of them are
checked via find_all_inheritors() and listed as target. Also, ExecuteTruncateGuts()
serializes both a parent and children in XLOG_HEAP_TRUNCATE WAL record.
Decoding layer passes relations as-is. These facts mean that output plugins can
store caches on the memory.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
v9-0001-Introduce-a-new-invalidation-message-to-invalidat.patch application/octet-stream 10.1 KB
v9-0002-Invalidate-Relcaches-while-ALTER-PUBLICATION-RENA.patch application/octet-stream 6.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-03-10 13:27:06 Re: Changing the state of data checksums in a running cluster
Previous Message Yuki Seino 2025-03-10 13:11:17 Re: Add “FOR UPDATE NOWAIT” lock details to the log.