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

Commit19516af

Browse files
committed
Fix various checksum check problems for pg_verify_checksums and base backups
Three issues are fixed in this patch:- Base backups forgot to ignore files specific to EXEC_BACKEND, leadingto spurious warnings when checksums are enabled, per analysis from me.- pg_verify_checksums forgot about files specific to EXEC_BACKEND,leading to failures of the tool on any such build, particularly Windows.This error was originally found by newly-introduced TAP tests in variousbuildfarm members using EXEC_BACKEND.- pg_verify_checksums forgot to count for temporary files and temporarypaths, which could be valid relation files, without checksums, perreport from Andres Freund. More tests are added to cover this case.A new test case which emulates corruption for a file in a differenttablespace is added, coming from from Michael Banck, while I have codedthe main code and refactored the test code.Author: Michael Banck, Michael PaquierReviewed-by: Stephen Frost, David SteeleDiscussion:https://postgr.es/m/20181021134206.GA14282@paquier.xyz
1 parent8503630 commit19516af

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

‎src/backend/replication/basebackup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,19 @@ static const char *excludeFiles[] =
189189

190190
/*
191191
* List of files excluded from checksum validation.
192+
*
193+
* Note: this list should be kept in sync with what pg_verify_checksums.c
194+
* includes.
192195
*/
193196
staticconstchar*noChecksumFiles[]= {
194197
"pg_control",
195198
"pg_filenode.map",
196199
"pg_internal.init",
197200
"PG_VERSION",
201+
#ifdefEXEC_BACKEND
202+
"config_exec_params",
203+
"config_exec_params.new",
204+
#endif
198205
NULL,
199206
};
200207

‎src/bin/pg_verify_checksums/pg_verify_checksums.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include"storage/bufpage.h"
2121
#include"storage/checksum.h"
2222
#include"storage/checksum_impl.h"
23+
#include"storage/fd.h"
2324

2425

2526
staticint64files=0;
@@ -49,11 +50,20 @@ usage(void)
4950
printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
5051
}
5152

53+
/*
54+
* List of files excluded from checksum validation.
55+
*
56+
* Note: this list should be kept in sync with what basebackup.c includes.
57+
*/
5258
staticconstchar*constskip[]= {
5359
"pg_control",
5460
"pg_filenode.map",
5561
"pg_internal.init",
5662
"PG_VERSION",
63+
#ifdefEXEC_BACKEND
64+
"config_exec_params",
65+
"config_exec_params.new",
66+
#endif
5767
NULL,
5868
};
5969

@@ -62,13 +72,10 @@ skipfile(const char *fn)
6272
{
6373
constchar*const*f;
6474

65-
if (strcmp(fn,".")==0||
66-
strcmp(fn,"..")==0)
67-
return true;
68-
6975
for (f=skip;*f;f++)
7076
if (strcmp(*f,fn)==0)
7177
return true;
78+
7279
return false;
7380
}
7481

@@ -146,9 +153,22 @@ scan_directory(const char *basedir, const char *subdir)
146153
charfn[MAXPGPATH];
147154
structstatst;
148155

149-
if (skipfile(de->d_name))
156+
if (strcmp(de->d_name,".")==0||
157+
strcmp(de->d_name,"..")==0)
150158
continue;
151159

160+
/* Skip temporary files */
161+
if (strncmp(de->d_name,
162+
PG_TEMP_FILE_PREFIX,
163+
strlen(PG_TEMP_FILE_PREFIX))==0)
164+
continue;
165+
166+
/* Skip temporary folders */
167+
if (strncmp(de->d_name,
168+
PG_TEMP_FILES_DIR,
169+
strlen(PG_TEMP_FILES_DIR))==0)
170+
return;
171+
152172
snprintf(fn,sizeof(fn),"%s/%s",path,de->d_name);
153173
if (lstat(fn,&st)<0)
154174
{
@@ -163,6 +183,9 @@ scan_directory(const char *basedir, const char *subdir)
163183
*segmentpath;
164184
BlockNumbersegmentno=0;
165185

186+
if (skipfile(de->d_name))
187+
continue;
188+
166189
/*
167190
* Cut off at the segment boundary (".") to get the segment number
168191
* in order to mix it into the checksum. Then also cut off at the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp