Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8640a7

Browse files
author
Artur Zakirov
committed
Merge branch 'simplify_backup_data_file' into ptrack
2 parents2c6da8d +f4fa1cd commitb8640a7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

‎data.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ backup_data_page(pgFile *file, const XLogRecPtr *lsn,
6060
XLogRecPtrpage_lsn;
6161
intret;
6262
inttry_checksum=100;
63+
boolis_zero_page= false;
6364
structstatst;
6465

6566
header.block=blknum;
@@ -101,8 +102,8 @@ backup_data_page(pgFile *file, const XLogRecPtr *lsn,
101102
for(i=0;i<BLCKSZ&&page.data[i]==0;i++);
102103
if (i==BLCKSZ)
103104
{
104-
// FIXME Fix this hell.
105-
elog(ERROR,"File: %s blknum %u, empty page",file->path,blknum);
105+
is_zero_page= true;
106+
elog(LOG,"File: %s blknum %u, empty page",file->path,blknum);
106107
}
107108

108109
/* Try to read and verify this page again several times. */
@@ -122,7 +123,8 @@ backup_data_page(pgFile *file, const XLogRecPtr *lsn,
122123
* If it's wrong, sleep a bit and then try again
123124
* several times. If it didn't help, throw error.
124125
*/
125-
if(current.checksum_version&&
126+
if(!is_zero_page&&
127+
current.checksum_version&&
126128
pg_checksum_page(page.data,file->segno*RELSEG_SIZE+blknum)!= ((PageHeader)page.data)->pd_checksum)
127129
{
128130
if (try_checksum)
@@ -143,7 +145,7 @@ backup_data_page(pgFile *file, const XLogRecPtr *lsn,
143145

144146
memcpy(write_buffer,&header,sizeof(header));
145147
memcpy(write_buffer+sizeof(header),page.data,BLCKSZ);
146-
/* write data pageexcluding hole*/
148+
/* write data page */
147149
if(fwrite(write_buffer,1,write_buffer_size,out)!=write_buffer_size)
148150
{
149151
interrno_tmp=errno;
@@ -228,12 +230,9 @@ backup_data_file(const char *from_root, const char *to_root,
228230
check_server_version();
229231

230232
/*
231-
* Read each page and write the page excluding hole. If it has been
232-
* determined that the page can be copied safely, but no page map
233-
* has been built, it means that we are in presence of a relation
234-
* file that needs to be completely scanned. If a page map is present
235-
* only scan the blocks needed. In each case, pages are copied without
236-
* their hole to ensure some basic level of compression.
233+
* Read each page, verify checksum and write it to backup.
234+
* If page map is not empty we scan only these blocks, otherwise
235+
* backup all pages of the relation.
237236
*/
238237
if (file->pagemap.bitmapsize==0)
239238
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp