Re: Crashes on a partition whose concurrent detach never finished

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>, "ashutosh(dot)bapat(dot)oss(at)gmail(dot)com" <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, shveta malik <shvetamalik(at)gmail(dot)com>
Subject: Re: Crashes on a partition whose concurrent detach never finished
Date: 2026-11-11 07:19:20
Message-ID: CAA4eK1L=8-8NM0Ui2wttmq3fceODPAWrYLHmVLTt276KQkdFeg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 11, 2026 at 11:00 AM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> On Wed, Nov 11, 2026 at 10:51 AM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> >
> > > Sorry for not being clear. I meant the pgoutput crash.
> >
> > Yes, I reproduced the crash on PG 19 using the attached test. I
> > verified that it works on PG18.
> >
> > > IIUC while this is an existing issue, commit fd366065e06 made it
> > > worse. Before the commit, the llast_oid() call on the result of
> > > get_partition_ancestors() in get_rel_sync_entry() was reached only
> > > when publish_via_partition_root = true, but now it's reached
> > > regardless of publish_via_partition_root for FOR ALL TABLES
> > > publications. So decoding a change to a detach-pending partition
> > > crashes the walsender even with the default publish_via_partition_root
> > > = false. In other words, that case works with v18 but no longer with
> > > v19. So I think we should fix it in v19.
>
> I have attached a potential fix for Pg19. It is similar to the fix in
> 'RelationBuildPublicationDesc'. I have run a few related test-suits on
> this; I have yet to run 'make check world'.
>

I think this is mostly the same fix as v2-0001* in [1]. But the points
to consider are the fix is for both except and non-except cases, shall
we fix both if so, non-except should be ideally committed till PG-14.
Then the next question to consider is whether to fix the invalidation
problem you reported in [2]. Without the invalidation, the crash will
be fixed but probably the answer whether to replicate the partition
changes could be incorrect (this will be true for both EXCEPT and
non-EXCEPT cases).

I feel in any case the invalidation problem is not related to PG-19
code change and requires more discussion. So, we should leave that and
discuss whether to fix both EXCEPT and non-EXCEPT cases?

[1]: https://www.postgresql.org/message-id/CADzfLwU97r3QC5oZDeVcWvcvXhNy9VnoFNDVHw%2BERg_DEG4%3DFQ%40mail.gmail.com
[2]: https://www.postgresql.org/message-id/CAJpy0uA6womAP7fkmT%3DsSfKG_0CfKUSb7HhP_J9mw071MXc39w%40mail.gmail.com

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou 2026-11-11 07:35:22 Re: Crashes on a partition whose concurrent detach never finished
Previous Message Richard Guo 2026-11-11 07:08:24 Re: Wrong results with initplans moved by setrefs.c