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

Commite7873b7

Browse files
committed
Open output file before sleeping in pg_recvlogical.
Let's complain about e.g an invalid path or permission problem sooner ratherthan later. Before this patch, we would only try to open the output fileafter receiving the first decoded message from the server.
1 parent07a4a93 commite7873b7

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

‎src/bin/pg_basebackup/pg_recvlogical.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,23 @@ StreamLog(void)
315315
}
316316
output_reopen= false;
317317

318+
/* open the output file, if not open yet */
319+
if (outfd==-1)
320+
{
321+
if (strcmp(outfile,"-")==0)
322+
outfd=fileno(stdout);
323+
else
324+
outfd=open(outfile,O_CREAT |O_APPEND |O_WRONLY |PG_BINARY,
325+
S_IRUSR |S_IWUSR);
326+
if (outfd==-1)
327+
{
328+
fprintf(stderr,
329+
_("%s: could not open log file \"%s\": %s\n"),
330+
progname,outfile,strerror(errno));
331+
gotoerror;
332+
}
333+
}
334+
318335
r=PQgetCopyData(conn,&copybuf,1);
319336
if (r==0)
320337
{
@@ -479,23 +496,6 @@ StreamLog(void)
479496
output_written_lsn=Max(temp,output_written_lsn);
480497
}
481498

482-
/* open the output file, if not open yet */
483-
if (outfd==-1)
484-
{
485-
if (strcmp(outfile,"-")==0)
486-
outfd=fileno(stdout);
487-
else
488-
outfd=open(outfile,O_CREAT |O_APPEND |O_WRONLY |PG_BINARY,
489-
S_IRUSR |S_IWUSR);
490-
if (outfd==-1)
491-
{
492-
fprintf(stderr,
493-
_("%s: could not open log file \"%s\": %s\n"),
494-
progname,outfile,strerror(errno));
495-
gotoerror;
496-
}
497-
}
498-
499499
bytes_left=r-hdr_len;
500500
bytes_written=0;
501501

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp