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

Commit33352b9

Browse files
committed
In basebackup.c, perform end-of-file test after checksum validation.
We read blocks of data from files that we're backing up in chunks,some multiple of BLCKSZ for each read. If checksum verification fails,we then try rereading just the one block for which validation failed.If that block happened to be the first block of the chunk, and ifthe file was concurrently truncated to remove that block, then we'dreach a call to bbsink_archive_contents() with a buffer length of 0.That causes an assertion failure.As far as I can see, there are no particularly bad consequences ifthis happens in a non-assert build, and it's pretty unlikely to happenin the first place because it requires a series of somewhat unlikelythings to happen in very quick succession. However, assertion failuresare bad, so rearrange the code to avoid that possibility.Patch by me, reviewed by Michael Paquier.Discussion:http://postgr.es/m/CA+TgmoZ_fFAoU6mrHt9QBs+dcYhN6yXenGTTMRebZNhtwPwHyg@mail.gmail.com
1 parentd3406d8 commit33352b9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

‎src/backend/backup/basebackup.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,14 +1567,6 @@ sendFile(bbsink *sink, const char *readfilename, const char *tarfilename,
15671567
Min(sink->bbs_buffer_length,remaining),
15681568
len,readfilename, true);
15691569

1570-
/*
1571-
* If we hit end-of-file, a concurrent truncation must have occurred.
1572-
* That's not an error condition, because WAL replay will fix things
1573-
* up.
1574-
*/
1575-
if (cnt==0)
1576-
break;
1577-
15781570
/*
15791571
* The checksums are verified at block level, so we iterate over the
15801572
* buffer in chunks of BLCKSZ, after making sure that
@@ -1677,6 +1669,15 @@ sendFile(bbsink *sink, const char *readfilename, const char *tarfilename,
16771669
}
16781670
}
16791671

1672+
/*
1673+
* If we hit end-of-file, a concurrent truncation must have occurred.
1674+
* That's not an error condition, because WAL replay will fix things
1675+
* up.
1676+
*/
1677+
if (cnt==0)
1678+
break;
1679+
1680+
/* Archive the data we just read. */
16801681
bbsink_archive_contents(sink,cnt);
16811682

16821683
/* Also feed it to the checksum machinery. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp