Skip to content

Commit b949231

Browse files
committed
[Issue #201] check fseek return code
1 parent 26a834b commit b949231

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/data.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,12 +1042,13 @@ restore_data_file_internal(FILE *in, FILE *out, pgFile *file, uint32 backup_vers
10421042
if (compressed_size > BLCKSZ)
10431043
elog(ERROR, "Size of a blknum %i exceed BLCKSZ", blknum);
10441044

1045-
/* if this page was already restored, then skip it */
1045+
/* if this page is marked as already restored, then skip it */
10461046
if (datapagemap_is_set(map, blknum))
10471047
{
1048-
elog(WARNING, "Skipping block %u because is was already restored", blknum);
1049-
/* TODO: check error */
1050-
fseek(in, MAXALIGN(compressed_size), SEEK_CUR);
1048+
/* skip to the next page */
1049+
if (fseek(in, MAXALIGN(compressed_size), SEEK_CUR) != 0)
1050+
elog(ERROR, "Cannot seek block %u of '%s': %s",
1051+
blknum, from_fullpath, strerror(errno));
10511052
continue;
10521053
}
10531054

src/restore.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,9 @@ restore_files(void *arg)
876876
arguments->dest_backup, dest_file, out, to_fullpath);
877877
}
878878

879+
/* free pagemap used for restore optimization */
880+
pg_free(dest_file->pagemap.bitmap);
881+
879882
done:
880883
/* close file */
881884
if (fio_fclose(out) != 0)

0 commit comments

Comments
 (0)