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

Commitf8c81c5

Browse files
committed
In pg_upgrade, try a few times to open a log file.
If we call pg_ctl stop, the server might continue and thushold a log file for a short time after it has deleted its pid file,(which is when pg_ctl will exit), and so a subsequent attempt toopen the log file might fail.We therefore try to open it a few times, sleeping one second betweentries, to give the server time to exit.This corrects an error that was observed on the buildfarm.Backpatched to 9.2,
1 parent4c60b80 commitf8c81c5

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

‎contrib/pg_upgrade/exec.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,28 @@ exec_prog(const char *log_file, const char *opt_log_file,
6363
if (written >=MAXCMDLEN)
6464
pg_log(PG_FATAL,"command too long\n");
6565

66-
if ((log=fopen_priv(log_file,"a"))==NULL)
66+
log=fopen_priv(log_file,"a");
67+
68+
#ifdefWIN32
69+
{
70+
/*
71+
* "pg_ctl -w stop" might have reported that the server has
72+
* stopped because the postmaster.pid file has been removed,
73+
* but "pg_ctl -w start" might still be in the process of
74+
* closing and might still be holding its stdout and -l log
75+
* file descriptors open. Therefore, try to open the log
76+
* file a few more times.
77+
*/
78+
intiter;
79+
for (iter=0;iter<4&&log==NULL;iter++)
80+
{
81+
sleep(1);
82+
log=fopen_priv(log_file,"a");
83+
}
84+
}
85+
#endif
86+
87+
if (log==NULL)
6788
pg_log(PG_FATAL,"cannot write to log file %s\n",log_file);
6889
#ifdefWIN32
6990
fprintf(log,"\n\n");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp