Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jIgd3-0001YC-Li for pgsql-committers@arkaria.postgresql.org; Sun, 29 Mar 2020 22:42:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jIgd1-0003sV-Qe for pgsql-committers@arkaria.postgresql.org; Sun, 29 Mar 2020 22:42:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIgd1-0003sO-L3 for pgsql-committers@lists.postgresql.org; Sun, 29 Mar 2020 22:42:03 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIgcu-0007lP-EQ for pgsql-committers@lists.postgresql.org; Sun, 29 Mar 2020 22:42:03 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id E370948A; Sun, 29 Mar 2020 18:41:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 29 Mar 2020 18:41:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=hdSt6sa1TyH9HHTpSzQ+nMsOaMh qO0JT4md6qUmz+0w=; b=Xl2tBf5AS/dPIXdQEftZYiJ4yHptMafI+/NkG7XwfLp REywdrgokKYUtiisupLDpMSZd2Su7GsOnT3guQVZqjFsXWutHGnQo0Gn9jFgpidB /+YbB2cOvkYY0z1N0rXXwrc+2cNpa0U029wutvHh9GWFgttM9LVggIuRmCulsXRv 5QCwuA7tQdIdYTHCERLxRDuHilj66zSJYUHPwlsw9ChrV+8mlYYnug+IqzEmRDcF NfPKrScF7ifI1jmHH23IuzYkzdudJo/u0W7FZfCo1BEQ/rDYcF3mvRn+hFqmMS6x 9G/XVatDDY8ZzpqJiZVtzK4bi8m0iG52mThvBrfew5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=hdSt6s a1TyH9HHTpSzQ+nMsOaMhqO0JT4md6qUmz+0w=; b=K1jrOK6Ql4RWaQAYguBETo ZxmfB/W7giFUCx7q36c9Ze+dN1h4PwFB+U4UJEXDYKovlMkTlccyBYc7mKr1kxKB H05pdj/ImcM1Ff8pCTzx2zIMkq9ojK1Vv0rPG7eGVBeUESL5SuKjXNTJNPj/pn7n mH+Vfbw8hYBOu0KChi/z1is2slEHbdl3ipKAsMhgtehjf6XK+TMhvn/XY6kOsbLv nHOhN5yglX0WCYyA7OEA1KnRUiPXfFzQl6KSxaiyUjxW1Kjuq5wNe+kfe62JdkRJ +nq6A91fno3WdeFTIa0fZ0c6UXSL4gZxVPl8z9Y/lZTmgfFGXM9kZ5UnViG+TOoQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudeigedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucfkphepie ejrdduiedtrddvudejrddvhedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id B80893280060; Sun, 29 Mar 2020 18:41:51 -0400 (EDT) Date: Sun, 29 Mar 2020 15:41:50 -0700 From: Andres Freund To: Peter Geoghegan Cc: Tom Lane , pgsql-committers Subject: Re: pgsql: Add deduplication to nbtree. Message-ID: <20200329224150.p2kmwqzmrdsej7iw@alap3.anarazel.de> References: <27003.1583087095@sss.pgh.pa.us> <29676.1583090977@sss.pgh.pa.us> <5838.1583100843@sss.pgh.pa.us> <20200329221544.w2ihd7u3qdztnbr2@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2020-03-29 15:19:50 -0700, Peter Geoghegan wrote: > On Sun, Mar 29, 2020 at 3:15 PM Andres Freund wrote: > > Is it perhaps possible to silence the warnign with somethign along the > > lines of > > Assert(nhtids + vacposting->ndeletedtids == BTreeTupleGetNPosting(origtuple)) > > I don't know this code, but it looks like that'd have to be true? > > Perhaps that'd be enough to silence coverity too? > > It would have to be true. It's a tautology. That is, the value of > nhtids comes from "vacposting->ndeletedtids" and > "BTreeTupleGetNPosting(origtuple)" anyway, and we don't mutate any of > that state in _bt_update_posting(). Right. It doesn't look like coverity understands that currently though. > Wouldn't it at least be necessary to Assert() something about the > final tuple, and/or other work state? I don't see why? The assert might not help, but if it does, I don't think it'd need more than that check? It depends a bit on what coverity's precise logic here is. If its ARRAY_VS_SINGLETON checker allows index (i.e. ui) 0 but not 1, then I think the suggested assert could help it recognize that that's unreachable. After staring more at the coverity trace, it looks however like ARRAY_VS_SINGLETON might not allow any array like access, not even 0? Seems like it assumes that BTreeTupleGetNPosting(origtuple) is at least two, and that in the first loop d < vacposting->ndeletedtids and vacposting->deletetids[d] == i are true, but in the second iteration assumes d < vacposting->ndeletedtids is true but vacposting->deletetids[d] == i. Since it doesn't record a third iteration, it seems like it ought to see ui == 0 at that point. I'll mark it as ignored. Greetings, Andres Freund