RE: Selectively invalidate caches in pgoutput module
От
Zhijie Hou (Fujitsu)
Тема
RE: Selectively invalidate caches in pgoutput module
Дата
Msg-id
OS3PR01MB5718B8EFFBB856C8B5749E8B94D62@OS3PR01MB5718.jpnprd01.prod.outlook.com
Ответ на
RE: Selectively invalidate caches in pgoutput module (Hayato Kuroda (Fujitsu))
Список
Дерево обсуждения
Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Zharkov Roman <r.zharkov@postgrespro.ru>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
RE: Selectively invalidate caches in pgoutput module "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
RE: Selectively invalidate caches in pgoutput module "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
RE: Selectively invalidate caches in pgoutput module "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
Re: Selectively invalidate caches in pgoutput module Andres Freund <andres@anarazel.de>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Re: Selectively invalidate caches in pgoutput module Amit Kapila <amit.kapila16@gmail.com>
RE: Selectively invalidate caches in pgoutput module "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
On Monday, March 10, 2025 7:00 PM Kuroda, Hayato wrote:
>
> I did a self-reviewing and updated a patch. PSA new version. What's new:
Thanks for updating the patch.
I tested the behavior for partitioned table and have a comment on this.
> + relids = GetPublicationRelations(pubform->oid,
> + PUBLICATION_PART_LEAF);
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.
For example[1], if the parent table's relsync entry is not invalidated after a
RENAME operation, it results in the TRUNCATE to be missed. So I think we should
Invalidate all the tables in the partition tree by passing
PUBLICATION_PART_ALL, which is also consistent with ALTER PUB ADD/SET/DROP
TABLE.
[1]--- Example ---
create table test(a int primary key) PARTITION BY RANGE (a);
CREATE TABLE test_1 PARTITION OF test
FOR VALUES FROM (0) TO (2);
CREATE TABLE test_2 PARTITION OF test
FOR VALUES FROM (2) TO (4);
CREATE PUBLICATION pub;
CREATE PUBLICATION pub2 FOR TABLE test WITH (PUBLISH_VIA_PARTITION_ROOT);
SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'pgoutput');
TRUNCATE test;
ALTER PUBLICATION pub RENAME TO pub3;
ALTER PUBLICATION pub2 RENAME TO pub;
TRUNCATE test;
-- I can consume some changes using the following function on HEAD, but got
-- nothing after applying the patch.
SELECT * FROM pg_logical_slot_get_binary_changes('isolation_slot', NULL, NULL, 'proto_version', '4', 'publication_names', 'pub', 'streaming', 'on');
---
Best Regards,
Hou zj
В списке pgsql-hackers по дате отправления
От: Ilia Evdokimov
Дата:
От: Álvaro Herrera
Дата: