| From: | Gyorgy Bolyki <bolyki(at)bolyki(dot)eu> |
|---|---|
| To: | Ajin Cherian <itsajin(at)gmail(dot)com> |
| Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Logical replication: replicated TRUNCATE crash-loops a subscriber with a foreign partition lacking TRUNCATE support |
| Date: | 2026-12-03 07:50:38 |
| Message-ID: | CADaX-_bK7uTrAkCPp0UOEcp5u=JLf-SrPuGnR6ugV-xacjELrw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi Ajin,
Thanks for reproducing it and for the review. v2 is attached, made
with git format-patch on master f68727292ae2.
On Thu, 3 Dec 2026 at 04:15, Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
> 1. [...] make truncate_check_rel() extern and call it with
> rel->rd_rel for both the top-level relation and each partition
Done. I checked what else it changes for the apply worker: the relkind
and system catalog checks reject nothing a PostgreSQL publisher can
send, as CheckSubscriptionTargetRel() runs first, so the only other
change is that InvokeObjectTruncateHook() now fires. I did not add
truncate_check_perms() (TargetPrivilegesCheck() covers it) or
truncate_check_activity() (a behaviour change this fix does not need).
> 2. [...] replacing the Assert in ExecuteTruncateGuts() [...]
Done. With that hunk alone, on a build without assertions, the apply
worker reports the elog and nothing crashes.
> 3. [...] probably worth a separate discussion
Agreed, that is a separate question. v2 leaves that behaviour as it
is and the commit message says so.
> 4. [...] wait_for_log
> 5. [...] adding the test case to the existing 013_partition.pl
Done. The case is at the end of 013_partition.pl, on its publisher and
subscriber2, with wait_for_log() and no loop. It then detaches the
foreign partition and waits for catch-up, so the subscription works
again. EXTRA_INSTALL gets contrib/file_fdw; meson needs no change.
Tested on Ubuntu 24.04 x86_64, gcc 13.3, --enable-cassert. On master
the new case fails without the code change and passes with it, as do
the subscription suite, make check and the file_fdw and postgres_fdw
checks. The patch applies to REL_19 as is and to REL_18 and REL_17
with git am -3; REL_16 and REL_15 need trivial context changes and are
attached as .txt. The subscription suite passes on all five.
I will add the patch to the next commitfest as soon as my new community
account is past its cool-off period.
Regards,
György Bolyki
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Fix-apply-worker-crash-on-TRUNCATE-of-table-with-REL_16.patch.txt | text/plain | 9.3 KB |
| v2-0001-Fix-apply-worker-crash-on-TRUNCATE-of-table-with-.patch | application/x-patch | 9.4 KB |
| v2-0001-Fix-apply-worker-crash-on-TRUNCATE-of-table-with-REL_15.patch.txt | text/plain | 9.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PG Bug reporting form | 2026-12-03 08:23:02 | BUG #19975: ALTER SUBSCRIPTION ... SET (slot_name, failover) updates the old slot |
| Previous Message | Ishjaap Singh | 2026-12-03 07:26:06 | Re: BUG #19958: jsonpath: a word directly followed by a /* comment */ is silently dropped, so strict becomes lax |