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 1vV5Ic-00DE2Q-0g for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 09:55:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vV5Ia-00H8dO-2p for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 09:55:25 +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 1vV5Ia-00H8dB-1U for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 09:55:25 +0000 Received: from lahtoruutu.iki.fi ([185.185.170.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vV5IY-000q3W-0f for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 09:55:24 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4dVFmN3gyDz49Q7J; Mon, 15 Dec 2025 11:55:16 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1765792517; 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=/MgOn7wNhI+NmrpVlmxH5GzeZbhzpW2oD5Nueug9nL0=; b=b/jCG4O1hNviWbFmHB2TePiC04gD16Z26+54FKRAcddFE7Se7fCyLPL960BwTsNmCE7pfG WJUM5S5XBijh3cIkLuC0LyUWiWVE6XHKS4dU/sq9isczwLEUDzAW9t731SDQqJROxgIF0+ XWTbTZAD8QnEA3UsZP25P8OuBo/c/YePC5OzGOm4Ub7EmvHNNP08iVctC3tnxXQPtWJsI7 0COyggt36IH4Tg+nbetFFWg9BOsWgp/1LIUq2BIItvVHyr8XAPRMhJupff9Ff7//YGvs9U YTcKDqyilrieaaWa9tFKhYep3UuoUPwcldj+LqyrGTIs7/4siW4MRZzhPs3gvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1765792517; 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=/MgOn7wNhI+NmrpVlmxH5GzeZbhzpW2oD5Nueug9nL0=; b=reOxAM1N0/kRY9OBf+EuiKDuZarg6FSLQB7FY5Ip+CEfx8Ix3eOzB4f++nEV4PkgptaPg1 flCbUTxP+QPjCO4/KEaVfOJwDuFNJLaOCHPqWi9qJCfmhdIy/Vg6LzsZqrNMxKiELozA/m 7w8WQlaGDVbEaUSh9yyadlYpZ9yC+mUPMZsHgzN88srEYGVKMqaMYIIgJYmGVFRoi+gD7V hl7fmMsguT6wyfZbrWjasnBe8RuRP513O+Ep3oVsVl5laQa4qLubO4wi8lsiCq7Nvwt422 9kVL/t25W/vfXbE5/dJCP+P+ZJTAQQjIqNn0hjIk2WL+7LtdCr8c7VlzMHcSWQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1765792517; b=lqTjJm/vrPAHSbIgqs9lpvKsEevdfi6lqEPODbNjD1Ec1et4S28eYwMbu0HP9avB89sO6I tzRtx3GnsaJaC/iCBhT4WMzoTyaaz02A3irHoYdc5zwJakN+3awTTCUqXWVGKLGyoCDK01 ubHLAAo9mQSHJWyEYY1NMW0vktA7+HgS4XqqodPcKxam5AIRwiDBs2LVEeZo5ml/OHEbee 7c6ZS3ixU1kYhiels6cHMaXhmHwRMqkmw6vHuyTARWNI7RoxmLxZqtIfW+BaRyUBOQ5LZY Vz/hqsJcpcOE52tqguKrJn/VN8D8K3VVydpUoS/AZOsyC5rtsOWWR6dI+sJTqA== Message-ID: <7b505284-c6e9-4c80-a7ee-816493170abc@iki.fi> Date: Mon, 15 Dec 2025 11:55:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: POC: make mxidoff 64 bits To: Tom Lane Cc: Alvaro Herrera , Ashutosh Bapat , Maxim Orlov , Alexander Korotkov , wenhui qiu , Postgres hackers References: <202512110804.hmukvd7jna34@alvherre.pgsql> <2d9282d3-7f24-4e1c-af5f-cd33316dead7@iki.fi> <1827755.1765752936@sss.pgh.pa.us> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: <1827755.1765752936@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 15/12/2025 00:55, Tom Lane wrote: > Heikki Linnakangas writes: >> Ok, I have pushed this. Thanks! > > Coverity is unhappy about this bit: > > /srv/coverity/git/pgsql-git/postgresql/src/bin/pg_upgrade/multixact_read_v18.c: 282 in GetOldMultiXactIdSingleMember() > 276 if (!TransactionIdIsValid(*xactptr)) > 277 { > 278 /* > 279 * Corner case 2: we are looking at unused slot zero > 280 */ > 281 if (offset == 0) >>>> CID 1676077: Control flow issues (DEADCODE) >>>> Execution cannot reach this statement: "continue;". > 282 continue; > 283 > 284 /* > 285 * Otherwise this is an invalid entry that should not be > > It sees the earlier test for offset == 0, and evidently is assuming > that the loop's "offset++" will not wrap around. Now I think that > the point of this check is exactly that "offset++" could have wrapped > around, but the commentary is not so clear that I'm certain this is a > false positive. Correct. > If that is the intention, what do you think of rephrasing this > comment as "we have wrapped around to unused slot zero"? Ah yes, that's much better. Changed it to "offset must have wrapped around to unused slot zero". This code and its comments are copied from v18 GetMultiXactIdMembers(), so in order to maintain the rhyme with that, I changed the comment in backbranches too. It doesn't exist in the 'master' version of GetMultiXactIdMembers() anymore. Coverity is also complaining about the 'length' variable being tainted, because it's calculated from the values read from disk. That's bogus because we trust and make assumptions of the values on disk. That said, I think it would make sense to do some more sanity checking here. In particular, length should never be negative. I added such sanity checks to the 'master' version of the GetMultiXactIdMembers() server function in commit d4b7bde418, but it would make sense to add them to the upgrade code too. I'll look into that. - Heikki