aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2015-04-15 23:13:32 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2015-04-15 23:13:32 +0300
commitb5e560c24603e5325a81055c8f36cc45d48609e4 (patch)
tree882eea8409122dfce95e49f7c022f47942147d15 /src
parent41457fcf970f0ec78004cc0f7b29f1d37021fbfb (diff)
downloadpostgresql-b5e560c24603e5325a81055c8f36cc45d48609e4.tar.gz
postgresql-b5e560c24603e5325a81055c8f36cc45d48609e4.zip
Error out in pg_rewind if lstat() fails.
A "file not found" is expected if the source server is running, so don't complain about that. But any other error is definitely not expected.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_rewind/copy_fetch.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c
index 887fec9c9d0..397bf204f94 100644
--- a/src/bin/pg_rewind/copy_fetch.c
+++ b/src/bin/pg_rewind/copy_fetch.c
@@ -75,17 +75,20 @@ recurse_dir(const char *datadir, const char *parentpath,
if (lstat(fullpath, &fst) < 0)
{
- pg_log(PG_WARNING, "could not stat file \"%s\": %s",
- fullpath, strerror(errno));
-
- /*
- * This is ok, if the new master is running and the file was just
- * removed. If it was a data file, there should be a WAL record of
- * the removal. If it was something else, it couldn't have been
- * critical anyway.
- *
- * TODO: But complain if we're processing the target dir!
- */
+ if (errno == ENOENT)
+ {
+ /*
+ * File doesn't exist anymore. This is ok, if the new master
+ * is running and the file was just removed. If it was a data
+ * file, there should be a WAL record of the removal. If it
+ * was something else, it couldn't have been anyway.
+ *
+ * TODO: But complain if we're processing the target dir!
+ */
+ }
+ else
+ pg_fatal("could not stat file \"%s\": %s",
+ fullpath, strerror(errno));
}
if (parentpath)