Skip to content

Commit 9dba66c

Browse files
committed
Fix bug introduced by the recent patch to check that the checkpoint redo
location read from backup label file can be found: wasShutdown was set incorrectly when a backup label file was found. Jeff Davis, with a little tweaking by me.
1 parent 01670b8 commit 9dba66c

File tree

1 file changed

+3
-1
lines changed
  • src/backend/access/transam

1 file changed

+3
-1
lines changed

src/backend/access/transam/xlog.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5830,6 +5830,7 @@ StartupXLOG(void)
58305830
if (record != NULL)
58315831
{
58325832
memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
5833+
wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
58335834
ereport(DEBUG1,
58345835
(errmsg("checkpoint record is at %X/%X",
58355836
checkPointLoc.xlogid, checkPointLoc.xrecoff)));
@@ -5854,6 +5855,7 @@ StartupXLOG(void)
58545855
ereport(FATAL,
58555856
(errmsg("could not locate required checkpoint record"),
58565857
errhint("If you are not restoring from a backup, try removing the file \"%s/backup_label\".", DataDir)));
5858+
wasShutdown = false; /* keep compiler quiet */
58575859
}
58585860
/* set flag to delete it later */
58595861
haveBackupLabel = true;
@@ -5898,10 +5900,10 @@ StartupXLOG(void)
58985900
(errmsg("could not locate a valid checkpoint record")));
58995901
}
59005902
memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
5903+
wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
59015904
}
59025905

59035906
LastRec = RecPtr = checkPointLoc;
5904-
wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
59055907

59065908
ereport(DEBUG1,
59075909
(errmsg("redo record is at %X/%X; shutdown %s",

0 commit comments

Comments
 (0)