Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space
Date
Msg-id 20151114012402.GC27916@momjian.us
Whole thread Raw
In response to BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space  (manu@coopapotheken.be)
Responses Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space  (Bruce Momjian <bruce@momjian.us>)
Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space  (Noah Misch <noah@leadboat.com>)
List pgsql-bugs
On Thu, Nov 12, 2015 at 07:57:35PM +0000, manu@coopapotheken.be wrote:
> The following bug has been logged on the website:
>
> Bug reference:      13774
> Logged by:          Manu Joye
> Email address:      manu@coopapotheken.be
> PostgreSQL version: 9.4.5
> Operating system:   Windows server 2008r2
> Description:
>
> running pg_upgrade yields no warnings when there is not enough disk space to
> do the upgrade. I  upgraded a server with about 10 databases following the
> instructions as provided on the website here. Everything seemed to have gone
> well except that some tables in various databases just vanished (pgadmin
> complained about missing files) . Upon inspection I noticed the HD had only
> a couple of KB of free space left. pg_upgrade seemed to have just restored
> what it could and then exited without warning!
>
> We caught it early on and could restore from backups but a check on required
> free disk space before upgrade should be implemented or, if that doesn't
> work, at least a warning from pg_upgrade that something went wrong.

Thank you for the report.  This is embarrassing, but the code was
testing for the wrong return value on Windows.  We used a macro to
define the same symbol on Windows and Unix (pg_copy_file), but for
Windows, we should have been testing for zero, while the code only
tested for a -1 return failure.  You can see the Windows failure zero
return value defined here:

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa363851%28v=vs.85%29.aspx

    Return value

    If the function succeeds, the return value is nonzero.
    If the function fails, the return value is zero. To get extended error
    information, call GetLastError.

We do something similar for hard links, but we create a wrapper function
to return the proper value (-1), and we call it twice, so it seems wise
to keep that unchanged.

The attached patch fixes this and will be applied to all active branches
in the next minor release.  Sorry for the bug.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Roman grave inscription                             +

Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #13775: CREATE RULE documentation seems to be wrong under ON SELECT TO DO INSTEAD SELECT
Next
From: Michael Paquier
Date:
Subject: Re: BUG #13741: vacuumdb does not accept valid password