Skip to content

Commit 666e9a9

Browse files
committed
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
1 parent cd153b5 commit 666e9a9

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

src/bin/pg_rewind/filemap.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,6 @@ process_target_file(const char *path, file_type_t type, size_t oldsize,
349349
const char *link_target)
350350
{
351351
bool exists;
352-
char localpath[MAXPGPATH];
353-
struct stat statbuf;
354352
file_entry_t key;
355353
file_entry_t *key_ptr;
356354
filemap_t *map = filemap;
@@ -362,16 +360,6 @@ process_target_file(const char *path, file_type_t type, size_t oldsize,
362360
* the source data folder when processing the source files.
363361
*/
364362

365-
snprintf(localpath, sizeof(localpath), "%s/%s", datadir_target, path);
366-
if (lstat(localpath, &statbuf) < 0)
367-
{
368-
if (errno != ENOENT)
369-
pg_fatal("could not stat file \"%s\": %m",
370-
localpath);
371-
372-
exists = false;
373-
}
374-
375363
if (map->array == NULL)
376364
{
377365
/* on first call, initialize lookup array */

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