1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-26 11:54:25 +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) if (compressed_size > BLCKSZ)
elog(ERROR, "Size of a blknum %i exceed BLCKSZ", blknum); 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)) if (datapagemap_is_set(map, blknum))
{ {
elog(WARNING, "Skipping block %u because is was already restored", blknum); /* skip to the next page */
/* TODO: check error */ if (fseek(in, MAXALIGN(compressed_size), SEEK_CUR) != 0)
fseek(in, MAXALIGN(compressed_size), SEEK_CUR); elog(ERROR, "Cannot seek block %u of '%s': %s",
blknum, from_fullpath, strerror(errno));
continue; continue;
} }

View File

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