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

Commit2f5c439

Browse files
committed
When fetching WAL for a basebackup, report errors with a sensible TLI.
The previous code used ThisTimeLineID, which need not even beinitialized here, although it usually was in practice, becausepg_basebackup issues IDENTIFY_SYSTEM before calling BASE_BACKUP,and that initializes ThisTimeLineID as a side effect. That's notreally good enough, though, not only because we shoudn't be countingon side effects like that, but also because the TLI could changemeanwhile. Fortunately, we have convenient access to more meaningfulTLI values, so use those instead.Because of the way this logic is coded, the consequences of usinga possibly-incorrect TLI here are no worse than a slightly confusingerror message, I don't want to take any risk here, so no back-patchat least for now.Patch by me, reviewed by Kyotaro Horiguchi and Michael PaquierDiscussion:http://postgr.es/m/CA+TgmoZRNWGWYDX9RgTXMG6_nwSdB=PB-PPRUbvMUTGfmL2sHQ@mail.gmail.com
1 parent5f55fc5 commit2f5c439

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎src/backend/replication/basebackup.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ perform_base_backup(basebackup_options *opt)
502502
* including them.
503503
*/
504504
XLByteToSeg(startptr,startsegno,wal_segment_size);
505-
XLogFileName(firstoff,ThisTimeLineID,startsegno,wal_segment_size);
505+
XLogFileName(firstoff,starttli,startsegno,wal_segment_size);
506506
XLByteToPrevSeg(endptr,endsegno,wal_segment_size);
507-
XLogFileName(lastoff,ThisTimeLineID,endsegno,wal_segment_size);
507+
XLogFileName(lastoff,endtli,endsegno,wal_segment_size);
508508

509509
dir=AllocateDir("pg_wal");
510510
while ((de=ReadDir(dir,"pg_wal"))!=NULL)
@@ -528,7 +528,7 @@ perform_base_backup(basebackup_options *opt)
528528
* Before we go any further, check that none of the WAL segments we
529529
* need were removed.
530530
*/
531-
CheckXLogRemoved(startsegno,ThisTimeLineID);
531+
CheckXLogRemoved(startsegno,starttli);
532532

533533
/*
534534
* Sort the WAL filenames. We want to send the files in order from
@@ -555,7 +555,7 @@ perform_base_backup(basebackup_options *opt)
555555
{
556556
charstartfname[MAXFNAMELEN];
557557

558-
XLogFileName(startfname,ThisTimeLineID,startsegno,
558+
XLogFileName(startfname,starttli,startsegno,
559559
wal_segment_size);
560560
ereport(ERROR,
561561
(errmsg("could not find WAL file \"%s\"",startfname)));
@@ -571,8 +571,7 @@ perform_base_backup(basebackup_options *opt)
571571
{
572572
charnextfname[MAXFNAMELEN];
573573

574-
XLogFileName(nextfname,ThisTimeLineID,nextsegno,
575-
wal_segment_size);
574+
XLogFileName(nextfname,tli,nextsegno,wal_segment_size);
576575
ereport(ERROR,
577576
(errmsg("could not find WAL file \"%s\"",nextfname)));
578577
}
@@ -581,7 +580,7 @@ perform_base_backup(basebackup_options *opt)
581580
{
582581
charendfname[MAXFNAMELEN];
583582

584-
XLogFileName(endfname,ThisTimeLineID,endsegno,wal_segment_size);
583+
XLogFileName(endfname,endtli,endsegno,wal_segment_size);
585584
ereport(ERROR,
586585
(errmsg("could not find WAL file \"%s\"",endfname)));
587586
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp