Skip to content

Commit f49c197

Browse files
committed
[Issue #132] validate is now capable of detecting metadata corruption produced by #132
1 parent 251fc83 commit f49c197

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/validate.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,28 @@ pgBackupValidate(pgBackup *backup, pgRestoreParams *params)
175175
elog(WARNING, "Backup %s data files are corrupted", base36enc(backup->start_time));
176176
else
177177
elog(INFO, "Backup %s data files are valid", base36enc(backup->start_time));
178+
179+
/* Issue #132 kludge */
180+
if (!corrupted &&
181+
((parse_program_version(backup->program_version) == 20104)||
182+
(parse_program_version(backup->program_version) == 20105)||
183+
(parse_program_version(backup->program_version) == 20201)))
184+
{
185+
char path[MAXPGPATH];
186+
187+
pgBackupGetPath(backup, path, lengthof(path), DATABASE_FILE_LIST);
188+
189+
if (pgFileSize(path) >= (BLCKSZ*500))
190+
{
191+
elog(WARNING, "Backup %s is a victim of metadata corruption. "
192+
"Additional information can be found here: "
193+
"https://github.com/postgrespro/pg_probackup/issues/132",
194+
base36enc(backup->start_time));
195+
backup->status = BACKUP_STATUS_CORRUPT;
196+
write_backup_status(backup, BACKUP_STATUS_CORRUPT, instance_name);
197+
}
198+
199+
}
178200
}
179201

180202
/*

0 commit comments

Comments
 (0)