Re: Failed Assert in pgstat_assoc_relation

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-12-02 04:46:35
Message-ID: 20221202044635.xmart6puax5bige5@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-11-28 16:33:20 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > 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.
>
> Ugh. I don't know what pgstat_unlink_relation does, but assuming
> that it can never throw an error seems like a pretty bad idea,

I don't think it'd be an issue - it just resets the pointer from a pgstat
entry to the relcache entry.

But you're right:

> Can't that part be done outside the critical section?

we can do that. See the attached.

Do we have any cases of relcache entries changing their relkind?

Greetings,

Andres Freund

Attachment Content-Type Size
relcache_assoc_v2.diff text/x-diff 4.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-12-02 05:02:54 Re: [PATCH] Add native windows on arm64 support
Previous Message Andres Freund 2022-12-02 03:23:28 Re: Failed Assert while pgstat_unlink_relation