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

Commitcd7569a

Browse files
committed
dummy commit
1 parentdb00d83 commitcd7569a

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

‎contrib/pg_upgrade/pg_upgrade.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ main(int argc, char **argv)
150150
new_cluster.pgdata);
151151
check_ok();
152152

153+
prep_status("Sync data directory to disk");
154+
exec_prog(UTILITY_LOG_FILE,NULL, true,
155+
"\"%s/initdb\" --sync-only \"%s\"",new_cluster.bindir,
156+
new_cluster.pgdata);
157+
check_ok();
158+
153159
create_script_for_cluster_analyze(&analyze_script_file_name);
154160
create_script_for_old_cluster_deletion(&deletion_script_file_name);
155161

‎contrib/pg_upgrade/server.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,18 @@ start_postmaster(ClusterInfo *cluster)
209209
* a gap of 2000000000 from the current xid counter, so autovacuum will
210210
* not touch them.
211211
*
212-
*synchronous_commit=offimprovesobject creation speed, and we only
213-
*modify the new cluster, so only use it there. If there is a crash,
214-
*the new cluster has to be recreated anyway.
212+
* Turnoffdurability requirements to improveobject creation speed, and
213+
* we onlymodify the new cluster, so only use it there. If there is a
214+
* crash,the new cluster has to be recreated anyway.
215215
*/
216216
snprintf(cmd,sizeof(cmd),
217217
"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s%s%s\" start",
218218
cluster->bindir,SERVER_LOG_FILE,cluster->pgconfig,cluster->port,
219219
(cluster->controldata.cat_ver >=
220220
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ?" -b" :
221221
" -c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
222-
(cluster==&new_cluster) ?" -c synchronous_commit=off" :"",
222+
(cluster==&new_cluster) ?
223+
" -c synchronous_commit=off -c fsync=off -c full_page_writes=off" :"",
223224
cluster->pgopts ?cluster->pgopts :"",socket_string);
224225

225226
/*

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,17 @@ PostgreSQL documentation
244244
</listitem>
245245
</varlistentry>
246246

247+
<varlistentry>
248+
<term><option>-S</option></term>
249+
<term><option>--sync-only</option></term>
250+
<listitem>
251+
<para>
252+
Safely write all database files to disk and exit. This does not
253+
perform any of the normal <application>initdb</> operations.
254+
</para>
255+
</listitem>
256+
</varlistentry>
257+
247258
<varlistentry>
248259
<term><option>-T <replaceable>CFG</></option></term>
249260
<term><option>--text-search-config=<replaceable>CFG</></option></term>

‎src/bin/initdb/initdb.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ static const char *authmethodlocal = "";
118118
staticbooldebug= false;
119119
staticboolnoclean= false;
120120
staticbooldo_sync= true;
121+
staticboolsync_only= false;
121122
staticboolshow_setting= false;
122123
staticchar*xlog_dir="";
123124

@@ -2796,6 +2797,7 @@ usage(const char *progname)
27962797
printf(_(" -n, --noclean do not clean up after errors\n"));
27972798
printf(_(" -N, --nosync do not wait for changes to be written safely to disk\n"));
27982799
printf(_(" -s, --show show internal settings\n"));
2800+
printf(_(" -S, --sync-only only sync data directory\n"));
27992801
printf(_("\nOther options:\n"));
28002802
printf(_(" -V, --version output version information, then exit\n"));
28012803
printf(_(" -?, --help show this help, then exit\n"));
@@ -3445,6 +3447,7 @@ main(int argc, char *argv[])
34453447
{"show",no_argument,NULL,'s'},
34463448
{"noclean",no_argument,NULL,'n'},
34473449
{"nosync",no_argument,NULL,'N'},
3450+
{"sync-only",no_argument,NULL,'S'},
34483451
{"xlogdir",required_argument,NULL,'X'},
34493452
{NULL,0,NULL,0}
34503453
};
@@ -3476,7 +3479,7 @@ main(int argc, char *argv[])
34763479

34773480
/* process command-line options */
34783481

3479-
while ((c=getopt_long(argc,argv,"dD:E:L:nNU:WA:sT:X:",long_options,&option_index))!=-1)
3482+
while ((c=getopt_long(argc,argv,"dD:E:L:nNU:WA:sST:X:",long_options,&option_index))!=-1)
34803483
{
34813484
switch (c)
34823485
{
@@ -3522,6 +3525,9 @@ main(int argc, char *argv[])
35223525
case'N':
35233526
do_sync= false;
35243527
break;
3528+
case'S':
3529+
sync_only= true;
3530+
break;
35253531
case'L':
35263532
share_path=pg_strdup(optarg);
35273533
break;
@@ -3589,6 +3595,14 @@ main(int argc, char *argv[])
35893595
exit(1);
35903596
}
35913597

3598+
/* If we only need to fsync, just to it and exit */
3599+
if (sync_only)
3600+
{
3601+
setup_pgdata();
3602+
perform_fsync();
3603+
return0;
3604+
}
3605+
35923606
if (pwprompt&&pwfilename)
35933607
{
35943608
fprintf(stderr,_("%s: password prompt and password file cannot be specified together\n"),progname);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp