Skip to content

Commit 7e2785b

Browse files
committed
[refactoring] remove pgFileSize()
1 parent efedbc2 commit 7e2785b

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/dir.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,17 +1602,6 @@ fileExists(const char *path, fio_location location)
16021602
return true;
16031603
}
16041604

1605-
size_t
1606-
pgFileSize(const char *path)
1607-
{
1608-
struct stat buf;
1609-
1610-
if (stat(path, &buf) == -1)
1611-
elog(ERROR, "Cannot stat file \"%s\": %s", path, strerror(errno));
1612-
1613-
return buf.st_size;
1614-
}
1615-
16161605
/*
16171606
* Construct parray containing remapped external directories paths
16181607
* from string like /path1:/path2

src/validate.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,14 @@ pgBackupValidate(pgBackup *backup, pgRestoreParams *params)
200200
(parse_program_version(backup->program_version) == 20201)))
201201
{
202202
char path[MAXPGPATH];
203+
struct stat st;
203204

204205
join_path_components(path, backup->root_dir, DATABASE_FILE_LIST);
205206

206-
if (pgFileSize(path) >= (BLCKSZ*500))
207+
if (fio_stat(FIO_BACKUP_HOST, path, &st, true) < 0)
208+
elog(ERROR, "Cannot stat file \"%s\": %s", path, strerror(errno));
209+
210+
if (st.st_size >= (BLCKSZ*500))
207211
{
208212
elog(WARNING, "Backup %s is a victim of metadata corruption. "
209213
"Additional information can be found here: "

0 commit comments

Comments
 (0)