pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-general@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] pg_upgrade from 9.5 to 9.6 fails with "invalid argument"
Date: Thu, 29 Sep 2016 18:40:15 -0300
Message-ID: <20160929214015.GA446237@alvherre.pgsql> (raw)
In-Reply-To: <12301.1475183434@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

Tom Lane wrote:
> Thomas Kellerer <spam_eater@gmx.net> 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



view thread (23+ messages)  latest in thread

Message-ID: <20160929214015.GA446237@alvherre.pgsql>
Permalink:  ../20160929214015.GA446237@alvherre.pgsql/
Also on:    postgresql.org/message-id/20160929214015.GA446237@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, spam_eater@gmx.net, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] pg_upgrade from 9.5 to 9.6 fails with "invalid argument"
  In-Reply-To: <20160929214015.GA446237@alvherre.pgsql>
  References: <12301.1475183434@sss.pgh.pa.us> <20160929214015.GA446237@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox