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

Commitb741f4c

Browse files
committed
Add --clobber-cache option to initdb, for CCA testing.
Commit4656e3d replaced the "#define CLOBBER_CACHE_ALWAYS"testing mechanism with a GUC, which has been a great help fordoing cache-clobber testing in more efficient ways; but thereis a gap in the implementation. The only way to do cache-clobbertesting during an initdb run is to use the old method with #define,because one can't set the GUC from outside. Improve this byadding a switch to initdb for the purpose.(Perhaps someday we should let initdb pass through arbitrary"-c NAME=VALUE" switches. Quoting difficulties dissuaded mefrom attempting that right now, though.)Back-patch to v14 where4656e3d came in.Discussion:https://postgr.es/m/1582507.1624227029@sss.pgh.pa.us
1 parentd700518 commitb741f4c

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

‎doc/src/sgml/ref/initdb.sgml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,17 @@ PostgreSQL documentation
388388
Other, less commonly used, options are also available:
389389

390390
<variablelist>
391+
<varlistentry>
392+
<term><option>--clobber-cache</option></term>
393+
<listitem>
394+
<para>
395+
Run the bootstrap backend with the
396+
<literal>debug_invalidate_system_caches_always=1</literal> option.
397+
This takes a very long time and is only of use for deep debugging.
398+
</para>
399+
</listitem>
400+
</varlistentry>
401+
391402
<varlistentry>
392403
<term><option>-d</option></term>
393404
<term><option>--debug</option></term>

‎src/bin/initdb/initdb.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ static bool authwarning = false;
202202
staticconstchar*boot_options="-F";
203203
staticconstchar*backend_options="--single -F -O -j -c search_path=pg_catalog -c exit_on_error=true";
204204

205+
/* Additional switches to pass to backend (either boot or standalone) */
206+
staticchar*extra_options="";
207+
205208
staticconstchar*constsubdirs[]= {
206209
"global",
207210
"pg_wal/archive_status",
@@ -962,12 +965,12 @@ test_config_settings(void)
962965
test_buffs=MIN_BUFS_FOR_CONNS(test_conns);
963966

964967
snprintf(cmd,sizeof(cmd),
965-
"\"%s\" --boot -x0 %s "
968+
"\"%s\" --boot -x0 %s%s"
966969
"-c max_connections=%d "
967970
"-c shared_buffers=%d "
968971
"-c dynamic_shared_memory_type=%s "
969972
"< \"%s\" > \"%s\" 2>&1",
970-
backend_exec,boot_options,
973+
backend_exec,boot_options,extra_options,
971974
test_conns,test_buffs,
972975
dynamic_shared_memory_type,
973976
DEVNULL,DEVNULL);
@@ -998,12 +1001,12 @@ test_config_settings(void)
9981001
}
9991002

10001003
snprintf(cmd,sizeof(cmd),
1001-
"\"%s\" --boot -x0 %s "
1004+
"\"%s\" --boot -x0 %s%s"
10021005
"-c max_connections=%d "
10031006
"-c shared_buffers=%d "
10041007
"-c dynamic_shared_memory_type=%s "
10051008
"< \"%s\" > \"%s\" 2>&1",
1006-
backend_exec,boot_options,
1009+
backend_exec,boot_options,extra_options,
10071010
n_connections,test_buffs,
10081011
dynamic_shared_memory_type,
10091012
DEVNULL,DEVNULL);
@@ -1403,11 +1406,11 @@ bootstrap_template1(void)
14031406
unsetenv("PGCLIENTENCODING");
14041407

14051408
snprintf(cmd,sizeof(cmd),
1406-
"\"%s\" --boot -x1 -X %u %s %s %s",
1409+
"\"%s\" --boot -x1 -X %u %s %s %s %s",
14071410
backend_exec,
14081411
wal_segment_size_mb* (1024*1024),
14091412
data_checksums ?"-k" :"",
1410-
boot_options,
1413+
boot_options,extra_options,
14111414
debug ?"-d 5" :"");
14121415

14131416

@@ -2263,6 +2266,7 @@ usage(const char *progname)
22632266
printf(_(" -X, --waldir=WALDIR location for the write-ahead log directory\n"));
22642267
printf(_(" --wal-segsize=SIZE size of WAL segments, in megabytes\n"));
22652268
printf(_("\nLess commonly used options:\n"));
2269+
printf(_(" --clobber-cache use cache-clobbering debug option\n"));
22662270
printf(_(" -d, --debug generate lots of debugging output\n"));
22672271
printf(_(" -L DIRECTORY where to find the input files\n"));
22682272
printf(_(" -n, --no-clean do not clean up after errors\n"));
@@ -2863,8 +2867,8 @@ initialize_data_directory(void)
28632867
fflush(stdout);
28642868

28652869
snprintf(cmd,sizeof(cmd),
2866-
"\"%s\" %s template1 >%s",
2867-
backend_exec,backend_options,
2870+
"\"%s\" %s%stemplate1 >%s",
2871+
backend_exec,backend_options,extra_options,
28682872
DEVNULL);
28692873

28702874
PG_CMD_OPEN;
@@ -2943,6 +2947,7 @@ main(int argc, char *argv[])
29432947
{"wal-segsize",required_argument,NULL,12},
29442948
{"data-checksums",no_argument,NULL,'k'},
29452949
{"allow-group-access",no_argument,NULL,'g'},
2950+
{"clobber-cache",no_argument,NULL,14},
29462951
{NULL,0,NULL,0}
29472952
};
29482953

@@ -3084,6 +3089,11 @@ main(int argc, char *argv[])
30843089
case'g':
30853090
SetDataDirectoryCreatePerm(PG_DIR_MODE_GROUP);
30863091
break;
3092+
case14:
3093+
extra_options=psprintf("%s %s",
3094+
extra_options,
3095+
"-c debug_invalidate_system_caches_always=1");
3096+
break;
30873097
default:
30883098
/* getopt_long already emitted a complaint */
30893099
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp