Re: DSA_ALLOC_NO_OOM vs dsm_create ERROR leaving a half-initialized pgstats hash entry

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Grigorev Jurij <ju(dot)grigorev(at)ftdata(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: DSA_ALLOC_NO_OOM vs dsm_create ERROR leaving a half-initialized pgstats hash entry
Date: 2026-09-17 07:10:35
Message-ID: aquSa2gbfVMxDYmT@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 17, 2026 at 06:19:19AM +0000, Grigorev Jurij wrote:
> The check you proposed in the follow-up [1] looks right to me. A partial
> reference at this point cannot have shared_stats or pending data, and
> pgstat_release_entry_ref() can remove it without touching shared state.
> It handles the backend-local partial reference, while this patch prevents
> the same failure from leaving an inconsistent shared hash entry. I agree
> that the two changes should remain independent, as you suggested.

My second patch is an extra defense.. I guess that we should just do
that first.

> I have prepared and build-tested versions for the supported branches
> down to REL_15_STABLE, but I am not attaching them yet so that the HEAD
> change can be reviewed first. I can send them once the shape of this
> patch is agreed.

Something that I did not consider yet is how much we should worry
about the ABI change of pgstat_init_entry().. I could see nothing in
the open that uses it, but the risk seems non-zero. Perhaps we should
just limit that on HEAD.

> Do you think this warrants a deterministic test?

Nah. That feels like a waste of test cycles for what's already a very
narrow case.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2026-09-17 07:15:15 Re: remove_useless_joins vs. bug #19560
Previous Message Peter Smith 2026-09-17 06:52:02 Re: Distinguish publication exclusions in object addresses