Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUE03-00016O-J9 for pgsql-committers@arkaria.postgresql.org; Thu, 30 Apr 2020 18:33:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jUE01-0006bs-7P for pgsql-committers@arkaria.postgresql.org; Thu, 30 Apr 2020 18:33:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUE00-0006bl-7r for pgsql-committers@lists.postgresql.org; Thu, 30 Apr 2020 18:33:29 +0000 Received: from wforward4-smtp.messagingengine.com ([64.147.123.34]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUDzx-0008Af-2j for pgsql-committers@lists.postgresql.org; Thu, 30 Apr 2020 18:33:27 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id 0F49C3C1; Thu, 30 Apr 2020 14:33:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 30 Apr 2020 14:33:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=f6N10/xwIKtYuq19IcsfQwazHf2rVfDabbSGVGJLo KE=; b=tt+k+fX795IMTmGkmSy25z/7YckvZE0QmUml+gdzTgiHP71tlqRj+S8YY /A4ksRJbUmwkMevcbQMZBpjRAQz4QCvhtpvefSwC4uyV7IWYTMS2E13rW+d1Nsmr pGpjneFJat1c84GyojLQlaciHmxPmamecJi5f7XqnQ+k06u3u7byGiBPGbIhlSrI 7n286ph6pqd/2ixwJWs5+w43gayKb0blS7KC3U3xTztU9JBt4dtjkuezNwNakXAD 5+Xriesg0QcZA2l6Cu2ji7PgKUAAJu3DkCqgQpI8GTXJ/lVX8r7ZkJpk7SaNRA1d 1TlDz/JY9F34lGgZ6ndr7aCVeGTbw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrieehgdduvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhohfkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnug hquhgrughrrghnthdrtghomheqnecuggftrfgrthhtvghrnheptdevgeehtdejvdevvdel jeeuveejjedtleelgfekleefieekjeelgfektdduuedvnecuffhomhgrihhnpedvnhguqh hurggurhgrnhhtrdgtohhmnecukfhppeelfedrvdegfedriedrvdegudenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvg hnthhrrghuthesvdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p5df306f1.dip0.t-ipconnect.de [93.243.6.241]) by mail.messagingengine.com (Postfix) with ESMTPA id 365503280064; Thu, 30 Apr 2020 14:33:21 -0400 (EDT) Subject: Re: pgsql: Add deduplication to nbtree. To: Peter Geoghegan , pgsql-committers@lists.postgresql.org References: From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <21800dbe-a13e-22f7-d423-b81db9d249f5@2ndquadrant.com> Date: Thu, 30 Apr 2020 20:33:19 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-02-26 22:06, Peter Geoghegan wrote: > Add deduplication to nbtree. AddressSanitizer has a use-after-scope complaint related to this patch. The following change fixes it: diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index a70b64d964..8246ab4f18 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -1289,6 +1289,7 @@ _bt_insertonpg(Relation rel, xl_btree_metadata xlmeta; uint8 xlinfo; XLogRecPtr recptr; + uint16 upostingoff; xlrec.offnum = newitemoff; @@ -1354,7 +1355,7 @@ _bt_insertonpg(Relation rel, * must reconstruct final itup (as well as nposting) using * _bt_swap_posting(). */ - uint16 upostingoff = postingoff; + upostingoff = postingoff; XLogRegisterBufData(0, (char *) &upostingoff, sizeof(uint16)); XLogRegisterBufData(0, (char *) origitup, Please check. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services