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

Commit4409144

Browse files
committed
In pg_upgrade, avoid one start/stop of the postmaster; use the -w
(wait) flag for pg_ctl start/stop; remove the unused "quiet" flag inthe functions for starting/stopping the postmaster.
1 parent6dab96a commit4409144

File tree

4 files changed

+21
-26
lines changed

4 files changed

+21
-26
lines changed

‎contrib/pg_upgrade/check.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ check_old_cluster(bool live_check,
4646
/* -- OLD -- */
4747

4848
if (!live_check)
49-
start_postmaster(&old_cluster, false);
49+
start_postmaster(&old_cluster);
5050

5151
set_locale_and_encoding(&old_cluster);
5252

@@ -104,7 +104,7 @@ check_old_cluster(bool live_check,
104104
}
105105

106106
if (!live_check)
107-
stop_postmaster(false, false);
107+
stop_postmaster(false);
108108
}
109109

110110

@@ -134,7 +134,7 @@ report_clusters_compatible(void)
134134
{
135135
pg_log(PG_REPORT,"\n*Clusters are compatible*\n");
136136
/* stops new cluster */
137-
stop_postmaster(false, false);
137+
stop_postmaster(false);
138138
exit(0);
139139
}
140140

@@ -152,7 +152,7 @@ issue_warnings(char *sequence_script_file_name)
152152
/* old = PG 8.3 warnings? */
153153
if (GET_MAJOR_VERSION(old_cluster.major_version) <=803)
154154
{
155-
start_postmaster(&new_cluster, true);
155+
start_postmaster(&new_cluster);
156156

157157
/* restore proper sequence values using file created from old server */
158158
if (sequence_script_file_name)
@@ -171,15 +171,15 @@ issue_warnings(char *sequence_script_file_name)
171171
old_8_3_rebuild_tsvector_tables(&new_cluster, false);
172172
old_8_3_invalidate_hash_gin_indexes(&new_cluster, false);
173173
old_8_3_invalidate_bpchar_pattern_ops_indexes(&new_cluster, false);
174-
stop_postmaster(false, true);
174+
stop_postmaster(false);
175175
}
176176

177177
/* Create dummy large object permissions for old < PG 9.0? */
178178
if (GET_MAJOR_VERSION(old_cluster.major_version) <=804)
179179
{
180-
start_postmaster(&new_cluster, true);
180+
start_postmaster(&new_cluster);
181181
new_9_0_populate_pg_largeobject_metadata(&new_cluster, false);
182-
stop_postmaster(false, true);
182+
stop_postmaster(false);
183183
}
184184
}
185185

‎contrib/pg_upgrade/pg_upgrade.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ main(int argc, char **argv)
7777

7878

7979
/* -- NEW -- */
80-
start_postmaster(&new_cluster, false);
80+
start_postmaster(&new_cluster);
8181

8282
check_new_cluster();
8383
report_clusters_compatible();
@@ -88,7 +88,7 @@ main(int argc, char **argv)
8888
disable_old_cluster();
8989
prepare_new_cluster();
9090

91-
stop_postmaster(false, false);
91+
stop_postmaster(false);
9292

9393
/*
9494
* Destructive Changes to New Cluster
@@ -98,10 +98,15 @@ main(int argc, char **argv)
9898

9999
/* New now using xids of the old system */
100100

101+
/* -- NEW -- */
102+
start_postmaster(&new_cluster);
103+
101104
prepare_new_databases();
102105

103106
create_new_objects();
104107

108+
stop_postmaster(false);
109+
105110
transfer_all_new_dbs(&old_cluster.dbarr,&new_cluster.dbarr,
106111
old_cluster.pgdata,new_cluster.pgdata);
107112

@@ -216,9 +221,6 @@ prepare_new_cluster(void)
216221
staticvoid
217222
prepare_new_databases(void)
218223
{
219-
/* -- NEW -- */
220-
start_postmaster(&new_cluster, false);
221-
222224
/*
223225
* We set autovacuum_freeze_max_age to its maximum value so autovacuum
224226
* does not launch here and delete clog files, before the frozen xids are
@@ -252,8 +254,6 @@ prepare_new_databases(void)
252254

253255
/* we load this to get a current list of databases */
254256
get_db_and_rel_infos(&new_cluster);
255-
256-
stop_postmaster(false, false);
257257
}
258258

259259

@@ -262,9 +262,6 @@ create_new_objects(void)
262262
{
263263
intdbnum;
264264

265-
/* -- NEW -- */
266-
start_postmaster(&new_cluster, false);
267-
268265
prep_status("Adding support functions to new cluster");
269266

270267
for (dbnum=0;dbnum<new_cluster.dbarr.ndbs;dbnum++)
@@ -290,8 +287,6 @@ create_new_objects(void)
290287
get_db_and_rel_infos(&new_cluster);
291288

292289
uninstall_support_functions_from_new_cluster();
293-
294-
stop_postmaster(false, false);
295290
}
296291

297292

‎contrib/pg_upgrade/pg_upgrade.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ voidinit_tablespaces(void);
359359
PGconn*connectToServer(ClusterInfo*cluster,constchar*db_name);
360360
PGresult*executeQueryOrDie(PGconn*conn,constchar*fmt,...);
361361

362-
voidstart_postmaster(ClusterInfo*cluster,boolquiet);
363-
voidstop_postmaster(boolfast,boolquiet);
362+
voidstart_postmaster(ClusterInfo*cluster);
363+
voidstop_postmaster(boolfast);
364364
uint32get_major_server_version(ClusterInfo*cluster);
365365
voidcheck_for_libpq_envvars(void);
366366

‎contrib/pg_upgrade/server.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ stop_postmaster_atexit(void)
160160
stop_postmaster_on_exit(intexitstatus,void*arg)
161161
#endif
162162
{
163-
stop_postmaster(true, true);
163+
stop_postmaster(true);
164164

165165
}
166166

167167

168168
void
169-
start_postmaster(ClusterInfo*cluster,boolquiet)
169+
start_postmaster(ClusterInfo*cluster)
170170
{
171171
charcmd[MAXPGPATH];
172172
constchar*bindir;
@@ -205,7 +205,7 @@ start_postmaster(ClusterInfo *cluster, bool quiet)
205205
* not touch them.
206206
*/
207207
snprintf(cmd,sizeof(cmd),
208-
SYSTEMQUOTE"\"%s/pg_ctl\" -l \"%s\" -D \"%s\" "
208+
SYSTEMQUOTE"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" "
209209
"-o \"-p %d %s\" start >> \"%s\" 2>&1"SYSTEMQUOTE,
210210
bindir,output_filename,datadir,port,
211211
(cluster->controldata.cat_ver >=
@@ -228,7 +228,7 @@ start_postmaster(ClusterInfo *cluster, bool quiet)
228228

229229

230230
void
231-
stop_postmaster(boolfast,boolquiet)
231+
stop_postmaster(boolfast)
232232
{
233233
charcmd[MAXPGPATH];
234234
constchar*bindir;
@@ -249,7 +249,7 @@ stop_postmaster(bool fast, bool quiet)
249249

250250
/* See comment in start_postmaster() about why win32 output is ignored. */
251251
snprintf(cmd,sizeof(cmd),
252-
SYSTEMQUOTE"\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> "
252+
SYSTEMQUOTE"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" %s stop >> "
253253
"\"%s\" 2>&1"SYSTEMQUOTE,
254254
bindir,
255255
#ifndefWIN32

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp