| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | 'Cagri Biroglu' <cagri(dot)biroglu(at)adyen(dot)com> |
| Cc: | "smithpb2250(at)gmail(dot)com" <smithpb2250(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
| Subject: | RE: Per-table resync for logical replication subscriptions |
| Date: | 2026-08-14 09:18:29 |
| Message-ID: | OS9PR01MB12149755F3AEDBE9DB7766B34F5DA2@OS9PR01MB12149.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Dear Cagri,
Thanks for updating the patch. I read and tested your patch. Here are my comments.
01.
According to the REFRESH PUBLICATION command, we must prohibit to synchronize
tables if the two_phase is enabled, but REFRESH TABLE seems to bypass the restriction.
Also, if there are prepared transactions done by the subscription and they modify
target relations, the command would stuck forever - the apply worker won't start
again. So should we have the same guard as the REFRESH PUBLICATION?
02.
You have already checked the case the existence of tablesync workers, but
not for the leader worker. I feel we should ensure via logicalrep_workers_find()
like ALTER SUBSCRIPTION SET (two_phase). Also, we can remove the part from
AlterSubscription_refresh_table().
03.
Regarding the partition table, I found the case that TRUNCATE happened but
srsubstate cannot be updated. It's because ExecuteTruncate() truncates tables all
child tables but AlterSubscription_refresh_table() updates tuples relid is
exactly matched. Per my experiment, this can cause the issue if the different publications
publish the root and child separately, and they are subscribed by the different subscription.
See attached reproducer.
Best regards,
Hayato Kuroda
FUJITSU LIMITED
| Attachment | Content-Type | Size |
|---|---|---|
| repro.txt | text/plain | 3.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Etsuro Fujita | 2026-08-14 09:59:00 | Re: use of SPI by postgresImportForeignStatistics |
| Previous Message | JiaoShuntian | 2026-08-14 07:19:54 | Re: PSQL schema "describe" \dn is not escaping quotes |