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 1ssVPo-008rPy-SI for pgsql-hackers@arkaria.postgresql.org; Sun, 22 Sep 2024 22:50:53 +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 1ssVPo-00Dktq-4W for pgsql-hackers@arkaria.postgresql.org; Sun, 22 Sep 2024 22:50:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssVPn-00Dktg-7I for pgsql-hackers@lists.postgresql.org; Sun, 22 Sep 2024 22:50:51 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssVPk-000Y0f-2w for pgsql-hackers@lists.postgresql.org; Sun, 22 Sep 2024 22:50:49 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id C2F1060003; Sun, 22 Sep 2024 22:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1727045444; 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=dwQyxMtg4M3ci35yBo/xKjhCQzLnlCntE47HW7vFxQw=; b=VuswKU+6z02GEWzzMR7CyOH7Sl4e7EcIv9oq7/XW7M6tXQLk1DPE5SwAvy9mRyPE/XH6pg G+AEtaz5g33k6ESEY9Uaxo3aNEz4iSJFhAEAxrifXvJtpLMhh4DaxlcAzK7JoTy3Gyieal FnmpUgrCURWK9PpyASYw13IkaTeOCy/MpJ/8l6IQBzvyW9FrTAepkHBeaEsgxuhfCjlrXx nG7zqg8avuS2oRJUX27m+oZqsyy0v1POEkMfz7vGEQaR0yQKtEQGF9bn7PwRW5MmHO4OMi eFIa3UwQS6aK/g8C5Js7W68fzXQbyNgTMWtGD6pGoVVT5iGGobC9FkAtD/GlIQ== Message-ID: <5a5be673-4102-4c52-b504-1b205d5b7f83@vondra.me> Date: Mon, 23 Sep 2024 00:50:41 +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> <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> Content-Language: en-US From: Tomas Vondra In-Reply-To: <2891628.1727019959@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/22/24 17:45, Tom Lane wrote: > Tomas Vondra writes: >> I've finally pushed this, after many rounds of careful testing to ensure >> no regressions, and polishing. > > Coverity is not terribly happy with this. "Assert(fpPtr = fpEndPtr);" > is very clearly not doing what you presumably intended. The others > look like overaggressive assertion checking. If you don't want those > macros to assume that the argument is unsigned, you could force the > issue, say with > > #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)) > Ah, you're right. I'll fix those asserts tomorrow. The first is clearly wrong, of course. 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. regards -- Tomas Vondra