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

Commitfa33956

Browse files
committed
Error out in pg_checksums on incompatible block size
pg_checksums is compiled with a given block size and has a harddependency to it per the way checksums are calculated viachecksum_impl.h, and trying to use the tool on a data folder which hasnot the same block size would result in incorrect checksum calculationsand/or block read errors, meaning that the data folder is corrupted.This is harmless as checksums are only checked now, but very confusingfor the user so issue an error properly if the block size used atcompilation and the block size used in the data folder do not match.Reported-by: Sergei KornilovAuthor: Michael Banck, Michael PaquierReviewed-by: Fabien Coelho, Magnus HaganderDiscussion:https://postgr.es/m/20190317054657.GA3357@paquier.xyzackpatch-through: 11
1 parent4178d8b commitfa33956

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎src/bin/pg_checksums/pg_checksums.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,15 @@ main(int argc, char *argv[])
327327
exit(1);
328328
}
329329

330+
if (ControlFile->blcksz!=BLCKSZ)
331+
{
332+
fprintf(stderr,_("%s: database cluster is not compatible.\n"),
333+
progname);
334+
fprintf(stderr,_("The database cluster was initialized with block size %u, but pg_checksums was compiled with block size %u.\n"),
335+
ControlFile->blcksz,BLCKSZ);
336+
exit(1);
337+
}
338+
330339
if (ControlFile->state!=DB_SHUTDOWNED&&
331340
ControlFile->state!=DB_SHUTDOWNED_IN_RECOVERY)
332341
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp