postgres.git / summary / log / commit / refs
commit e7f06ea60a3c07128176b294ce3fb0555edd15a5
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sun Sep 06 15:50:40 2020 +0000
First released in: 14.0, 9.5.24, 9.6.20, 10.15, 11.10, 12.5, 13.0
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
src/bin/pg_rewind/filemap.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 36a2d623415..fbb97b5cf1a 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -349,8 +349,6 @@ 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;
@@ -362,16 +360,6 @@ process_target_file(const char *path, file_type_t type, size_t oldsize,
* the source data folder when processing the source files.
*/
- snprintf(localpath, sizeof(localpath), "%s/%s", datadir_target, path);
- if (lstat(localpath, &statbuf) < 0)
- {
- if (errno != ENOENT)
- pg_fatal("could not stat file \"%s\": %m",
- localpath);
-
- exists = false;
- }
-
if (map->array == NULL)
{
/* on first call, initialize lookup array */
[parent: 8df601bd4067]