Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpj47-0001EW-SU for pgsql-general@arkaria.postgresql.org; Thu, 29 Sep 2016 21:40:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bpj46-0002mh-Nm for pgsql-general@arkaria.postgresql.org; Thu, 29 Sep 2016 21:40:26 +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 1bpj46-0002mW-2u; Thu, 29 Sep 2016 21:40:26 +0000 Received: from smtprelay0166.b.hostedemail.com ([64.98.42.166] helo=smtprelay.b.hostedemail.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bpj41-0000AU-Oe; Thu, 29 Sep 2016 21:40:25 +0000 Received: from filter.hostedemail.com (10.5.19.248.rfc1918.com [10.5.19.248]) by smtprelay03.b.hostedemail.com (Postfix) with ESMTP id ED6871A7398; Thu, 29 Sep 2016 21:40:18 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,alvherre@alvh.no-ip.org,:::::::,RULES_HIT:41:355:379:599:800:960:967:968:973:981:988:989:1260:1263:1277:1311:1312:1313:1314:1345:1359:1437:1515:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:2198:2199:2393:2525:2561:2564:2682:2685:2828:2859:2899:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3657:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4605:5007:6119:6261:7903:8551:8660:8957:8985:9025:9121:9388:10004:10400:10848:11232:11658:11914:12043:12296:12438:12555:12660:12682:13069:13095:13148:13230:13255:13311:13357:13439:13894:13895:14089:14090:14181:14721:14764:14849:21080:21433:21451,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:4,LUA_SUMMARY:none X-HE-Tag: wrist22_1fbc6be9c0916 X-Filterd-Recvd-Size: 2603 Received: from alvin.alvh.no-ip.org (unknown [216.155.90.98]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf06.b.hostedemail.com (Postfix) with ESMTPA; Thu, 29 Sep 2016 21:40:18 +0000 (UTC) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 5756A3832; Thu, 29 Sep 2016 18:40:15 -0300 (CLST) Date: Thu, 29 Sep 2016 18:40:15 -0300 From: Alvaro Herrera To: Tom Lane Cc: Thomas Kellerer , pgsql-general@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [HACKERS] pg_upgrade from 9.5 to 9.6 fails with "invalid argument" Message-ID: <20160929214015.GA446237@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <12301.1475183434@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -0.4 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Tom Lane wrote: > Thomas Kellerer writes: > > for some reason pg_upgrade failed on Windows 10 for me, with an error message that one specifc _vm file couldn't be copied. > > Hmm ... a _vm file would go through rewriteVisibilityMap(), which is new > code for 9.6 and hasn't really gotten that much testing. Its error > reporting is shamefully bad --- you can't tell which step failed, and > I wouldn't even put a lot of faith in the errno being meaningful, > considering that it does close() calls before capturing the errno. So we do close() in a bunch of places while closing shop, which calls _close() on Windows; this function sets errno. Then we call getErrorText(), which calls _dosmaperr() on the result of GetLastError(). But the last-error stuff is not set by _close; I suppose GetLastError() returns 0 in that case, which promps _doserrmap to set errno to 0. http://stackoverflow.com/questions/20056851/getlasterror-errno-formatmessagea-and-strerror-s So this wouldn't quite have the effect you say; I think it'd say "Failure while copying ...: Success" instead. However surely we should have errno save/restore. Other than that, I think the _dosmaperr() call should go entirely. Moreover I think getErrorText() as a whole is misconceived and should be removed altogether (why pstrdup the string?). There are very few places in pg_upgrade that require _dosmaperr; I can see only copyFile and linkFile. All the others should just be doing strerror() only, at least according to the manual. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general