From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Failed Assert in pgstat_assoc_relation |
Date: | 2022-11-28 21:09:08 |
Message-ID: | 20221128210908.hyffmljjylj447nu@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2022-11-28 10:50:13 -0800, Andres Freund wrote:
> On 2022-11-28 13:37:16 -0500, Tom Lane wrote:
> > Uh-huh. I've not bothered to trace this in detail, but presumably
> > what is happening is that the first CREATE RULE converts the table
> > to a view, and then the ROLLBACK undoes that so far as the catalogs
> > are concerned, but probably doesn't undo related pg_stats state
> > changes fully. Then we're in a bad state that will cause problems.
> > (It still crashes if you replace the second CREATE RULE with
> > "select * from t".)
>
> Yea. I haven't yet fully traced through this, but presumably relcache inval
> doesn't fix this because we don't want to loose pending stats after DDL.
>
> Perhaps we need to add a rule about not swapping pgstat* in
> RelationClearRelation() when relkind changes?
Something like the attached. Still needs a bit of polish, e.g. adding the test
case from above.
I'm a bit uncomfortable adding a function call below
* Perform swapping of the relcache entry contents. Within this
* process the old entry is momentarily invalid, so there *must* be no
* possibility of CHECK_FOR_INTERRUPTS within this sequence. Do it in
* all-in-line code for safety.
but it's not the first, see MemoryContextSetParent().
Greetings,
Andres Freund
Attachment | Content-Type | Size |
---|---|---|
relcache_assoc.diff | text/x-diff | 2.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2022-11-28 21:09:28 | Re: Add 64-bit XIDs into PostgreSQL 15 |
Previous Message | Tom Lane | 2022-11-28 21:04:12 | Re: [PATCH] Infinite loop while acquiring new TOAST Oid |