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.94.2) (envelope-from ) id 1ssVfV-008tNR-B9 for pgsql-hackers@arkaria.postgresql.org; Sun, 22 Sep 2024 23:07:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ssVfT-00DyU9-8a for pgsql-hackers@arkaria.postgresql.org; Sun, 22 Sep 2024 23:07:03 +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.94.2) (envelope-from ) id 1ssVfS-00DyU1-V8 for pgsql-hackers@lists.postgresql.org; Sun, 22 Sep 2024 23:07:02 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssVfK-000Zdm-Me for pgsql-hackers@lists.postgresql.org; Sun, 22 Sep 2024 23:07:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 48MN6kEZ2942267; Sun, 22 Sep 2024 19:06:46 -0400 From: Tom Lane To: Tomas Vondra cc: Jakub Wartak , Robert Haas , PostgreSQL Hackers , Andres Freund Subject: Re: scalability bottlenecks with (many) partitions (and more) In-reply-to: <5a5be673-4102-4c52-b504-1b205d5b7f83@vondra.me> References: <510b887e-c0ce-4a0c-a17a-2c6abb8d9a5c@enterprisedb.com> <9266c8df-0df7-4605-ba5a-b204c5e52586@enterprisedb.com> <52afd566-d110-43ea-ae72-69349d4414f6@vondra.me> <52f026c4-6c4e-4de2-bd78-609091d7c772@vondra.me> <14cd8763-c905-4705-99c5-cbcc5db06f50@vondra.me> <0775ba8a-920c-4d37-b202-989a90b6ee4c@vondra.me> <0f27b64b-5bf3-4140-98b7-635e312e1796@vondra.me> <3cebb4ab-1168-4259-8cb8-8a8ed7efeb43@vondra.me> <7c1eeafb-2375-4ff6-8469-0640d52d44ed@vondra.me> <2891628.1727019959@sss.pgh.pa! .us> <5a5be673-4102-4c52-b504-1b205d5b7f83@vondra.me> Comments: In-reply-to Tomas Vondra message dated "Mon, 23 Sep 2024 00:50:41 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2942265.1727046406.1@sss.pgh.pa.us> Date: Sun, 22 Sep 2024 19:06:46 -0400 Message-ID: <2942266.1727046406@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tomas Vondra writes: > On 9/22/24 17:45, Tom Lane wrote: >> #define FAST_PATH_GROUP(index) \ >> - (AssertMacro(((index) >= 0) && ((index) < FP_LOCK_SLOTS_PER_BACKEND)), \ >> + (AssertMacro((uint32) (index) < FP_LOCK_SLOTS_PER_BACKEND), \ >> ((index) / FP_LOCK_SLOTS_PER_GROUP)) > For the (x >= 0) asserts, doing it this way relies on negative values > wrapping to large positive ones, correct? AFAIK it's guaranteed to be a > very large value, so it can't accidentally be less than the slot count. Right, any negative value would wrap to something more than INT32_MAX. regards, tom lane