Skip to content

Commit c0f09b8

Browse files
committed
[refactoring] remove pgFileSize()
1 parent e5fb869 commit c0f09b8

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

src/dir.c

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

1470-
size_t
1471-
pgFileSize(const char *path)
1472-
{
1473-
struct stat buf;
1474-
1475-
if (stat(path, &buf) == -1)
1476-
elog(ERROR, "Cannot stat file \"%s\": %s", path, strerror(errno));
1477-
1478-
return buf.st_size;
1479-
}
1480-
14811470
/*
14821471
* Construct parray containing remapped external directories paths
14831472
* from string like /path1:/path2

src/pg_probackup.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,6 @@ extern bool backup_contains_external(const char *dir, parray *dirs_list);
10701070
extern bool dir_is_empty(const char *path, fio_location location);
10711071

10721072
extern bool fileExists(const char *path, fio_location location);
1073-
extern size_t pgFileSize(const char *path);
10741073

10751074
extern pgFile *pgFileNew(const char *path, const char *rel_path,
10761075
bool follow_symlink, int external_dir_num,

src/validate.c

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

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

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

0 commit comments

Comments
 (0)