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

Commita08dc71

Browse files
committed
Fix for checksum validation patch
Reorder the check for non-BLCKSZ size reads to make sure we don't abortsending the file in this case.Missed in the previous commit.
1 parent4eb77d5 commita08dc71

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

‎src/backend/replication/basebackup.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,26 +1410,26 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
14101410

14111411
while ((cnt=fread(buf,1,Min(sizeof(buf),statbuf->st_size-len),fp))>0)
14121412
{
1413-
if (verify_checksum)
1413+
/*
1414+
* The checksums are verified at block level, so we iterate over
1415+
* the buffer in chunks of BLCKSZ, after making sure that
1416+
* TAR_SEND_SIZE/buf is divisible by BLCKSZ and we read a multiple
1417+
* of BLCKSZ bytes.
1418+
*/
1419+
Assert(TAR_SEND_SIZE %BLCKSZ==0);
1420+
1421+
if (verify_checksum&& (cnt %BLCKSZ!=0))
14141422
{
1415-
/*
1416-
* The checksums are verified atblocklevel, so we iterate over
1417-
* thebufferin chunks of BLCKSZ, after making sure that
1418-
* TAR_SEND_SIZE/buf is divisible by BLCKSZ and we read a multiple
1419-
* of BLCKSZ bytes.
1420-
*/
1421-
Assert(TAR_SEND_SIZE %BLCKSZ==0);
1423+
ereport(WARNING,
1424+
(errmsg("cannot verify checksum in file \"%s\",block"
1425+
"%d: readbuffersize %d and page size %d "
1426+
"differ",
1427+
readfilename,blkno, (int)cnt,BLCKSZ)));
1428+
verify_checksum= false;
1429+
}
14221430

1423-
if (cnt %BLCKSZ!=0)
1424-
{
1425-
ereport(WARNING,
1426-
(errmsg("cannot verify checksum in file \"%s\", block "
1427-
"%d: read buffer size %d and page size %d "
1428-
"differ",
1429-
readfilename,blkno, (int)cnt,BLCKSZ)));
1430-
verify_checksum= false;
1431-
continue;
1432-
}
1431+
if (verify_checksum)
1432+
{
14331433
for (i=0;i<cnt /BLCKSZ;i++)
14341434
{
14351435
page=buf+BLCKSZ*i;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp