Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1f8c163

Browse filesBrowse 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 7f79f95 commit 1f8c163
Copy full SHA for 1f8c163

File tree

Expand file treeCollapse file tree

1 file changed

+0
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+0
-12
lines changed

‎src/bin/pg_rewind/filemap.c

Copy file name to clipboardExpand all lines: src/bin/pg_rewind/filemap.c
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,23 +254,11 @@ process_target_file(const char *path, file_type_t type, size_t oldsize,
254254
const char *link_target)
255255
{
256256
bool exists;
257-
char localpath[MAXPGPATH];
258-
struct stat statbuf;
259257
file_entry_t key;
260258
file_entry_t *key_ptr;
261259
filemap_t *map = filemap;
262260
file_entry_t *entry;
263261

264-
snprintf(localpath, sizeof(localpath), "%s/%s", datadir_target, path);
265-
if (lstat(localpath, &statbuf) < 0)
266-
{
267-
if (errno != ENOENT)
268-
pg_fatal("could not stat file \"%s\": %s\n",
269-
localpath, strerror(errno));
270-
271-
exists = false;
272-
}
273-
274262
if (map->array == NULL)
275263
{
276264
/* on first call, initialize lookup array */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.