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

Commit349803b

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 parent0559909 commit349803b

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
@@ -1568,14 +1568,6 @@ sendFile(bbsink *sink, const char *readfilename, const char *tarfilename,
15681568
Min(sink->bbs_buffer_length,remaining),
15691569
len,readfilename, true);
15701570

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

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp