summaryrefslogtreecommitdiff
path: root/src/bin/pg_rewind
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-09-06 11:50:41 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-09-06 11:50:41 -0400
commitbe6667081e233d5868dd7e59ca2226348a489fb5 (patch)
tree278260c9c161f44ff940644a4afd134e934c49a1 /src/bin/pg_rewind
parent226fd0c518bb17e0433422a161b948feef5601d1 (diff)
downloadpostgresql-be6667081e233d5868dd7e59ca2226348a489fb5.tar.gz
Remove useless lstat() call in pg_rewind.
This is duplicative of an lstat that was just done by the calling function (traverse_datadir), besides which we weren't really doing anything with the results. There's not much point in checking to see if someone removed the file since the previous lstat, since the FILE_ACTION_REMOVE code would have to deal with missing-file cases anyway. Moreover, the "exists = false" assignment was a dead store; nothing was done with that value later. A syscall saved is a syscall earned, so back-patch to 9.5 where this code was introduced. Discussion: https://postgr.es/m/1221796.1599329320@sss.pgh.pa.us
Diffstat (limited to 'src/bin/pg_rewind')
-rw-r--r--src/bin/pg_rewind/filemap.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 366b97de91..f1190b6287 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -254,23 +254,11 @@ process_target_file(const char *path, file_type_t type, size_t oldsize,
const char *link_target)
{
bool exists;
- char localpath[MAXPGPATH];
- struct stat statbuf;
file_entry_t key;
file_entry_t *key_ptr;
filemap_t *map = filemap;
file_entry_t *entry;
- snprintf(localpath, sizeof(localpath), "%s/%s", datadir_target, path);
- if (lstat(localpath, &statbuf) < 0)
- {
- if (errno != ENOENT)
- pg_fatal("could not stat file \"%s\": %s\n",
- localpath, strerror(errno));
-
- exists = false;
- }
-
if (map->array == NULL)
{
/* on first call, initialize lookup array */