depstein@alliedtesting.com wrote:
> Encountered another problem with pg_upgrade on Windows XP Pro:
>
> I was trying to migrate from 8.4 to 9.0beta2 without linking, and
> apparently there was not enough space on the hard drive. However,
> pg_upgrade didn't report any problems, and it looked for all the world
> as if everything went well. I only found out that not all files were
> copied to the new cluster when vacuumdb reported missing files and when
> I actually compared the sizes of the two clusters on the disk.
Thank you for the clear bug report. Magnus has diagnosed the problem,
and I am attaching the patch fix that will appear in 9.0 beta4.
Fortunately this problem only happens in copy mode, and only when the
copy fails, as you saw.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ None of us is going to be here forever. +
Index: contrib/pg_upgrade/file.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/pg_upgrade/file.c,v
retrieving revision 1.13
diff -c -c -r1.13 file.c
*** contrib/pg_upgrade/file.c 6 Jul 2010 19:18:55 -0000 1.13
--- contrib/pg_upgrade/file.c 9 Jul 2010 16:41:46 -0000
***************
*** 170,175 ****
--- 170,177 ----
if (nbytes < 0)
{
+ int save_errno = errno;
+
if (buffer != NULL)
free(buffer);
***************
*** 179,184 ****
--- 181,187 ----
if (dest_fd != 0)
close(dest_fd);
+ errno = save_errno;
return -1;
}
***************
*** 190,197 ****
if (write(dest_fd, buffer, nbytes) != nbytes)
{
/* if write didn't set errno, assume problem is no disk space */
! if (errno == 0)
! errno = ENOSPC;
if (buffer != NULL)
free(buffer);
--- 193,199 ----
if (write(dest_fd, buffer, nbytes) != nbytes)
{
/* if write didn't set errno, assume problem is no disk space */
! int save_errno = errno ? errno : ENOSPC;
if (buffer != NULL)
free(buffer);
***************
*** 202,207 ****
--- 204,210 ----
if (dest_fd != 0)
close(dest_fd);
+ errno = save_errno;
return -1;
}
}