public inbox for [email protected]
help / color / mirror / Atom feedFrom: Chao Li <[email protected]>
To: Robert Haas <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Thomas Munro <[email protected]>
Subject: Re: dshash_find_or_insert vs. OOM
Date: Thu, 19 Mar 2026 08:08:26 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+TgmoYc1PG27ySdjX+fv85-iXA-qNj-AybxQAE7kseKv+qdLQ@mail.gmail.com>
References: <CA+TgmoaJwUukUZGu7_yL74oMTQQz2=zqucMhF9+9xBmSC5us1w@mail.gmail.com>
<[email protected]>
<CA+TgmoYc1PG27ySdjX+fv85-iXA-qNj-AybxQAE7kseKv+qdLQ@mail.gmail.com>
> On Mar 19, 2026, at 01:46, Robert Haas <[email protected]> wrote:
>
> On Tue, Mar 17, 2026 at 9:34 PM Chao Li <[email protected]> wrote:
>> When OOM happens, Assert((flags & DSHASH_INSERT_NO_OOM) != 0); makes sense. But for resize(), the assert is inside resize(), while for insert_into_bucket(), the assert is in the caller. That feels a bit inconsistent to me, and I think it hurts readability a little. A reader might wonder why there is no corresponding assert after resize() unless they go read the function body.
>
> Adjusted.
>
>> Making this a nested block does have the benefit of keeping dsa_flags close to where it is used. But from my impression, this style is still fairly uncommon in the codebase. I worry it may implicitly signal to other hackers that this is an acceptable pattern. So unless we intentionally want to encourage that style, I would lean toward avoiding it here.
>
> Yeah, that was dumb. Fixed.
>
> Thanks for the review; here's v2.
>
> --
> Robert Haas
> EDB: http://www.enterprisedb.com
> <v2-0001-dshash-Make-it-possible-to-suppress-out-of-memory.patch>
Thanks for updating the patch. V2 LGTM.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
view thread (15+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: dshash_find_or_insert vs. OOM
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox