Commit b5e560c2 authored by Heikki Linnakangas's avatar Heikki Linnakangas

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.
parent 41457fcf
...@@ -75,17 +75,20 @@ recurse_dir(const char *datadir, const char *parentpath, ...@@ -75,17 +75,20 @@ recurse_dir(const char *datadir, const char *parentpath,
if (lstat(fullpath, &fst) < 0) if (lstat(fullpath, &fst) < 0)
{ {
pg_log(PG_WARNING, "could not stat file \"%s\": %s", if (errno == ENOENT)
fullpath, strerror(errno)); {
/*
/* * File doesn't exist anymore. This is ok, if the new master
* This is ok, if the new master is running and the file was just * is running and the file was just removed. If it was a data
* removed. If it was a data file, there should be a WAL record of * file, there should be a WAL record of the removal. If it
* the removal. If it was something else, it couldn't have been * was something else, it couldn't have been anyway.
* critical anyway. *
* * TODO: But complain if we're processing the target dir!
* TODO: But complain if we're processing the target dir! */
*/ }
else
pg_fatal("could not stat file \"%s\": %s",
fullpath, strerror(errno));
} }
if (parentpath) if (parentpath)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment