pg_upgrade: Don't overwrite existing files.
authorRobert Haas <[email protected]>
Mon, 6 Jun 2016 13:51:56 +0000 (09:51 -0400)
committerRobert Haas <[email protected]>
Mon, 6 Jun 2016 13:51:56 +0000 (09:51 -0400)
commite191a6900520a28ece9393eec2fdd69f292f12c4
treeaa400c1e3dc1471f87e1d97b4428352db823d187
parent932b97a0112aa950af51dfb26645cd67d368f1f3
pg_upgrade: Don't overwrite existing files.

For historical reasons, copyFile and rewriteVisibilityMap took a force
argument which was always passed as true, meaning that any existing
file should be overwritten.  However, it seems much safer to instead
fail if a file we need to write already exists.

While we're at it, remove the "force" argument altogether, since it was
never passed as anything other than true (and now we would never pass
it as anything other than false, if we kept it).

Noted by Andres Freund during post-commit review of the patch that added
rewriteVisibilityMap, commit 7087166a88fe0c04fc6636d0d6d6bea1737fc1fb,
but this also changes the behavior when copying files without rewriting
them.

Patch by Masahiko Sawada.
src/bin/pg_upgrade/file.c
src/bin/pg_upgrade/pg_upgrade.h
src/bin/pg_upgrade/relfilenode.c