| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | 'Cagri Biroglu' <cagri(dot)biroglu(at)adyen(dot)com>, Ajin Cherian <itsajin(at)gmail(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-09-07 08:53:14 |
| Message-ID: | OS9PR01MB121492948EFFF7E44CCDA3C3FF5B22@OS9PR01MB12149.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Dear Cagri,
Thanks for the patch. I have comments for v7.
```
+ /*
+ * The relation set is now known to be fed by this subscription alone, and
+ * this subscription has no running workers, so nothing that replicates
+ * into these relations is still holding them. Take the level the
+ * truncate needs.
+ */
+ foreach_oid(relid, relids)
+ LockRelationOid(relid, AccessExclusiveLock);
```
Here we does not acquire a lock for the root table if the publication publishes
only leaves. So subscriptions can be created after
CheckRefreshTableNotInOtherSubscriptions(). I considered a race condition due to
this with LLM: See attached patch.
Also, I found the test could fail like:
```
[14:44:37.892](0.014s) not ok 35 - only the named inheritance parent is reset
[14:44:37.893](0.000s) # Failed test 'only the named inheritance parent is reset'
# at /home/hayato/postgres/src/test/subscription/t/039_refresh_table.pl line 407.
[14:44:37.893](0.000s) # got: 'tab_inh_c=s,tab_inh_p=i'
# expected: 'tab_inh_c=r,tab_inh_p=i'
```
It tried to ensure the tab_inh_c was synchronized, right? Should accept 's'
Best regards,
Hayato Kuroda
FUJITSU LIMITED
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Reproducer-race-condition-with-CREATE-SUBSCRIPTION.patch | application/octet-stream | 6.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hannu Krosing | 2026-09-07 08:54:07 | Re: Direct TOAST v2, faster, smaller and no migration needed |
| Previous Message | xiaoyu liu | 2026-09-07 08:51:30 | Re: unnecessary executor overheads around seqscans |