1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-09 14:45:47 +02:00

[Issue #201] check fseek return code

This commit is contained in:
Grigory Smolkin 2020-05-07 16:21:26 +03:00
parent 26a834b44c
commit b949231b93
2 changed files with 8 additions and 4 deletions

View File

@ -1042,12 +1042,13 @@ restore_data_file_internal(FILE *in, FILE *out, pgFile *file, uint32 backup_vers
if (compressed_size > BLCKSZ)
elog(ERROR, "Size of a blknum %i exceed BLCKSZ", blknum);
/* if this page was already restored, then skip it */
/* if this page is marked as already restored, then skip it */
if (datapagemap_is_set(map, blknum))
{
elog(WARNING, "Skipping block %u because is was already restored", blknum);
/* TODO: check error */
fseek(in, MAXALIGN(compressed_size), SEEK_CUR);
/* skip to the next page */
if (fseek(in, MAXALIGN(compressed_size), SEEK_CUR) != 0)
elog(ERROR, "Cannot seek block %u of '%s': %s",
blknum, from_fullpath, strerror(errno));
continue;
}

View File

@ -876,6 +876,9 @@ restore_files(void *arg)
arguments->dest_backup, dest_file, out, to_fullpath);
}
/* free pagemap used for restore optimization */
pg_free(dest_file->pagemap.bitmap);
done:
/* close file */
if (fio_fclose(out) != 0)