Skip to content

Commit b457b2a

Browse files
committed
If pg_stop_backup() is called just after switching to a new xlog file,
wait for the previous instead of the new file to be archived. Based on patch by Simon Riggs.
1 parent b0729b8 commit b457b2a

File tree

1 file changed

+10
-4
lines changed
  • src/backend/access/transam

1 file changed

+10
-4
lines changed

src/backend/access/transam/xlog.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.322 2008/11/09 17:51:15 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.323 2008/12/03 08:20:11 heikki Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -6674,6 +6674,8 @@ pg_stop_backup(PG_FUNCTION_ARGS)
66746674
char histfilepath[MAXPGPATH];
66756675
char startxlogfilename[MAXFNAMELEN];
66766676
char stopxlogfilename[MAXFNAMELEN];
6677+
char lastxlogfilename[MAXFNAMELEN];
6678+
char histfilename[MAXFNAMELEN];
66776679
uint32 _logId;
66786680
uint32 _logSeg;
66796681
FILE *lfp;
@@ -6801,14 +6803,18 @@ pg_stop_backup(PG_FUNCTION_ARGS)
68016803
* we assume the admin wanted his backup to work completely. If you
68026804
* don't wish to wait, you can set statement_timeout.
68036805
*/
6804-
BackupHistoryFileName(histfilepath, ThisTimeLineID, _logId, _logSeg,
6806+
XLByteToPrevSeg(stoppoint, _logId, _logSeg);
6807+
XLogFileName(lastxlogfilename, ThisTimeLineID, _logId, _logSeg);
6808+
6809+
XLByteToSeg(startpoint, _logId, _logSeg);
6810+
BackupHistoryFileName(histfilename, ThisTimeLineID, _logId, _logSeg,
68056811
startpoint.xrecoff % XLogSegSize);
68066812

68076813
seconds_before_warning = 60;
68086814
waits = 0;
68096815

6810-
while (XLogArchiveIsBusy(stopxlogfilename) ||
6811-
XLogArchiveIsBusy(histfilepath))
6816+
while (XLogArchiveIsBusy(lastxlogfilename) ||
6817+
XLogArchiveIsBusy(histfilename))
68126818
{
68136819
CHECK_FOR_INTERRUPTS();
68146820

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy