Fix bug introduced by the recent patch to check that the checkpoint redo
authorHeikki Linnakangas
Thu, 11 Nov 2010 17:21:49 +0000 (19:21 +0200)
committerHeikki Linnakangas
Thu, 11 Nov 2010 17:32:07 +0000 (19:32 +0200)
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.

src/backend/access/transam/xlog.c

index 1b90f9ae72e4423cd902e49c0b72db03eafb44d3..af53e42430f9cc31a3ed4bffd87aa8bfb795e78e 100644 (file)
@@ -5830,6 +5830,7 @@ StartupXLOG(void)
        if (record != NULL)
        {
            memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
+           wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
            ereport(DEBUG1,
                    (errmsg("checkpoint record is at %X/%X",
                            checkPointLoc.xlogid, checkPointLoc.xrecoff)));
@@ -5854,6 +5855,7 @@ StartupXLOG(void)
            ereport(FATAL,
                    (errmsg("could not locate required checkpoint record"),
                     errhint("If you are not restoring from a backup, try removing the file \"%s/backup_label\".", DataDir)));
+           wasShutdown = false; /* keep compiler quiet */
        }
        /* set flag to delete it later */
        haveBackupLabel = true;
@@ -5898,10 +5900,10 @@ StartupXLOG(void)
                     (errmsg("could not locate a valid checkpoint record")));
        }
        memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
+       wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
    }
 
    LastRec = RecPtr = checkPointLoc;
-   wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
 
    ereport(DEBUG1,
            (errmsg("redo record is at %X/%X; shutdown %s",