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 1ssgHI-00A4mA-LG for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Sep 2024 10:26:49 +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 1ssgHH-006066-CZ for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Sep 2024 10:26:47 +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 1ssgHG-00605y-VX for pgsql-hackers@lists.postgresql.org; Mon, 23 Sep 2024 10:26:47 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssgHC-000eMT-S8 for pgsql-hackers@lists.postgresql.org; Mon, 23 Sep 2024 10:26:46 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 0F21F240009; Mon, 23 Sep 2024 10:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1727087203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KlIJRXUrq83Hlq58DYyMd268WWoioXcro+V1HMnU+48=; b=I5Ddnm3dLhxd7Z7nbIVTmjwkFypM0ytDE99guaJ0R7UCs6c90tDgQ33TcKUvS7porF42mE bE3/HT1bLIA/dmJ1NzViZlyojoAOVGIZshMy9nnOcDW7PxBVhYqBlScBijX6+S2wt8P8Z/ vFDsiSI+Q3bsOMFlKylBJwQfRnSISQSZxIK35GxrNeDOKz676w8Jx82105Ybzu49kWMX3b vK3Wj6yjHwLaRqYoUgxDIxyIgijzcZ5NRSBdignwM1MrlUIGOokjSVm0k342JA8M0umjFT dYXcH4zw0G9LhoWRLYOV0LiPU3fy3XdHfZ6VM4l7ep+Y6Rw9elqeS9YXwiP9jg== Message-ID: <98229784-1ce8-4100-9236-a77f635f596b@vondra.me> Date: Mon, 23 Sep 2024 12:26:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: scalability bottlenecks with (many) partitions (and more) To: Tom Lane Cc: Jakub Wartak , Robert Haas , PostgreSQL Hackers , Andres Freund References: <510b887e-c0ce-4a0c-a17a-2c6abb8d9a5c@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> <2942266.1727046406@sss.pgh.pa.us> Content-Language: en-US From: Tomas Vondra In-Reply-To: <2942266.1727046406@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-GND-Sasl: tomas@vondra.me List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/23/24 01:06, Tom Lane wrote: > 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. > Thanks. Pushed a fix for these issues, hopefully coverity will be happy. BTW is the coverity report accessible somewhere? I know someone mentioned that in the past, but I don't recall the details. Maybe we should have a list of all these resources, useful for committers, somewhere on the wiki? regards -- Tomas Vondra