@@ -106,36 +106,44 @@ backup_data_page(pgFile *file, const XLogRecPtr *lsn,
106106elog (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}
140148else
141149try_checksum = 0 ;