Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w30wp-000ois-0j for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 00:09:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w30wm-00FYno-0o for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 00:09:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w30wl-00FYnf-37 for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 00:09:07 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w30wj-0000000122j-0jjb for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 00:09:07 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-35a1cc6e478so319774a91.0 for ; Wed, 18 Mar 2026 17:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773878943; x=1774483743; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Y//rwiq+8yLSTPb5cKmMQVr/vYeroX/VU0n4X9W0bzo=; b=aUphW2lfrNbM2aDg4el5ApsLSRz6j7sA0T30I4uWwookVhBvKqIOBvs0iRZW7vnpKR l3Wzqy1eYCN91Vo3rj0d0P9mp78CSqIbtS/LUoFWsqBUaB1K6uNNb7iMmPy6YBhw8BQj 0zfl5dNxIWtaEe534UkS2tu5FM2ZU4LwtTxhTCbfvkQGyynj/saoA5cBOIPAmrD6p6N3 uVnc/m+OswzoUs2PCc4W7gVlnDzZCWz02MPwzLtp2216SGnP+C/JEzfE+1oUB5UC1IvB AMRwVQpnqmZlYUFznJ+npO1GucSHKj18W0lCoINPil+4QXwA33XvUjcZjWE07ULRxTGb vHlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773878943; x=1774483743; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Y//rwiq+8yLSTPb5cKmMQVr/vYeroX/VU0n4X9W0bzo=; b=EWeaJ/i2jPcpOi68O0VASfNTD6P/gnznTNFAUWUVjBPJGxL+q4vXZaWvSXqvPNXU9e ejnLUW3dIqCED3tuI8D+nAJRbeX2VRIm2xDjD7OLjGPR1cx5reqH6E44PNOslulGrFmt j6uYhbLBQ9EAEq/i0/v951+X33e/jTKzhmCMkJKr5nNJscO1bzGBBoltAnTc9XPcTNh2 HCI6f6GmFUMa9YtiqF2apZtGFbD9PR5WtiOc59Fu1AnSwEyBLfSgieOPRN2vCKAdJ3lV YW1RKvTfmQ1eyNwQXOaCBAdwNRMxn2Iu45PTSLZQ34SwcYmXY/1Ex+ZjAUWxZv66wBKE fyVQ== X-Gm-Message-State: AOJu0YxWWpTWGCuOjXs8Af6RHUlaJW4Pq6X9BnU5D+EdfrichRgzEshC HdfRFsR3zHlodxMUQ4gmp5OZNdYvfu/3WrUboInoiQCBGAfjB/6DbcBY X-Gm-Gg: ATEYQzzW+dKnd24KZ8p48RmfX43ubvvrExCFWWU0c9uheDIK6fTCfminGMByGaxPB4y vcEtrWCZoFh+gM1jEMRZjS1689RObDN+XdCKlRIeF0/J41uaYZTa2Eej9EfQJqCzYkUphcqhQuo mc9au/6z5KgbjL8XzWR9jPEul4LojuBZDG3wAe2hC+srH0vJIEHCTBdrUnyteFpKfpbdU27gH/4 wGou1BfXfsX1/ZCEYIM56cofbTADvz4o2R/QarUR2XDURvpUY1u9UEHtYoavNKQz9biXAqhp74i lG8y3+jUwrIcNsK8KgUSPVkX/BG4zQGAnNc71Uryzb+Vl1FvpO1Po0X+UEp4fZD+SHPYnW1cInY XOzhOsPN3PuLV7Ir0C1Owr4m2Gygs8wZcfNQcNI7kgdSmt6xB6i+hoWxSVf327JgL4pO9/OaDnI j5v9pF2Izqn3xR42OB9ihnXudNgGhpCw== X-Received: by 2002:a17:90b:2687:b0:35b:90e7:c451 with SMTP id 98e67ed59e1d1-35bb9e8cfa7mr4308419a91.3.1773878942965; Wed, 18 Mar 2026 17:09:02 -0700 (PDT) Received: from smtpclient.apple ([203.10.98.27]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35bc62f8e55sm906062a91.9.2026.03.18.17.08.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2026 17:09:02 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: dshash_find_or_insert vs. OOM From: Chao Li In-Reply-To: Date: Thu, 19 Mar 2026 08:08:26 +0800 Cc: PostgreSQL Hackers , Andres Freund , Thomas Munro Content-Transfer-Encoding: quoted-printable Message-Id: <8170A3AF-C066-4963-B7B4-A3E7CCBCC3FE@gmail.com> References: <11E4DBC2-7DE2-4CD9-8D64-EA30B2937193@gmail.com> To: Robert Haas X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Mar 19, 2026, at 01:46, Robert Haas wrote: >=20 > On Tue, Mar 17, 2026 at 9:34=E2=80=AFPM Chao Li = wrote: >> When OOM happens, Assert((flags & DSHASH_INSERT_NO_OOM) !=3D 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. >=20 > Adjusted. >=20 >> 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. >=20 > Yeah, that was dumb. Fixed. >=20 > Thanks for the review; here's v2. >=20 > --=20 > Robert Haas > EDB: http://www.enterprisedb.com > Thanks for updating the patch. V2 LGTM. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/