Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4c1dde8

Browse files
author
Artur Zakirov
committed
Merge branch 'ptrack' of git.postgrespro.ru:pgpro-dev/pg_probackup into ptrack
2 parents eb531bc + 62246e4 commit 4c1dde8

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

data.c

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -106,36 +106,44 @@ backup_data_page(pgFile *file, const XLogRecPtr *lsn,
106106
elog(LOG, "File: %s blknum %u, empty page", file->path, blknum);
107107
}
108108

109-
/* Try to read and verify this page again several times. */
110-
if (try_checksum)
109+
/*
110+
* If page is not completely empty and we couldn't parse it,
111+
* try again several times. If it didn't help, throw error
112+
*/
113+
if (!is_zero_page)
111114
{
112-
elog(WARNING, "File: %s blknum %u have wrong page header, try again",
113-
file->path, blknum);
114-
usleep(100);
115-
continue;
115+
/* Try to read and verify this page again several times. */
116+
if (try_checksum)
117+
{
118+
elog(WARNING, "File: %s blknum %u have wrong page header, try again",
119+
file->path, blknum);
120+
usleep(100);
121+
continue;
122+
}
123+
else
124+
elog(ERROR, "File: %s blknum %u have wrong page header.", file->path, blknum);
116125
}
117-
else
118-
elog(ERROR, "File: %s blknum %u have wrong page header.", file->path, blknum);
119126
}
120127

121-
/*
122-
* Verify checksum.
123-
* If it's wrong, sleep a bit and then try again
124-
* several times. If it didn't help, throw error.
125-
*/
126-
if(!is_zero_page &&
127-
current.checksum_version &&
128-
pg_checksum_page(page.data, file->segno * RELSEG_SIZE + blknum) != ((PageHeader) page.data)->pd_checksum)
128+
/* Verify checksum */
129+
if(current.checksum_version && !is_zero_page)
129130
{
130-
if (try_checksum)
131+
/*
132+
* If checksum is wrong, sleep a bit and then try again
133+
* several times. If it didn't help, throw error
134+
*/
135+
if (pg_checksum_page(page.data, file->segno * RELSEG_SIZE + blknum) != ((PageHeader) page.data)->pd_checksum)
131136
{
132-
elog(WARNING, "File: %s blknum %u have wrong checksum, try again",
133-
file->path, blknum);
134-
usleep(100);
137+
if (try_checksum)
138+
{
139+
elog(WARNING, "File: %s blknum %u have wrong checksum, try again",
140+
file->path, blknum);
141+
usleep(100);
142+
}
143+
else
144+
elog(ERROR, "File: %s blknum %u have wrong checksum.",
145+
file->path, blknum);
135146
}
136-
else
137-
elog(ERROR, "File: %s blknum %u have wrong checksum.",
138-
file->path, blknum);
139147
}
140148
else
141149
try_checksum = 0;

0 commit comments

Comments
 (0)