Skip to content

Commit b5e560c

Browse files
committed
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.
1 parent 41457fc commit b5e560c

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/bin/pg_rewind/copy_fetch.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,20 @@ recurse_dir(const char *datadir, const char *parentpath,
7575

7676
if (lstat(fullpath, &fst) < 0)
7777
{
78-
pg_log(PG_WARNING, "could not stat file \"%s\": %s",
79-
fullpath, strerror(errno));
80-
81-
/*
82-
* This is ok, if the new master is running and the file was just
83-
* removed. If it was a data file, there should be a WAL record of
84-
* the removal. If it was something else, it couldn't have been
85-
* critical anyway.
86-
*
87-
* TODO: But complain if we're processing the target dir!
88-
*/
78+
if (errno == ENOENT)
79+
{
80+
/*
81+
* File doesn't exist anymore. This is ok, if the new master
82+
* is running and the file was just removed. If it was a data
83+
* file, there should be a WAL record of the removal. If it
84+
* was something else, it couldn't have been anyway.
85+
*
86+
* TODO: But complain if we're processing the target dir!
87+
*/
88+
}
89+
else
90+
pg_fatal("could not stat file \"%s\": %s",
91+
fullpath, strerror(errno));
8992
}
9093

9194
if (parentpath)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy