Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eN2h0-0001mK-69 for pgsql-committers@arkaria.postgresql.org; Thu, 07 Dec 2017 20:22:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eN2gz-0002PT-PK for pgsql-committers@arkaria.postgresql.org; Thu, 07 Dec 2017 20:22:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eN2gz-0002PG-Bw; Thu, 07 Dec 2017 20:22:49 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eN2gw-0004XK-NT; Thu, 07 Dec 2017 20:22:48 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 8E29F20C99; Thu, 7 Dec 2017 15:22:45 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Thu, 07 Dec 2017 15:22:45 -0500 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-sender :x-me-sender:x-sasl-enc; s=fm1; bh=JSzf+XNYA1lS78gaBTxD5XnmBW+xP lZTdd1LbAduxiA=; b=qhPheGqVozw7N3UYFU1+Q+3nxP1jbIc8uMypVp3GPl+1V RQzGzE8xj/1o9iLlgIf0NKihy0nyHliE1mitXfZgj7cjg3tEhNm0gaaiKgeEpBfu DJWLPTrOiEaKa0Df+7vn69G0TCNi4kfONwIuZywh+Aa4p/2gVrzK/5KceOyJTEt3 rquOsY2Ro5dCnA5YTgi6smokPzN0Gs0vEotc9PJUj8JqAQCe7SE6nFqYw708foc1 L8EGsuqQNJjSZcOjtNK75RZUCuMxwEzXghsGIFCxhgkAoIZRfljB+21F0ZLlKBP8 LuCzXDQxj/XcXQl9hAtuEg2H9I3UoCXGFTpvNs4iQ== X-ME-Sender: Received: from intern.anarazel.de (unknown [172.56.42.37]) by mail.messagingengine.com (Postfix) with ESMTPA id 303197E56E; Thu, 7 Dec 2017 15:22:45 -0500 (EST) Date: Thu, 7 Dec 2017 12:22:43 -0800 From: Andres Freund To: Alvaro Herrera Cc: "Wood, Dan" , Peter Geoghegan , pgsql-committers@postgresql.org, "Wong, Yi Wen" , Michael Paquier , Robert Haas , Tom Lane , pgsql-hackers@postgresql.org Subject: Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple Message-ID: <20171207202243.pmxwjm5wvz5lp6j6@alap3.anarazel.de> References: <20171114030341.movhteyakqeqx5pm@alap3.anarazel.de> <20171206202355.byfh6g3bezy4rrcr@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171206202355.byfh6g3bezy4rrcr@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2017-12-06 17:23:55 -0300, Alvaro Herrera wrote: > > I've played around quite some with the attached patch. So far, after > > applying the second patch, neither VACUUM nor VACUUM FULL / CLUSTER make > > the situation worse for already existing corruption. HOT pruning can > > change the exact appearance of existing corruption a bit, but I don't > > think it can make the corruption meaningfully worse. It's a bit > > annoying and scary to add so many checks to backbranches but it kinda > > seems required. The error message texts aren't perfect, but these are > > "should never be hit" type elog()s so I'm not too worried about that. > > Looking at 0002: I agree with the stuff being done here. I think a > couple of these checks could be moved one block outerwards in term of > scope; I don't see any reason why the check should not apply in that > case. I didn't catch any place missing additional checks. I think I largely put them into the inner blocks because they were guaranteed to be reached in those case (the horizon has to be before the cutoff etc), and that way additional branches are avoided. > Despite these being "shouldn't happen" conditions, I think we should > turn these up all the way to ereports with an errcode and all, and also > report the XIDs being complained about. No translation required, > though. Other than those changes and minor copy editing a commit > (attached), 0002 looks good to me. Hm, I don't really care one way or another. I do see that you used errmsg() in some places, errmsg_internal() in others. Was that intentional? > I started thinking it'd be good to report block number whenever anything > happened while scanning the relation. The best way to go about this > seems to be to add an errcontext callback to lazy_scan_heap, so I attach > a WIP untested patch to add that. (I'm not proposing this for > back-patch for now, mostly because I don't have the time/energy to push > for it right now.) That seems like a good idea. There's some cases where that could increase log spam noticeably (unitialized blocks), but that seems acceptable. > +static void > +lazy_scan_heap_cb(void *arg) > +{ > + LazyScanHeapInfo *info = (LazyScanHeapInfo *) arg; > + > + if (info->blkno != InvalidBlockNumber) > + errcontext("while scanning page %u of relation %s", > + info->blkno, RelationGetRelationName(info->relation)); > + else > + errcontext("while vacuuming relation %s", > + RelationGetRelationName(info->relation)); > +} Hm, perhaps rephrase so both messages refer to vacuuming? E.g. just by replacing scanning with vacuuming? Greetings, Andres Freund