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

Commit254316f

Browse files
committed
Complain with proper error message if streaming stops prematurely
In particular, with a controlled shutdown of the master, pg_basebackupwith streaming log could terminate without an error message, even thoughthe backup is not consistent.In passing, fix a few cases where walfile wasn't properly set to -1 afterclosing.Fujii Masao
1 parent3ff1588 commit254316f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/bin/pg_basebackup/receivelog.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,20 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
611611
}
612612
PQclear(res);
613613

614+
/* Complain if we've not reached stop point yet */
615+
if (stream_stop!=NULL&& !stream_stop(blockpos,timeline, false))
616+
{
617+
fprintf(stderr,_("%s: replication stream was terminated before stop point\n"),
618+
progname);
619+
gotoerror;
620+
}
621+
614622
if (copybuf!=NULL)
615623
PQfreemem(copybuf);
616624
if (walfile!=-1&&close(walfile)!=0)
617625
fprintf(stderr,_("%s: could not close file %s: %s\n"),
618626
progname,current_walfile_name,strerror(errno));
627+
walfile=-1;
619628
return true;
620629

621630
error:
@@ -624,5 +633,6 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
624633
if (walfile!=-1&&close(walfile)!=0)
625634
fprintf(stderr,_("%s: could not close file %s: %s\n"),
626635
progname,current_walfile_name,strerror(errno));
636+
walfile=-1;
627637
return false;
628638
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp