Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eN2zg-0002xk-LQ for pgsql-committers@arkaria.postgresql.org; Thu, 07 Dec 2017 20:42:08 +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 1eN2zg-0004yt-7W for pgsql-committers@arkaria.postgresql.org; Thu, 07 Dec 2017 20:42:08 +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 1eN2zg-0004ye-2Y; Thu, 07 Dec 2017 20:42:08 +0000 Received: from smtprelay0241.b.hostedemail.com ([64.98.42.241] helo=smtprelay.b.hostedemail.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eN2zc-0004wb-7I; Thu, 07 Dec 2017 20:42:07 +0000 Received: from filter.hostedemail.com (10.5.19.248.rfc1918.com [10.5.19.248]) by smtprelay01.b.hostedemail.com (Postfix) with ESMTP id 801622D2A25; Thu, 7 Dec 2017 20:42:00 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,alvherre@alvh.no-ip.org,:::::::::::::::::,RULES_HIT:41:355:379:599:965:966:967:973:988:989:1260:1277:1311:1312:1313:1314:1345:1359:1437:1515:1516:1518:1519:1534:1543:1593:1594:1595:1596:1605:1711:1730:1747:1777:1792:2194:2196:2199:2200:2393:2525:2560:2563:2682:2685:2828:2859:2895:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4385:4390:4395:4605:5007:6119:6261:7903:8660:8957:9025:9108:9121:10004:10394:10400:10848:10967:11026:11232:11658:11914:12043:12438:12663:12740:12895:13071:13095:13141:13146:13148:13230:13439:13894:13895:14180:14721:21063:21067:21080:21324:21433:21611:21627:30034:30054:30070:30075:30079,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:4,LUA_SUMMARY:none X-HE-Tag: kite22_2e7767a545157 X-Filterd-Recvd-Size: 4366 Received: from alvin.alvh.no-ip.org (unknown [179.57.113.18]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf12.b.hostedemail.com (Postfix) with ESMTPA; Thu, 7 Dec 2017 20:41:59 +0000 (UTC) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id DF03313E6; Thu, 7 Dec 2017 17:41:56 -0300 (-03) Date: Thu, 7 Dec 2017 17:41:56 -0300 From: Alvaro Herrera To: Andres Freund 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: <20171207204156.hzoladdacxjpz4rz@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171207202243.pmxwjm5wvz5lp6j6@alap3.anarazel.de> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, Andres Freund wrote: > 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. Hmm, it should be possible to call vacuum with a very low freeze_min_age (which sets a very recent relfrozenxid), then shortly thereafter call it with a large one, no? So it's not really guaranteed ... > > 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? Eh, no, my intention was to make these all errmsg_internal() to avoid translation (serves no purpose here). Feel free to update the remaining ones. > > 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. Yeah, I noticed that and I agree it seems ok. > > + 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? Makes sense. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services