Skip to content

Commit 6878de1

Browse files
committed
PGPRO-1159: Do not throw an error if file was truncated
1 parent a00fdaf commit 6878de1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/data.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ backup_data_page(pgFile *file, XLogRecPtr prev_backup_start_lsn,
140140
/*
141141
* Read the page and verify its header and checksum.
142142
* Under high write load it's possible that we've read partly
143-
* flushed page, so try several times befor throwing an error.
143+
* flushed page, so try several times before throwing an error.
144144
*/
145145
while(try_checksum--)
146146
{
@@ -152,6 +152,13 @@ backup_data_page(pgFile *file, XLogRecPtr prev_backup_start_lsn,
152152

153153
if (read_len != BLCKSZ)
154154
{
155+
if (read_len == 0)
156+
{
157+
elog(LOG, "File %s, block %u, file was truncated",
158+
file->path, blknum);
159+
return;
160+
}
161+
155162
elog(ERROR, "File: %s, invalid block size of block %u : %lu",
156163
file->path, blknum, read_len);
157164
}

0 commit comments

Comments
 (0)